Package moa.recommender.predictor
Class BRISMFPredictor
- java.lang.Object
-
- moa.AbstractMOAObject
-
- moa.options.AbstractOptionHandler
-
- moa.recommender.predictor.BRISMFPredictor
-
- All Implemented Interfaces:
Configurable
,Serializable
,MOAObject
,OptionHandler
,RatingPredictor
public class BRISMFPredictor extends AbstractOptionHandler implements RatingPredictor
Implementation of the algorithm described in Scalable Collaborative Filtering Approaches for Large Recommender Systems (Gábor Takács, István Pilászy, Bottyán Németh, and Domonkos Tikk). A feature vector is learned for every user and item, so that the prediction of a rating is roughly the dot product of the corresponding user and item vector. Stochastic gradient descent is used to train the model, minimizing its prediction error. Both Tikhonov regularization and early stopping are used to reduce overfitting. The algorithm allows batch training (from scratch, using all ratings available at the moment) as well as incremental, by retraining only the affected user and item vectors when a new rating is inserted.Parameters:
- f: features - the number of features to be trained for each user and item
- r: learning rate - the learning rate used in the regularization
- a: ratio - the regularization ratio to be used in the Tikhonov regularization
- i: iterations - the number of iterations to be used when retraining user and item features (online training).
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description ClassOption
dataOption
IntOption
featuresOption
IntOption
iterationsOption
FloatOption
lRateOption
FloatOption
rFactorOption
protected BRISMFPredictor
rp
-
Fields inherited from class moa.options.AbstractOptionHandler
config
-
-
Constructor Summary
Constructors Constructor Description BRISMFPredictor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RecommenderData
getData()
void
getDescription(StringBuilder sb, int indent)
Returns a string representation of this object.double
predictRating(int userID, int itemID)
double
predictRating(Integer user, Integer item)
List<Double>
predictRatings(int userID, List<Integer> itemIDS)
protected void
prepareForUseImpl(TaskMonitor monitor, ObjectRepository repository)
This method describes the implementation of how to prepare this object for use.void
train()
-
Methods inherited from class moa.options.AbstractOptionHandler
copy, getCLICreationString, getOptions, getPreparedClassOption, getPurposeString, prepareClassOptions, prepareForUse, prepareForUse
-
Methods inherited from class moa.AbstractMOAObject
copy, measureByteSize, measureByteSize, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface moa.MOAObject
measureByteSize
-
-
-
-
Field Detail
-
rp
protected BRISMFPredictor rp
-
featuresOption
public IntOption featuresOption
-
lRateOption
public FloatOption lRateOption
-
rFactorOption
public FloatOption rFactorOption
-
iterationsOption
public IntOption iterationsOption
-
dataOption
public ClassOption dataOption
-
-
Method Detail
-
prepareForUseImpl
protected void prepareForUseImpl(TaskMonitor monitor, ObjectRepository repository)
Description copied from class:AbstractOptionHandler
This method describes the implementation of how to prepare this object for use. All classes that extends this class have to implementprepareForUseImpl
and notprepareForUse
sinceprepareForUse
callsprepareForUseImpl
.- Specified by:
prepareForUseImpl
in classAbstractOptionHandler
- Parameters:
monitor
- the TaskMonitor to userepository
- the ObjectRepository to use
-
getDescription
public void getDescription(StringBuilder sb, int indent)
Description copied from interface:MOAObject
Returns a string representation of this object. Used inAbstractMOAObject.toString
to give a string representation of the object.- Specified by:
getDescription
in interfaceMOAObject
- Parameters:
sb
- the stringbuilder to add the descriptionindent
- the number of characters to indent
-
getData
public RecommenderData getData()
- Specified by:
getData
in interfaceRatingPredictor
-
predictRating
public double predictRating(int userID, int itemID)
- Specified by:
predictRating
in interfaceRatingPredictor
-
predictRatings
public List<Double> predictRatings(int userID, List<Integer> itemIDS)
- Specified by:
predictRatings
in interfaceRatingPredictor
-
train
public void train()
- Specified by:
train
in interfaceRatingPredictor
-
-