Exemplo n.º 1
0
 def __init__(self, data: DataObject):
     super(CarmenTran_Recommender, self).__init__(data.urm_train)
     self.data = data
     self.cold_recommender = Hybrid100AlphaRecommender(data)
     self.warm_1_recommender = Hybrid201AlphaRecommender(data)
     self.warm_recommender = Hybrid3ScoreRecommender(
         data=data, random_seed=data.random_seed)
    def __init__(self, data: DataObject):
        super(Hybrid600AlphaRecommender, self).__init__(data.urm_train)
        self.data = data
        self.cold_recommender = Hybrid100AlphaRecommender(data)
        self.warm_1_recommender = Hybrid101AlphaRecommender(data)

        self.warm_recommender = Hybrid3ScoreSubRecommender(data=data)
 def __init__(self, data: DataObject):
     super(Hybrid004AlphaRecommender, self).__init__(data.urm_train)
     self.data = data
     self.warm_recommender = Hybrid300AlphaRecommender(data)
     self.warm_1_recommender = Hybrid101AlphaRecommender(data)
     # self.warm_2_recommender = Hybrid102AlphaRecommender(data)
     self.warm_7_recommender = Hybrid300AlphaRecommender(data)
     self.cold_recommender = Hybrid100AlphaRecommender(data)
    def __init__(self,
                 data: DataObject,
                 k: int,
                 leave_k_out=0,
                 threshold=0,
                 probability=0.2):
        super(Hybrid400AlphaRecommender, self).__init__(data.urm_train)
        self.data = data
        self.max_cutoff = 30

        rec = ItemKNNCBFRecommender(data.urm_train, data.icm_all_augmented)
        rec.fit(topK=10)

        print(f"Not augmented {data.augmented_urm.nnz}")

        data.augmented_urm = augment_with_item_similarity_best_scores(
            data.augmented_urm,
            rec.W_sparse,
            500,
            value=0.3,
            remove_seen=False)
        # print(f"After User CBF {data.augmented_urm.nnz}")
        # data.augmented_urm = augment_with_best_recommended_items(data.augmented_urm, rec,
        #                                                          data.urm_train_users_by_type[1][1], 1, value=0.2)
        #
        print(f"After Item CBF {data.augmented_urm.nnz}")

        rec = Hybrid100AlphaRecommender(data)
        rec.fit()

        data.augmented_urm = augment_with_best_recommended_items(
            data.augmented_urm,
            rec,
            data.urm_train_users_by_type[0][1],
            1,
            value=1)
        # data.augmented_urm = augment_with_best_recommended_items(data.augmented_urm, rec,
        #                                                          data.ids_warm_train_users, 2, value=0.1)
        print(f"After User CBF {data.augmented_urm.nnz}")
        # print(f"After User CBF {data.augmented_urm.nnz}")

        rec = None

        recs = Parallel(n_jobs=6)(delayed(
            par(data,
                leave_k_out=leave_k_out,
                threshold=threshold,
                probability=probability).split_and_fit)(i) for i in range(k))
        self.hybrid_rec = Hybrid1CXAlphaRecommender(
            data,
            recommenders=recs,
            recommended_users=data.ids_user,
            max_cutoff=self.max_cutoff)
        self.hybrid_rec.weights = np.array([
            np.sqrt(np.array(fib(30)[::-1])).astype(np.int).tolist()
            for _ in range(k)
        ])
 def __init__(self, data: DataObject):
     super(Hybrid003AlphaRecommender, self).__init__(data.urm_train)
     self.data = data
     self.poco_warm_recommender = Hybrid101AlphaRecommender(data)
     self.quasi_warm_recommender = Hybrid102AlphaRecommender(data)
     # self.warm_recommender = ItemKNNCFRecommender(data.urm_train)
     # self.warm_recommender = Hybrid105AlphaRecommender(data)
     self.warm_recommender = RP3betaRecommender(data.urm_train)
     self.warm_7_recommender = ItemKNNCFRecommender(data.urm_train)
     self.warm_8_recommender = Hybrid108AlphaRecommender(data)
     self.warm_9_recommender = Hybrid109AlphaRecommender(data)
     self.cold_recommender = Hybrid100AlphaRecommender(data)
 def __init__(self, data: DataObject):
     super(Hybrid005AlphaRecommender, self).__init__(data.urm_train)
     self.data = data
     self.cold_recommender = Hybrid100AlphaRecommender(data)
     self.cold_recommender.fit()
     # rec1 = RP3betaRecommender(data.urm_train)
     # rec1.fit(topK=20, alpha=0.12, beta=0.24)
     # rec2 = ItemKNNCFRecommender(data.urm_train)
     # rec2.fit(topK=22, shrink=850, similarity='jaccard', feature_weighting='BM25')
     # self.warm_2_recommender = ItemKNNSimilarityHybridRecommender(data.urm_train, rec1.W_sparse, rec2.W_sparse)
     urm = data.urm_train
     urm = sps.vstack([data.urm_train, data.icm_all_augmented.T])
     urm = urm.tocsr()
     self.warm_recommender = MultiThreadSLIM_ElasticNet(data.urm_train)
     self.warm_2_3_recommender = MultiThreadSLIM_ElasticNet(data.urm_train)
     self.warm_1_recommender = Hybrid101AlphaRecommender(data)