示例#1
0
 def execute(self):
     # methods
     print("[Case Recommender: Rating Prediction > ItemKNN Algorithm]\n")
     print("training data:: " + str(len(self.train_set['users'])) + " users and " + str(len(
         self.train_set['items'])) + " items and " + str(self.train_set['ni']) + " interactions")
     print("test data:: " + str(len(self.test_set['users'])) + " users and " + str(len(self.test_set['items'])) +
           " items and " + str(self.test_set['ni']) + " interactions")
     # training baselines bui
     self.fill_matrix()
     print("training time:: " + str(timed(self.train_baselines))) + " sec"
     self.compute_similarity()
     print("prediction_time:: " + str(timed(self.predict))) + " sec\n"
     self.evaluate(self.predictions)
示例#2
0
 def execute(self):
     print("[Case Recommender: Item Recommendation > UserKNN Algorithm]\n")
     print("training data:: " + str(len(self.train_set["map_user"])) + " users and " + str(len(
         self.train_set["map_item"])) + " items and " + str(self.train_set["number_interactions"]) + " interactions")
     if self.test_file is not None:
         test_set = ReadFile(self.test_file).return_matrix()
         print("test data:: " + str(len(test_set["map_user"])) + " users and " + str(len(test_set["map_item"])) +
               " items and " + str(test_set["number_interactions"]) + " interactions")
         del test_set
     print("training time:: " + str(timed(self.compute_similarity))) + " sec"
     print("prediction_time:: " + str(timed(self.predict))) + " sec\n"
     if self.test_file is not None:
         self.evaluate()
 def execute(self):
     # methods
     print("[Case Recommender: Rating Prediction > Item Attribute KNN Algorithm]\n")
     print("training data:: " + str(len(self.train_set['users'])) + " users and " + str(len(
         self.train_set['items'])) + " items and " + str(self.train_set['ni']) + " interactions")
     print("test data:: " + str(len(self.test_set['users'])) + " users and " + str(len(self.test_set['items'])) +
           " items and " + str(self.test_set['ni']) + " interactions")
     # training baselines bui
     print("training time:: " + str(timed(self.train_baselines))) + " sec"
     if self.similarity_matrix_file is not None:
         print("compute similarity:: " + str(timed(self.read_matrix))) + " sec"
     else:
         print("compute similarity time:: " + str(timed(self.compute_similarity))) + " sec"
     print("prediction_time:: " + str(timed(self.predict))) + " sec\n"
     self.evaluate(self.predictions)
示例#4
0
 def execute(self):
     # methods
     print("[Case Recommender: Item Recommendation > BPR MF Algorithm]\n")
     print("training data:: " + str(self.number_users) + " users and " + str(self.number_items) + " items and " +
           str(self.train_set["number_interactions"]) + " interactions")
     if self.test_file is not None:
         test_set = ReadFile(self.test_file).return_matrix()
         print("test data:: " + str(len(test_set["map_user"])) + " users and " + str(len(test_set["map_item"])) +
               " items and " + str(test_set["number_interactions"]) + " interactions")
         del test_set
     self._create_factors()
     print("training time:: " + str(timed(self.train_model))) + " sec"
     print("prediction_time:: " + str(timed(self.predict))) + " sec\n"
     if self.test_file is not None:
         self.evaluate()
    def execute(self):
        # methods
        print("[Case Recommender: Rating Prediction > User NSVD1]\n")
        print("training data:: " + str(len(self.train['users'])) + " users and " + str(len(
            self.train['items'])) + " items and " + str(self.train['ni']) + " interactions")
        print("test data:: " + str(len(self.test['users'])) + " users and " + str(len(self.test['items'])) +
              " items and " + str(self.test['ni']) + " interactions")
        print("metadata:: " + str(len(self.metadata['items'])) + " users and " + str(len(self.metadata['metadata'])) +
              " metadata and " + str(self.metadata['ni']) + " interactions")
        self._create_factors()

        if self.batch:
            print("training time:: " + str(timed(self.train_batch_model))) + " sec"
        else:
            print("training time:: " + str(timed(self.train_model))) + " sec"

        print("prediction_time:: " + str(timed(self.predict))) + " sec\n"
        self.evaluate(self.predictions)