prea.recommender.matrix
Class NMF

java.lang.Object
  extended by prea.recommender.matrix.MatrixFactorizationRecommender
      extended by prea.recommender.matrix.NMF
All Implemented Interfaces:
Recommender

public class NMF
extends MatrixFactorizationRecommender

This is a class implementing Non-negative Matrix Factorization. Technical detail of the algorithm can be found in Daniel D. Lee and H. Sebastian Seung, Algorithms for Non-negative Matrix Factorization, Advances in Neural Information Processing Systems, 2001.

Since:
2012. 4. 20
Version:
1.1
Author:
Joonseok Lee

Field Summary
private  SparseMatrix validationMatrix
          Rating matrix for items which will be used during the validation phase.
private  double validationRatio
          Proportion of dataset, using for validation purpose.
 
Fields inherited from class prea.recommender.matrix.MatrixFactorizationRecommender
featureCount, itemCount, itemFeatures, learningRate, maxIter, maxValue, minValue, momentum, offset, regularizer, showProgress, userCount, userFeatures
 
Constructor Summary
NMF(int uc, int ic, double max, double min, int fc, double lr, double r, double m, int iter, double vr, boolean verbose)
          Construct a matrix-factorization model with the given data.
 
Method Summary
 void buildModel(SparseMatrix rateMatrix)
          Build a model with given training set.
private  void makeValidationSet(SparseMatrix rateMatrix, double validationRatio)
          Items which will be used for validation purpose are moved from rateMatrix to validationMatrix.
private  void restoreValidationSet(SparseMatrix rateMatrix)
          Items in validationMatrix are moved to original rateMatrix.
 
Methods inherited from class prea.recommender.matrix.MatrixFactorizationRecommender
evaluate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

validationMatrix

private SparseMatrix validationMatrix
Rating matrix for items which will be used during the validation phase. Not allowed to refer during training phase.


validationRatio

private double validationRatio
Proportion of dataset, using for validation purpose.

Constructor Detail

NMF

public NMF(int uc,
           int ic,
           double max,
           double min,
           int fc,
           double lr,
           double r,
           double m,
           int iter,
           double vr,
           boolean verbose)
Construct a matrix-factorization model with the given data.

Parameters:
uc - The number of users in the dataset.
ic - The number of items in the dataset.
max - The maximum rating value in the dataset.
min - The minimum rating value in the dataset.
fc - The number of features in low-rank factorized matrix.
lr - The learning rate for gradient-descent method.
r - The regularization factor.
m - The momentum parameter.
iter - The maximum number of iteration.
verbose - Show progress of iterative methods.
Method Detail

buildModel

public void buildModel(SparseMatrix rateMatrix)
Build a model with given training set.

Specified by:
buildModel in interface Recommender
Overrides:
buildModel in class MatrixFactorizationRecommender
Parameters:
rateMatrix - Training data set.

makeValidationSet

private void makeValidationSet(SparseMatrix rateMatrix,
                               double validationRatio)
Items which will be used for validation purpose are moved from rateMatrix to validationMatrix.

Parameters:
validationRatio - Proportion of dataset, using for validation purpose.

restoreValidationSet

private void restoreValidationSet(SparseMatrix rateMatrix)
Items in validationMatrix are moved to original rateMatrix.