org.mymedialite.ratingprediction
Class ItemAttributeKNN

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.ItemKNN
                  extended by org.mymedialite.ratingprediction.ItemAttributeKNN
All Implemented Interfaces:
java.lang.Cloneable, IItemAttributeAwareRecommender, IItemSimilarityProvider, IRecommender, IIncrementalRatingPredictor, IRatingPredictor

public class ItemAttributeKNN
extends ItemKNN
implements IItemAttributeAwareRecommender

Attribute-aware weighted item-based kNN recommender. This recommender does NOT support incremental updates.


Field Summary
 
Fields inherited from class org.mymedialite.ratingprediction.ItemKNN
data_item, memoizer
 
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
ItemAttributeKNN()
           
 
Method Summary
 SparseBooleanMatrix getItemAttributes()
          Getter for binary item attributes
 int numItemAttributes()
          Getter for number of binary item attributes
protected  void retrainItem(int item_id)
          Retrain model for a given item.
 void setItemAttributes(SparseBooleanMatrix matrix)
          Setter for binary item 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.ItemKNN
addItem, addRating, getItemSimilarity, getMostSimilarItems, 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
addUser, 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

ItemAttributeKNN

public ItemAttributeKNN()
Method Detail

getItemAttributes

public SparseBooleanMatrix getItemAttributes()
Description copied from interface: IItemAttributeAwareRecommender
Getter for binary item attributes

Specified by:
getItemAttributes in interface IItemAttributeAwareRecommender

setItemAttributes

public void setItemAttributes(SparseBooleanMatrix matrix)
Description copied from interface: IItemAttributeAwareRecommender
Setter for binary item attributes

Specified by:
setItemAttributes in interface IItemAttributeAwareRecommender

retrainItem

protected void retrainItem(int item_id)
Description copied from class: ItemKNN
Retrain model for a given item.

Specified by:
retrainItem in class ItemKNN
Parameters:
item_id - the item ID

numItemAttributes

public int numItemAttributes()
Description copied from interface: IItemAttributeAwareRecommender
Getter for number of binary item attributes

Specified by:
numItemAttributes in interface IItemAttributeAwareRecommender

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.