org.mymedialite.itemrec
Class SoftMarginRankingMF

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.BPRMF
                  extended by org.mymedialite.itemrec.SoftMarginRankingMF
All Implemented Interfaces:
java.lang.Cloneable, IIterativeModel, IRecommender, IIncrementalItemRecommender

public class SoftMarginRankingMF
extends BPRMF

Matrix Factorization model for item prediction optimized for a soft margin (hinge) ranking loss, using stochastic gradient descent (as in BPR-MF). Literature: Steffen Rendle: Context-Aware Ranking with Factorization Models. Studies in Computational Intelligence. Springer 2011. http://www.springer.com/engineering/computational+intelligence+and+complexity/book/978-3-642-16897-0 Markus Weimer, Alexandros Karatzoglou, Alex Smola: Improving Maximum Margin Matrix Factorization. Machine Learning Journal 2008. Steffen Rendle, Christoph Freudenthaler, Zeno Gantner, Lars Schmidt-Thieme: BPR: Bayesian Personalized Ranking from Implicit Feedback. UAI 2009. http://www.ismll.uni-hildesheim.de/pub/pdfs/Rendle_et_al2009-Bayesian_Personalized_Ranking.pdf This recommender supports incremental updates.


Field Summary
 
Fields inherited from class org.mymedialite.itemrec.BPRMF
biasReg, boldDriver, fastSampling, fastSamplingMemoryLimit, itemBias, learnRate, random, regI, regJ, regU, uniformUserSampling, updateJ, userNegItems, userPosItems, withReplacement
 
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
SoftMarginRankingMF()
           
 
Method Summary
 double computeLoss()
          Compute approximate loss.
 java.lang.String toString()
          Return a string representation of the recommender
protected  void updateFactors(int u, int i, int j, boolean update_u, boolean update_i, boolean update_j)
          Update latent factors according to the stochastic gradient descent update rule.
 
Methods inherited from class org.mymedialite.itemrec.BPRMF
addFeedback, addItem, addUser, checkSampling, computeFit, createFastSamplingData, initModel, iterate, loadModel, loadModel, predict, removeFeedback, removeItem, removeUser, retrainItem, retrainUser, sampleItemPair, sampleOtherItem, sampleTriple, sampleUser, saveModel, saveModel, train, updateFactors
 
Methods inherited from class org.mymedialite.itemrec.MF
getItemFactors, getNumIter, getUserFactors, setNumIter
 
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
 

Constructor Detail

SoftMarginRankingMF

public SoftMarginRankingMF()
Method Detail

updateFactors

protected void updateFactors(int u,
                             int i,
                             int j,
                             boolean update_u,
                             boolean update_i,
                             boolean update_j)
Update latent factors according to the stochastic gradient descent update rule.

Parameters:
u - the user ID
i - the ID of the first item
j - the ID of the second item
update_u - if true, update the user latent factors
update_i - if true, update the latent factors of the first item
update_j - if true, update the latent factors of the second item

computeLoss

public double computeLoss()
Compute approximate loss.

Specified by:
computeLoss in interface IIterativeModel
Overrides:
computeLoss in class BPRMF
Returns:
the approximate loss

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