@ModelData(value={"isRanking","lda","userTopicProbs","topicItemProbs","trainMatrix"}) public class LDARecommender extends ProbabilisticGraphicalRecommender
Remarks: This implementation of LDA is for implicit feedback, where users are regarded as documents
and items as words. To directly apply LDA to explicit ratings, Ian Porteous et al. (AAAI 2008, Section Bi-LDA)
mentioned that, one way is to treat items as documents and ratings as words. We did not provide such an LDA
implementation for explicit ratings. Instead, we provide recommender URP
as an alternative LDA model for
explicit ratings.
Modifier and Type | Field and Description |
---|---|
protected DenseVector |
alpha
vector of hyperparameters for alpha and beta
|
protected DenseVector |
beta
vector of hyperparameters for alpha and beta
|
protected float |
initAlpha
Dirichlet hyper-parameters of user-topic distribution: typical value is 50/K
|
protected float |
initBeta
Dirichlet hyper-parameters of topic-item distribution, typical value is 0.01
|
protected int |
numStats
size of statistics
|
protected int |
numTopics
number of topics
|
protected java.util.List<java.lang.Integer> |
topicAssignments
topic assignment as list from the iterator of trainMatrix
|
protected DenseMatrix |
topicItemNumbers
entry[k, i]: number of tokens assigned to topic k, given item i.
|
protected DenseMatrix |
topicItemProbs
posterior probabilities of parameters
|
protected DenseMatrix |
topicItemProbsSum
cumulative statistics of theta, phi
|
protected DenseVector |
topicTokenNumbers
entry[k]: number of tokens assigned to topic t.
|
protected DenseVector |
userTokenNumbers
entry[u]: number of tokens rated by user u.
|
protected DenseMatrix |
userTopicNumbers
entry[u, k]: number of tokens assigned to topic k, given user u.
|
protected DenseMatrix |
userTopicProbs
posterior probabilities of parameters
|
protected DenseMatrix |
userTopicProbsSum
cumulative statistics of theta, phi
|
burnIn, numItems, numIterations, numUsers, sampleLag
conf, context, decay, earlyStop, globalMean, isBoldDriver, isRanking, itemMappingData, lastLoss, LOG, loss, maxRate, minRate, numRates, ratingScale, recommendedList, testMatrix, topN, trainMatrix, userMappingData, validMatrix, verbose
Constructor and Description |
---|
LDARecommender() |
Modifier and Type | Method and Description |
---|---|
protected void |
eStep()
parameters estimation: used in the training phase
|
protected void |
estimateParams()
estimate the model parameters
|
protected void |
mStep()
update the hyper-parameters
|
protected double |
predict(int userIdx,
int itemIdx)
predict a specific rating for user userIdx on item itemIdx, note that the
prediction is not bounded.
|
protected void |
readoutParams()
Add to the statistics the values of theta and phi for the current state.
|
protected void |
setup()
setup
init member method
|
isConverged, trainModel
cleanup, evaluate, evaluateMap, getContext, getDataModel, getRecommendedList, loadModel, predict, recommend, recommend, recommendRank, recommendRating, saveModel, setContext
protected float initAlpha
protected float initBeta
protected DenseMatrix topicItemNumbers
protected DenseMatrix userTopicNumbers
protected java.util.List<java.lang.Integer> topicAssignments
protected DenseVector userTokenNumbers
protected DenseVector topicTokenNumbers
protected int numTopics
protected DenseVector alpha
protected DenseVector beta
protected DenseMatrix userTopicProbsSum
protected DenseMatrix topicItemProbsSum
protected DenseMatrix userTopicProbs
protected DenseMatrix topicItemProbs
protected int numStats
protected void setup() throws LibrecException
setup
in class ProbabilisticGraphicalRecommender
LibrecException
- if error occursprotected void eStep()
ProbabilisticGraphicalRecommender
eStep
in class ProbabilisticGraphicalRecommender
protected void mStep()
ProbabilisticGraphicalRecommender
mStep
in class ProbabilisticGraphicalRecommender
protected void readoutParams()
readoutParams
in class ProbabilisticGraphicalRecommender
protected void estimateParams()
ProbabilisticGraphicalRecommender
estimateParams
in class ProbabilisticGraphicalRecommender
protected double predict(int userIdx, int itemIdx) throws LibrecException
AbstractRecommender
predict
in class AbstractRecommender
userIdx
- user indexitemIdx
- item indexLibrecException
- if error occurs during predictingCopyright © 2017. All Rights Reserved.