def setUp(self): self.als = ALS(**cfg.model.als) self.data = DataReader(**cfg.testdata) self.data.make_consecutive_ids_in_dataset() self.data.binarize() self.als.fit(self.data)
class EMFTest(unittest.TestCase): def setUp(self) -> None: self.emf = EMFModel(**cfg.model.emf) self.data = DataReader(**cfg.testdata) self.data.make_consecutive_ids_in_dataset() def test_train_emf(self): self.assertTrue(self.emf.fit(self.data)) recommender = Recommender(self.data, self.emf) recommender.recommend_all()
class GMFTest(unittest.TestCase): def setUp(self) -> None: self.autoencoder = ExplAutoencoderTorch(**cfg.model.autoencoder) self.data = DataReader(**cfg.testdata) self.data.make_consecutive_ids_in_dataset() self.data.binarize() def test_train_autoencoder(self): self.assertTrue(self.autoencoder.fit(self.data)) recommender = Recommender(self.data, self.autoencoder) recommender.recommend_all()
class MLPTest(unittest.TestCase): def setUp(self) -> None: self.mlp = MLPModel(**cfg.model.mlp) self.data = DataReader(**cfg.testdata) self.data.make_consecutive_ids_in_dataset() self.data.binarize() def test_train_mlp(self): self.assertTrue(self.mlp.fit(self.data)) recommender = Recommender(self.data, self.mlp) recommender.recommend_all()
class RecommenderImplicitTest(unittest.TestCase): def setUp(self): self.als = ALS(**cfg.model.als) self.data = DataReader(**cfg.testdata) self.data.make_consecutive_ids_in_dataset() self.data.binarize() self.als.fit(self.data) def test_train_recommend_als(self): recommender = Recommender(self.data, self.als) recommender.recommend_all()
class UserItemMatrixTest(unittest.TestCase): def setUp(self) -> None: self.data = DataReader(**cfg.testdata) self.data.make_consecutive_ids_in_dataset() def test_user_item_matrix(self): user_dict = UserItemDict(self.data.dataset) x = self.data.dataset.userId[0] y = self.data.dataset.itemId[0] v = self.data.dataset.rating[0] self.assertEqual(user_dict[x][y], v)
class ALSTest(unittest.TestCase): def setUp(self): self.als = ALS(**cfg.model.als) self.bpr = BPR(**cfg.model.bpr) self.data = DataReader(**cfg.testdata) self.data.make_consecutive_ids_in_dataset() self.data.binarize() def test_train_als(self): self.assertTrue(self.als.fit(self.data)) recommender = Recommender(self.data, self.als) recommender.recommend_all() def test_train_bpr(self): self.assertTrue(self.bpr.fit(self.data)) recommender = Recommender(self.data, self.bpr) recommender.recommend_all()
def setUp(self) -> None: self.emf = EMFModel(**cfg.model.emf) self.data = DataReader(**cfg.testdata) self.data.make_consecutive_ids_in_dataset()
def setUp(self) -> None: self.autoencoder = ExplAutoencoderTorch(**cfg.model.autoencoder) self.data = DataReader(**cfg.testdata) self.data.make_consecutive_ids_in_dataset() self.data.binarize()
def setUp(self) -> None: self.data = DataReader(**cfg.testdata)
def setUp(self) -> None: self.data = DataReader(**cfg.testdata) self.data.make_consecutive_ids_in_dataset()
def setUp(self) -> None: self.mlp = MLPModel(**cfg.model.mlp) self.data = DataReader(**cfg.testdata) self.data.make_consecutive_ids_in_dataset() self.data.binarize()