public abstract class FactorizationMachineRecommender extends AbstractRecommender
Modifier and Type | Field and Description |
---|---|
protected int |
k
number of factors
|
protected org.apache.commons.logging.Log |
LOG
LOG
|
protected int |
n
number of ratings
|
protected int |
numFactors
the number of latent factors
|
protected int |
numIterations
the number of iterations
|
protected int |
p
appender vector size: number of users + number of items + number of contextual conditions
|
protected DenseMatrix |
Q
parameter matrix
|
protected float |
regF
regularization term for weight and factors
|
protected float |
regW
regularization term for weight and factors
|
protected float |
regW0
regularization term for weight and factors
|
protected SparseTensor |
testTensor
testTensor
|
protected SparseTensor |
trainTensor
train Tensor
|
protected DenseMatrix |
V
parameter matrix
|
protected SparseTensor |
validTensor
validTensor
|
protected DenseVector |
W
weight vector
|
protected double |
w0
global bias
|
conf, context, decay, earlyStop, globalMean, isBoldDriver, isRanking, itemMappingData, lastLoss, loss, maxRate, minRate, numItems, numRates, numUsers, ratingScale, recommendedList, testMatrix, topN, trainMatrix, userMappingData, validMatrix, verbose
Constructor and Description |
---|
FactorizationMachineRecommender() |
Modifier and Type | Method and Description |
---|---|
protected double |
predict(int userId,
int itemId,
SparseVector x)
Predict the rating given a sparse appender vector.
|
protected double |
predict(int userId,
int itemId,
SparseVector x,
boolean bound)
Predict the rating given a sparse appender vector.
|
protected RecommendedList |
recommendRating()
recommend
* predict the ratings in the test data
|
protected void |
setup()
setup
|
protected SparseVector |
tenserKeysToFeatureVector(int[] tenserKeys)
Transform the keys of a tensor entry into a sparse vector.
|
cleanup, evaluate, evaluateMap, getContext, getDataModel, getRecommendedList, isConverged, loadModel, predict, predict, recommend, recommend, recommendRank, saveModel, setContext, trainModel
protected final org.apache.commons.logging.Log LOG
protected SparseTensor trainTensor
protected SparseTensor testTensor
protected SparseTensor validTensor
protected double w0
protected int p
protected int k
protected int n
protected DenseVector W
protected DenseMatrix V
protected DenseMatrix Q
protected float regW0
protected float regW
protected float regF
protected int numFactors
protected int numIterations
protected void setup() throws LibrecException
setup
in class AbstractRecommender
LibrecException
- if error occursprotected double predict(int userId, int itemId, SparseVector x) throws LibrecException
userId
- user IditemId
- item Idx
- the given vector to predict.LibrecException
- if error occursprotected double predict(int userId, int itemId, SparseVector x, boolean bound) throws LibrecException
bound
is true,The predicted rating value will be
bounded in [minRate, maxRate]
x
- the given vectoruserId
- the user iditemId
- the item idbound
- whether to bound the predicted ratingLibrecException
- if error occursprotected RecommendedList recommendRating() throws LibrecException
recommendRating
in class AbstractRecommender
LibrecException
- if error occursprotected SparseVector tenserKeysToFeatureVector(int[] tenserKeys)
tenserKeys
- the given keys of a tensor entryCopyright © 2017. All Rights Reserved.