org.mymedialite.ratingprediction
Class UserAttributeKNN

java.lang.Object
  extended by org.mymedialite.ratingprediction.RatingPredictor
      extended by org.mymedialite.ratingprediction.IncrementalRatingPredictor
          extended by org.mymedialite.ratingprediction.KNN
              extended by org.mymedialite.ratingprediction.UserKNN
                  extended by org.mymedialite.ratingprediction.UserAttributeKNN
All Implemented Interfaces:
java.lang.Cloneable, IRecommender, IUserAttributeAwareRecommender, IUserSimilarityProvider, IIncrementalRatingPredictor, IRatingPredictor

public class UserAttributeKNN
extends UserKNN
implements IUserAttributeAwareRecommender

Weighted kNN recommender based on user attributes. This recommender does NOT support incremental updates.


Field Summary
 
Fields inherited from class org.mymedialite.ratingprediction.UserKNN
data_user
 
Fields inherited from class org.mymedialite.ratingprediction.KNN
baseline_predictor, correlation, k
 
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
UserAttributeKNN()
           
 
Method Summary
 SparseBooleanMatrix getUserAttributes()
          Getter for binary user attributes
 int numUserAttributes()
          Getter for number of binary user attributes
protected  void retrainUser(int user_id)
          Retrain model for a given user.
 void setUserAttributes(SparseBooleanMatrix matrix)
          Setter for binary user attributes
 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.UserKNN
addRating, addUser, getMostSimilarUsers, getUserSimilarity, predict, removeRating, setRatings, updateRating
 
Methods inherited from class org.mymedialite.ratingprediction.KNN
getRegI, getRegU, loadModel, saveModel, setRegI, setRegU
 
Methods inherited from class org.mymedialite.ratingprediction.IncrementalRatingPredictor
addItem, getUpdateItems, getUpdateUsers, removeItem, removeUser, setUpdateItems, setUpdateUsers
 
Methods inherited from class org.mymedialite.ratingprediction.RatingPredictor
canPredict, clone, getMaxRating, getMinRating, getRatings, setMaxRating, setMinRating
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mymedialite.IRecommender
canPredict, loadModel, predict, saveModel
 
Methods inherited from interface org.mymedialite.ratingprediction.IRatingPredictor
getMaxRating, getMinRating, setMaxRating, setMinRating
 

Constructor Detail

UserAttributeKNN

public UserAttributeKNN()
Method Detail

getUserAttributes

public SparseBooleanMatrix getUserAttributes()
Description copied from interface: IUserAttributeAwareRecommender
Getter for binary user attributes

Specified by:
getUserAttributes in interface IUserAttributeAwareRecommender

setUserAttributes

public void setUserAttributes(SparseBooleanMatrix matrix)
Description copied from interface: IUserAttributeAwareRecommender
Setter for binary user attributes

Specified by:
setUserAttributes in interface IUserAttributeAwareRecommender

numUserAttributes

public int numUserAttributes()
Description copied from interface: IUserAttributeAwareRecommender
Getter for number of binary user attributes

Specified by:
numUserAttributes in interface IUserAttributeAwareRecommender

retrainUser

protected void retrainUser(int user_id)
Description copied from class: UserKNN
Retrain model for a given user.

Specified by:
retrainUser in class UserKNN
Parameters:
user_id - the user ID

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

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.