示例#1
0
 def setUp(self):
     self.model_filename = "my_model_file.bin"
     with open("data/train.pickle", mode="rb") as f:
         self.train_data = pickle.load(f)["features"]
     trainer = Trainer()
     trainer.train(self.train_data)
     trainer.save(self.model_filename)
示例#2
0
 def setUp(self):
     self.model_filename = "my_model_file.bin"
     with open("data/train.pickle",
               mode="rb") as train_file, open("data/test.pickle",
                                              mode="rb") as test_file:
         self.train_data = pickle.load(train_file)["features"]
         self.test_data = pickle.load(test_file)
     trainer = Trainer()
     trainer.train(self.train_data, n_components=1)
     trainer.save(self.model_filename)
示例#3
0
 def test_train_with_small_data(self):
     trainer = Trainer()
     trainer.train([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
     trainer.save("tmp.model")
示例#4
0
 def test_train_and_save(self):
     trainer = Trainer()
     trainer.train(self.train_data["features"])
     trainer.save("tmp.model")