org.mymedialite
Interface IRecommender

All Superinterfaces:
java.lang.Cloneable
All Known Subinterfaces:
IIncrementalItemRecommender, IIncrementalRatingPredictor, IItemAttributeAwareRecommender, IItemRelationAwareRecommender, IRatingPredictor, ITimeAwareRatingPredictor, IUserAttributeAwareRecommender, IUserRelationAwareRecommender
All Known Implementing Classes:
BiasedMatrixFactorization, BiPolarSlopeOne, BPRLinear, BPRMF, CoClustering, Constant, Ensemble, EntityAverage, FactorWiseMatrixFactorization, GlobalAverage, IncrementalItemRecommender, IncrementalRatingPredictor, ItemAttributeKNN, ItemAttributeKNN, ItemAverage, ItemKNN, ItemKNN, ItemKNNCosine, ItemKNNPearson, ItemRecommender, KNN, KNN, LogisticRegressionMatrixFactorization, MatrixFactorization, MF, MostPopular, Perfect, Random, Random, RatingPredictor, SlopeOne, SocialMF, SoftMarginRankingMF, TimeAwareBaseline, TimeAwareBaselineWithFrequencies, TimeAwareRatingPredictor, UserAttributeKNN, UserAttributeKNN, UserAverage, UserItemBaseline, UserKNN, UserKNN, UserKNNCosine, UserKNNPearson, WeightedBPRMF, WeightedEnsemble, WeightedItemAttributeKNN, WeightedItemHierarchicalAttributeKNN, WeightedItemKNN, WeightedUserKNN, Worst, WRMF, Zero

public interface IRecommender
extends java.lang.Cloneable

Generic interface for simple recommenders.


Method Summary
 boolean canPredict(int userId, int itemId)
          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 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
 java.lang.String toString()
          Return a string representation of the recommender
 void train()
          Learn the model parameters of the recommender from the training data
 

Method Detail

predict

double predict(int userId,
               int itemId)
Predict the rating or score for a given user-item combination.

Parameters:
userId - the user ID
itemId - the item ID
Returns:
the predicted score/rating for the given user-item combination

canPredict

boolean canPredict(int userId,
                   int itemId)
Check whether a useful prediction can be made for a given user-item combination.

Parameters:
userId - the user ID
itemId - the item ID
Returns:
true if a useful prediction can be made, false otherwise

train

void train()
Learn the model parameters of the recommender from the training data


saveModel

void saveModel(java.lang.String filename)
               throws java.io.IOException
Save the model parameters to a file

Parameters:
filename - the file to write to
Throws:
java.io.IOException

loadModel

void loadModel(java.lang.String filename)
               throws java.io.IOException
Get the model parameters from a file

Parameters:
filename - the file to read from
Throws:
java.io.IOException

toString

java.lang.String toString()
Return a string representation of the recommender

Overrides:
toString in class java.lang.Object
Returns:
the class name and all hyperparameters, separated by space characters.