org.mymedialite.itemrec
Class WRMF

java.lang.Object
  extended by org.mymedialite.itemrec.ItemRecommender
      extended by org.mymedialite.itemrec.IncrementalItemRecommender
          extended by org.mymedialite.itemrec.MF
              extended by org.mymedialite.itemrec.WRMF
All Implemented Interfaces:
java.lang.Cloneable, IIterativeModel, IRecommender, IIncrementalItemRecommender

public class WRMF
extends MF

Weighted matrix factorization method proposed by Hu et al. and Pan et al.. We use the fast learning method proposed by Hu et al. (alternating least squares), and we use a global weight to penalize observed/unobserved values. Literature: Y. Hu, Y. Koren, C. Volinsky: Collaborative filtering for implicit feedback datasets. ICDM 2008. http://research.yahoo.net/files/HuKorenVolinsky-ICDM08.pdf R. Pan, Y. Zhou, B. Cao, N. N. Liu, R. M. Lukose, M. Scholz, Q. Yang: One-class collaborative filtering, ICDM 2008. http://www.hpl.hp.com/techreports/2008/HPL-2008-48R1.pdf This recommender does NOT support incremental updates.


Field Summary
 double cPos
          C position: the weight/confidence that is put on positive observations.
 double regularization
          Regularization parameter.
 
Fields inherited from class org.mymedialite.itemrec.MF
initMean, initStDev, itemFactors, numFactors, numIter, userFactors
 
Fields inherited from class org.mymedialite.itemrec.ItemRecommender
feedback, maxItemID, maxUserID
 
Constructor Summary
WRMF()
           
 
Method Summary
 double computeLoss()
          Computes the fit (optimization criterion) on the training data
 void iterate()
          Iterate once over the data
protected  void optimize(IBooleanMatrix data, Matrix<java.lang.Double> W, Matrix<java.lang.Double> H)
          Optimizes the specified data.
 java.lang.String toString()
          Return a string representation of the recommender
 
Methods inherited from class org.mymedialite.itemrec.MF
getItemFactors, getNumIter, getUserFactors, initModel, loadModel, loadModel, predict, saveModel, saveModel, setNumIter, train
 
Methods inherited from class org.mymedialite.itemrec.IncrementalItemRecommender
addFeedback, addItem, addUser, removeFeedback, removeItem, removeUser
 
Methods inherited from class org.mymedialite.itemrec.ItemRecommender
canPredict, clone, getFeedback, setFeedback
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mymedialite.IRecommender
canPredict
 

Field Detail

cPos

public double cPos
C position: the weight/confidence that is put on positive observations. The alpha value in Hu et al.


regularization

public double regularization
Regularization parameter.

Constructor Detail

WRMF

public WRMF()
Method Detail

iterate

public void iterate()
Description copied from class: MF
Iterate once over the data

Specified by:
iterate in interface IIterativeModel
Specified by:
iterate in class MF

optimize

protected void optimize(IBooleanMatrix data,
                        Matrix<java.lang.Double> W,
                        Matrix<java.lang.Double> H)
Optimizes the specified data.

Parameters:
data - data
W - W
H - H

computeLoss

public double computeLoss()
Description copied from class: MF
Computes the fit (optimization criterion) on the training data

Specified by:
computeLoss in interface IIterativeModel
Specified by:
computeLoss in class MF
Returns:
a double representing the fit, lower is better

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 ItemRecommender
Returns:
the class name and all hyperparameters, separated by space characters.