org.mymedialite.itemrec
Class Zero

java.lang.Object
  extended by org.mymedialite.itemrec.ItemRecommender
      extended by org.mymedialite.itemrec.Zero
All Implemented Interfaces:
java.lang.Cloneable, IRecommender

public class Zero
extends ItemRecommender

Constant item recommender for use as experimental baseline. Always predicts a score of zero. This recommender can be used for debugging, e.g. to detect non-random orderings in item lists.


Field Summary
 
Fields inherited from class org.mymedialite.itemrec.ItemRecommender
feedback, maxItemID, maxUserID
 
Constructor Summary
Zero()
           
 
Method Summary
 void loadModel(java.io.BufferedReader reader)
           
 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 saveModel(java.io.PrintWriter writer)
           
 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 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
 

Constructor Detail

Zero

public Zero()
Method Detail

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 ItemRecommender

predict

public double predict(int user_id,
                      int item_id)
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 ItemRecommender
Parameters:
user_id - the user ID
item_id - the item ID
Returns:
the predicted score/rating for the given user-item combination

saveModel

public void saveModel(java.lang.String filename)
Description copied from interface: IRecommender
Save the model parameters to a file

Specified by:
saveModel in interface IRecommender
Specified by:
saveModel in class ItemRecommender
Parameters:
filename - the file to write to

saveModel

public void saveModel(java.io.PrintWriter writer)
               throws java.io.IOException
Specified by:
saveModel in class ItemRecommender
Throws:
java.io.IOException

loadModel

public void loadModel(java.lang.String filename)
Description copied from interface: IRecommender
Get the model parameters from a file

Specified by:
loadModel in interface IRecommender
Specified by:
loadModel in class ItemRecommender
Parameters:
filename - the file to read from

loadModel

public void loadModel(java.io.BufferedReader reader)
               throws java.io.IOException
Specified by:
loadModel in class ItemRecommender
Throws:
java.io.IOException