|
|||||||||
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.GlobalAverage
public class GlobalAverage
Uses the average rating value over all ratings for prediction. This recommender does NOT support incremental updates.
Field Summary |
---|
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 | |
---|---|
GlobalAverage()
|
Method Summary | |
---|---|
void |
addRating(int user_id,
int item_id,
double rating)
Add a new rating and perform incremental training |
boolean |
canPredict(int user_id,
int item_id)
Check whether a useful prediction can be made for a given user-item combination. |
void |
loadModel(java.lang.String filename)
Get the model parameters from a file |
double |
predict(int user_id,
int item_id)
Predict the rating or score for a given user-item combination. |
void |
removeRating(int user_id,
int item_id)
Remove an existing rating and perform "incremental" training |
void |
saveModel(java.lang.String filename)
Save the model parameters to a file |
void |
train()
Learn the model parameters of the recommender from the training data |
void |
updateRating(int user_id,
int item_id,
double rating)
Update an existing rating and perform incremental training |
Methods inherited from class org.mymedialite.ratingprediction.IncrementalRatingPredictor |
---|
addItem, addUser, getUpdateItems, getUpdateUsers, removeItem, removeUser, setUpdateItems, setUpdateUsers |
Methods inherited from class org.mymedialite.ratingprediction.RatingPredictor |
---|
clone, getMaxRating, getMinRating, getRatings, setMaxRating, setMinRating, setRatings, toString |
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 |
---|
toString |
Constructor Detail |
---|
public GlobalAverage()
Method Detail |
---|
public void train()
IRecommender
train
in interface IRecommender
train
in class RatingPredictor
public boolean canPredict(int user_id, int item_id)
IRecommender
canPredict
in interface IRecommender
canPredict
in class RatingPredictor
user_id
- the user IDitem_id
- the item ID
public double predict(int user_id, int item_id)
IRecommender
predict
in interface IRecommender
predict
in class RatingPredictor
user_id
- the user IDitem_id
- the item ID
public void addRating(int user_id, int item_id, double rating)
IIncrementalRatingPredictor
addRating
in interface IIncrementalRatingPredictor
addRating
in class IncrementalRatingPredictor
user_id
- the ID of the user who performed the ratingitem_id
- the ID of the rated itemrating
- the rating valuepublic void updateRating(int user_id, int item_id, double rating)
IIncrementalRatingPredictor
updateRating
in interface IIncrementalRatingPredictor
updateRating
in class IncrementalRatingPredictor
user_id
- the ID of the user who performed the ratingitem_id
- the ID of the rated itemrating
- the rating valuepublic void removeRating(int user_id, int item_id)
IIncrementalRatingPredictor
removeRating
in interface IIncrementalRatingPredictor
removeRating
in class IncrementalRatingPredictor
user_id
- the ID of the user who performed the ratingitem_id
- the ID of the rated itempublic 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 |