guoguibing / librec

LibRec: A Leading Java Library for Recommender Systems, see
https://www.librec.net/
Other
3.23k stars 1.03k forks source link

ItemClusterRecommender.predict #272

Open yang53 opened 6 years ago

yang53 commented 6 years ago

在 ItemClusterRecommender.predict函数中 protected double predict(int userIdx, int itemIdx) throws LibrecException { double pred = 0;

    for (int k = 0; k < numTopics; k++) {
        double pi_k = itemTopicProbs.get(itemIdx, k); // probability that user u belongs to cluster k
        double pred_k = 0;

        for (int r = 0; r < numRatingLevels; r++) {
            double rij = ratingScale.get(r);
            double pkr = topicRatingProbs.get(k, r);

            pred_k += rij * pkr;
        }

        pred += pi_k * pred_k;
    }

    return pred;
}

注释部分 // probability that user u belongs to cluster k 是不是写错了,应该为 // probability that item i belongs to cluster ki

SunYatong commented 6 years ago

感谢提醒,已修复