def test_load_model(self): X, y, _ = datasets.csv2numpy( config.get('RandomForest_test', 'traindata')) self.rf.fit(X, y) newX, _, _ = datasets.csv2numpy( config.get('RandomForest_test', 'noveldata')) prediction = self.rf.predict(newX) self.rf.save_model(config.get('RandomForest_test', 'modelfile')) newrf = RandomForest() newrf.load_model(config.get('RandomForest_test', 'modelfile')) self.assertTrue(numpy.array_equal(prediction, newrf.predict(newX))) os.remove(config.get('RandomForest_test', 'modelfile'))
def test_constructor(self): _ = RandomForest()
def setUp(self): self.rf = RandomForest()