org.mymedialite.ratingprediction
Class UserAttributeKNN
java.lang.Object
org.mymedialite.ratingprediction.RatingPredictor
org.mymedialite.ratingprediction.IncrementalRatingPredictor
org.mymedialite.ratingprediction.KNN
org.mymedialite.ratingprediction.UserKNN
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.
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
UserAttributeKNN
public UserAttributeKNN()
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.