org.mymedialite.ratingprediction
Class RandomRatingPredictor
java.lang.Object
org.mymedialite.ratingprediction.RatingPredictor
org.mymedialite.ratingprediction.RandomRatingPredictor
- All Implemented Interfaces:
- java.lang.Cloneable, IRecommender, IRatingPredictor
public class RandomRatingPredictor
- extends RatingPredictor
A Rating Predictor which returns random prediction values uniformly distributed between 0.0 and 1.0.
For use as experimental baseline.
Method Summary |
void |
loadModel(java.lang.String filename)
Get the model parameters from a file |
double |
predict(int userId,
int itemId)
Predict the rating or score for a given user-item combination. |
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 |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
RandomRatingPredictor
public RandomRatingPredictor()
predict
public double predict(int userId,
int itemId)
- Description copied from interface:
IRecommender
- Predict the rating or score for a given user-item combination.
- Specified by:
predict
in interface IRecommender
- Specified by:
predict
in class RatingPredictor
- Parameters:
userId
- the user IDitemId
- the item ID
- Returns:
- the predicted score/rating for the given user-item combination
train
public void train()
- Description copied from interface:
IRecommender
- Learn the model parameters of the recommender from the training data
- Specified by:
train
in interface IRecommender
- Specified by:
train
in class RatingPredictor
loadModel
public void loadModel(java.lang.String filename)
throws java.io.IOException
- Description copied from interface:
IRecommender
- Get the model parameters from a file
- Specified by:
loadModel
in interface IRecommender
- Specified by:
loadModel
in class RatingPredictor
- Parameters:
filename
- the file to read from
- Throws:
java.io.IOException
saveModel
public void saveModel(java.lang.String filename)
throws java.io.IOException
- Description copied from interface:
IRecommender
- Save the model parameters to a file
- Specified by:
saveModel
in interface IRecommender
- Specified by:
saveModel
in class RatingPredictor
- Parameters:
filename
- the file to write to
- Throws:
java.io.IOException