|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mymedialite.ratingprediction.RatingPredictor
org.mymedialite.ratingprediction.FactorWiseMatrixFactorization
public class FactorWiseMatrixFactorization
Matrix factorization with factor-wise learning. Similar to the approach described in Simon Funk's seminal blog post: http://sifter.org/~simon/journal/20061211.html Literature: Robert Bell, Yehuda Koren, Chris Volinsky: Modeling Relationships at Multiple Scales to Improve Accuracy of Large Recommender Systems, ACM Int. Conference on Knowledge Discovery and Data Mining (KDD'07), 2007. This recommender does NOT support incremental updates.
Field Summary | |
---|---|
double |
initMean
Mean of the normal distribution used to initialize the factors. |
double |
initStDev
Standard deviation of the normal distribution used to initialize the factors. |
int |
numFactors
Number of latent factors. |
int |
numIter
Number of iterations (in this case: number of latent factors). |
double |
sensibility
Sensibility parameter (stopping criterion for parameter fitting). |
double |
shrinkage
Shrinkage parameter. |
Fields inherited from class org.mymedialite.ratingprediction.RatingPredictor |
---|
maxItemID, maxRating, maxUserID, minRating, ratings |
Constructor Summary | |
---|---|
FactorWiseMatrixFactorization()
Default constructor. |
Method Summary | |
---|---|
double |
computeLoss()
Compute the current loss of the model |
int |
getNumIter()
Get the number of iterations to run the training |
double |
getRegI()
Regularization constant for the item bias of the underlying baseline predictor. |
double |
getRegU()
Regularization constant for the user bias of the underlying baseline predictor. |
void |
iterate()
Run one iteration (= pass over the training data) |
void |
loadModel(java.lang.String filename)
Get the model parameters from a file |
double |
predict(int user_id,
int item_id)
Predict the rating of a given user for a given item. |
void |
saveModel(java.lang.String filename)
Save the model parameters to a file |
void |
setNumIter(int num_iter)
Set the number of iterations to run the training |
void |
setRatings(IRatings ratings)
|
void |
setRegI(double regI)
|
void |
setRegU(double regU)
|
java.lang.String |
toString()
Return a string representation of the recommender |
void |
train()
Learn the model parameters of the recommender from the training data |
Methods inherited from class org.mymedialite.ratingprediction.RatingPredictor |
---|
canPredict, clone, getMaxRating, getMinRating, getRatings, setMaxRating, setMinRating |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public int numFactors
public int numIter
public double shrinkage
public double sensibility
public double initMean
public double initStDev
Constructor Detail |
---|
public FactorWiseMatrixFactorization()
Method Detail |
---|
public void setRatings(IRatings ratings)
setRatings
in class RatingPredictor
public double getRegU()
public void setRegU(double regU)
public double getRegI()
public void setRegI(double regI)
public void setNumIter(int num_iter)
IIterativeModel
setNumIter
in interface IIterativeModel
public int getNumIter()
IIterativeModel
getNumIter
in interface IIterativeModel
public void train()
IRecommender
train
in interface IRecommender
train
in class RatingPredictor
public void iterate()
IIterativeModel
iterate
in interface IIterativeModel
public double predict(int user_id, int item_id)
predict
in interface IRecommender
predict
in class RatingPredictor
user_id
- the user IDitem_id
- the item ID
public void saveModel(java.lang.String filename) throws java.io.IOException
IRecommender
saveModel
in interface IRecommender
saveModel
in class RatingPredictor
filename
- the file to write to
java.io.IOException
public void loadModel(java.lang.String filename) throws java.io.IOException
IRecommender
loadModel
in interface IRecommender
loadModel
in class RatingPredictor
filename
- the file to read from
java.io.IOException
public double computeLoss()
IIterativeModel
computeLoss
in interface IIterativeModel
public java.lang.String toString()
IRecommender
toString
in interface IRecommender
toString
in class RatingPredictor
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |