在 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
在 ItemClusterRecommender.predict函数中 protected double predict(int userIdx, int itemIdx) throws LibrecException { double pred = 0;
注释部分 // probability that user u belongs to cluster k 是不是写错了,应该为 // probability that item i belongs to cluster ki