public class HFTRecommender extends TensorRecommender
| Modifier and Type | Field and Description |
|---|---|
protected float |
initMean
init mean
|
protected float |
initStd
init standard deviation
|
protected DenseVector |
itemBiases
user biases
|
protected DenseMatrix |
itemFactors
item latent factors
|
protected int |
K |
protected int |
numberOfWords |
protected double[][] |
phiks |
protected double |
regBias
bias regularization
|
protected float |
regItem
item regularization
|
protected float |
regUser
user regularization
|
com.google.common.collect.BiMap<java.lang.String,java.lang.Integer> |
reviewMappingData |
protected SparseStringMatrix |
reviewMatrix |
protected Randoms |
rn |
protected StringUtil |
str |
protected double[][] |
thetaus |
protected SparseStringMatrix |
topicAssignment |
protected DenseMatrix |
topicToWord |
protected SparseMatrix |
trainMatrix |
protected DenseVector |
userBiases
user biases
|
protected DenseMatrix |
userFactors
user latent factors
|
allFeaturesMappingData, conf, context, decay, dimensions, earlyStop, globalMean, isBoldDriver, isRanking, itemDimension, itemMappingData, lastLoss, learnRate, LOG, loss, maxLearnRate, maxRate, minRate, numDimensions, numFactors, numItems, numIterations, numUsers, recommendedList, reg, testTensor, topN, trainTensor, userDimension, userMappingData, validTensor, verbose| Constructor and Description |
|---|
HFTRecommender() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
calculatePhis() |
protected void |
calculateThetas() |
java.util.Map<Measure.MeasureValue,java.lang.Double> |
evaluateMap()
evaluate Map
|
java.util.List<RecommendedItem> |
getRecommendedList()
get Recommended List
|
protected double |
predict(int[] indices)
predict a specific rating for user userIdx on item itemIdx with some other contexts indices, note that the
prediction is not bounded.
|
protected double |
predict(int u,
int j) |
protected java.lang.String |
sampleTopicsToWords(java.lang.String[] wordsList,
int u) |
protected void |
sampleZ() |
protected void |
setup()
setup
|
protected void |
trainModel()
The training approach is SGD instead of L-BFGS, so it can be slow if the dataset
is big.
|
protected double[] |
updateArray(double[] oldValues,
double[] newValues)
Update function for thetas and phiks, check if softmax comes in to NaN
and update the parameters.
|
cleanup, evaluate, getDataModel, isConverged, loadModel, predict, recommend, recommend, recommendRank, recommendRating, saveModel, setContext, updateLRateprotected SparseMatrix trainMatrix
protected SparseStringMatrix reviewMatrix
protected DenseMatrix topicToWord
protected SparseStringMatrix topicAssignment
protected int K
protected int numberOfWords
protected DenseVector userBiases
protected DenseVector itemBiases
protected DenseMatrix userFactors
protected DenseMatrix itemFactors
protected float initMean
protected float initStd
protected double regBias
protected float regUser
protected float regItem
public com.google.common.collect.BiMap<java.lang.String,java.lang.Integer> reviewMappingData
protected StringUtil str
protected Randoms rn
protected double[][] thetaus
protected double[][] phiks
protected void setup()
throws LibrecException
TensorRecommendersetup in class TensorRecommenderLibrecException - if error occurs during setting upprotected void sampleZ()
throws java.lang.Exception
java.lang.Exceptionprotected double[] updateArray(double[] oldValues,
double[] newValues)
throws java.lang.Exception
oldValues - old values of the parameternewValues - new values to update the parameterjava.lang.Exception - if error occursprotected void calculateThetas()
protected void calculatePhis()
protected java.lang.String sampleTopicsToWords(java.lang.String[] wordsList,
int u)
throws java.lang.Exception
java.lang.Exceptionprotected void trainModel()
trainModel in class TensorRecommenderprotected double predict(int[] indices)
TensorRecommenderpredict in class TensorRecommenderindices - user index, item index and context indicesprotected double predict(int u,
int j)
public java.util.Map<Measure.MeasureValue,java.lang.Double> evaluateMap() throws LibrecException
RecommenderevaluateMap in interface RecommenderevaluateMap in class TensorRecommenderLibrecException - if error occurs during constructing evaluate mappublic java.util.List<RecommendedItem> getRecommendedList()
RecommendergetRecommendedList in interface RecommendergetRecommendedList in class TensorRecommenderCopyright © 2017. All Rights Reserved.