|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mymedialite.itemrec.ItemRecommender
org.mymedialite.itemrec.IncrementalItemRecommender
org.mymedialite.itemrec.MF
public abstract class MF
Abstract class for Matrix Factorization based item predictors.
Field Summary | |
---|---|
double |
initMean
Mean of the normal distribution used to initialize the latent factors |
double |
initStDev
Standard deviation of the normal distribution used to initialize the latent factors |
protected Matrix<java.lang.Double> |
itemFactors
Latent item factor matrix |
int |
numFactors
Number of latent factors per user/item |
int |
numIter
Number of iterations over the training data |
protected Matrix<java.lang.Double> |
userFactors
Latent user factor matrix |
Fields inherited from class org.mymedialite.itemrec.ItemRecommender |
---|
feedback, maxItemID, maxUserID |
Constructor Summary | |
---|---|
MF()
|
Method Summary | |
---|---|
abstract double |
computeLoss()
Computes the fit (optimization criterion) on the training data |
Matrix<java.lang.Double> |
getItemFactors()
Get the latent item factor matrix |
int |
getNumIter()
{ @inheritDoc } |
Matrix<java.lang.Double> |
getUserFactors()
Get the latent user factor matrix |
protected void |
initModel()
|
abstract void |
iterate()
Iterate once over the data |
void |
loadModel(java.io.BufferedReader reader)
{ @inheritDoc } |
void |
loadModel(java.lang.String filename)
{ @inheritDoc } |
double |
predict(int user_id,
int item_id)
Predict the weight for a given user-item combination. |
void |
saveModel(java.io.PrintWriter writer)
{ @inheritDoc } |
void |
saveModel(java.lang.String filename)
{ @inheritDoc } |
void |
setNumIter(int num_iter)
{ @inheritDoc } |
void |
train()
{ @inheritDoc } |
Methods inherited from class org.mymedialite.itemrec.IncrementalItemRecommender |
---|
addFeedback, addItem, addUser, removeFeedback, removeItem, removeUser |
Methods inherited from class org.mymedialite.itemrec.ItemRecommender |
---|
canPredict, clone, getFeedback, setFeedback, toString |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.mymedialite.IRecommender |
---|
canPredict, toString |
Field Detail |
---|
protected Matrix<java.lang.Double> userFactors
protected Matrix<java.lang.Double> itemFactors
public double initMean
public double initStDev
public int numFactors
public int numIter
Constructor Detail |
---|
public MF()
Method Detail |
---|
public Matrix<java.lang.Double> getUserFactors()
public Matrix<java.lang.Double> getItemFactors()
public int getNumIter()
getNumIter
in interface IIterativeModel
public void setNumIter(int num_iter)
setNumIter
in interface IIterativeModel
protected void initModel()
public void train()
train
in interface IRecommender
train
in class ItemRecommender
public abstract void iterate()
iterate
in interface IIterativeModel
public abstract double computeLoss()
computeLoss
in interface IIterativeModel
public double predict(int user_id, int item_id)
predict
in interface IRecommender
predict
in class ItemRecommender
user_id
- the user IDitem_id
- the item ID
public void saveModel(java.lang.String filename) throws java.io.IOException
saveModel
in interface IRecommender
saveModel
in class ItemRecommender
filename
- the file to write to
java.io.IOException
public void saveModel(java.io.PrintWriter writer)
saveModel
in class ItemRecommender
public void loadModel(java.lang.String filename) throws java.io.IOException
loadModel
in interface IRecommender
loadModel
in class ItemRecommender
filename
- the file to read from
java.io.IOException
public void loadModel(java.io.BufferedReader reader) throws java.io.IOException
loadModel
in class ItemRecommender
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |