org.mymedialite.ratingprediction
Class CoClustering

java.lang.Object
  extended by org.mymedialite.ratingprediction.RatingPredictor
      extended by org.mymedialite.ratingprediction.CoClustering
All Implemented Interfaces:
java.lang.Cloneable, IIterativeModel, IRecommender, IRatingPredictor

public class CoClustering
extends RatingPredictor
implements IIterativeModel

Co-clustering for rating prediction. Literature: Thomas George, Srujana Merugu A Scalable Collaborative Filtering Framework based on Co-clustering. ICDM 2005. http://hercules.ece.utexas.edu/~srujana/papers/icdm05.pdf This recommender does NOT support incremental updates.


Field Summary
 int numItemClusters
          The number of item clusters.
 int numIter
          The maximum number of iterations.
 int numUserClusters
          The number of user clusters.
 
Fields inherited from class org.mymedialite.ratingprediction.RatingPredictor
maxItemID, maxRating, maxUserID, minRating, ratings
 
Constructor Summary
CoClustering()
          Default constructor.
 
Method Summary
 double computeLoss()
          Compute the current loss of the model
 int getNumIter()
          Get the number of iterations to run the training
 void initModel()
           
 void iterate()
          Run one iteration (= pass over the training data)
 void loadModel(java.lang.String filename)
          Get the model parameters from a file
 double predict(int u, int i)
          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 setNumIter(int numIter)
          Set the number of iterations to run the training
 java.lang.String toString()
          Return a string representation of the recommender
 void train()
          Learn the model parameters of the recommender from the training data
 
Methods inherited from class org.mymedialite.ratingprediction.RatingPredictor
canPredict, clone, getMaxRating, getMinRating, getRatings, setMaxRating, setMinRating, setRatings
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

numUserClusters

public int numUserClusters
The number of user clusters.


numItemClusters

public int numItemClusters
The number of item clusters.


numIter

public int numIter
The maximum number of iterations. If the algorithm converges to a stable solution, it will terminate earlier.

Constructor Detail

CoClustering

public CoClustering()
Default constructor.

Method Detail

setNumIter

public void setNumIter(int numIter)
Description copied from interface: IIterativeModel
Set the number of iterations to run the training

Specified by:
setNumIter in interface IIterativeModel

getNumIter

public int getNumIter()
Description copied from interface: IIterativeModel
Get the number of iterations to run the training

Specified by:
getNumIter in interface IIterativeModel

initModel

public void initModel()

iterate

public void iterate()
Description copied from interface: IIterativeModel
Run one iteration (= pass over the training data)

Specified by:
iterate in interface IIterativeModel

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

predict

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

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

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

computeLoss

public double computeLoss()
Description copied from interface: IIterativeModel
Compute the current loss of the model

Specified by:
computeLoss in interface IIterativeModel
Returns:
the current loss; -1 if not implemented

toString

public java.lang.String toString()
Description copied from interface: IRecommender
Return a string representation of the recommender

Specified by:
toString in interface IRecommender
Overrides:
toString in class RatingPredictor
Returns:
the class name and all hyperparameters, separated by space characters.