|
|||||||||
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.IncrementalRatingPredictor
org.mymedialite.ratingprediction.KNN
public abstract class KNN
Base class for rating predictors that use some kind of kNN. The method is described in section 2.2 of the paper below. One difference is that we support several iterations of alternating optimization, instead of just one. Literature: Yehuda Koren: Factor in the Neighbors: Scalable and Accurate Collaborative Filtering, Transactions on Knowledge Discovery from Data (TKDD), 2009. http://public.research.att.com/~volinsky/netflix/factorizedNeighborhood.pdf This recommender supports incremental updates. See also org.mymedialite.itemrec.KNN
Field Summary | |
---|---|
protected UserItemBaseline |
baseline_predictor
|
protected CorrelationMatrix |
correlation
Correlation matrix over some kind of entity. |
int |
k
Number of neighbors to take into account for predictions. |
Fields inherited from class org.mymedialite.ratingprediction.IncrementalRatingPredictor |
---|
updateItems, updateUsers |
Fields inherited from class org.mymedialite.ratingprediction.RatingPredictor |
---|
maxItemID, maxRating, maxUserID, minRating, ratings |
Constructor Summary | |
---|---|
KNN()
Default constructor |
Method Summary | |
---|---|
double |
getRegI()
Get the regularization constant for the user bias of the underlying baseline predictor |
double |
getRegU()
Get the regularization constant for the user bias of the underlying baseline predictor. |
void |
loadModel(java.lang.String filename)
Get the model parameters from a file |
void |
saveModel(java.lang.String filename)
Save the model parameters to a file |
void |
setRatings(IRatings ratings)
|
void |
setRegI(double regI)
Set the regularization constant for the item bias of the underlying baseline predictor. |
void |
setRegU(double regU)
Set the regularization constant for the user bias of the underlying baseline predictor. |
Methods inherited from class org.mymedialite.ratingprediction.IncrementalRatingPredictor |
---|
addItem, addRating, addUser, getUpdateItems, getUpdateUsers, removeItem, removeRating, removeUser, setUpdateItems, setUpdateUsers, updateRating |
Methods inherited from class org.mymedialite.ratingprediction.RatingPredictor |
---|
canPredict, clone, getMaxRating, getMinRating, getRatings, predict, setMaxRating, setMinRating, toString, train |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.mymedialite.ratingprediction.IRatingPredictor |
---|
getMaxRating, getMinRating, setMaxRating, setMinRating |
Methods inherited from interface org.mymedialite.IRecommender |
---|
canPredict, predict, toString, train |
Field Detail |
---|
protected UserItemBaseline baseline_predictor
public int k
protected CorrelationMatrix correlation
Constructor Detail |
---|
public KNN()
Method Detail |
---|
public void setRatings(IRatings ratings)
setRatings
in class RatingPredictor
public double getRegU()
public void setRegU(double regU)
regU
- the regularization parameterpublic double getRegI()
public void setRegI(double regI)
regI
- the regularization parameterpublic 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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |