예제 #1
0
 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'))
예제 #2
0
 def test_constructor(self):
     _ = RandomForest()
예제 #3
0
 def setUp(self):
     self.rf = RandomForest()