prea.recommender.matrix
Class MatrixFactorizationRecommender

java.lang.Object
  extended by prea.recommender.matrix.MatrixFactorizationRecommender
All Implemented Interfaces:
Recommender
Direct Known Subclasses:
BayesianPMF, NMF, PMF, RegularizedSVD

public abstract class MatrixFactorizationRecommender
extends java.lang.Object
implements Recommender

This is an abstract class implementing four matrix-factorization-based methods including Regularized SVD, NMF, PMF, and Bayesian PMF.

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

Field Summary
 int featureCount
          The number of features.
 int itemCount
          The number of items.
protected  SparseMatrix itemFeatures
          Item profile in low-rank matrix form.
 double learningRate
          Learning rate parameter.
 int maxIter
          Maximum number of iteration.
 double maxValue
          Maximum value of rating, existing in the dataset.
 double minValue
          Minimum value of rating, existing in the dataset.
 double momentum
          Momentum parameter.
protected  double offset
          Offset to rating estimation.
 double regularizer
          Regularization factor parameter.
 boolean showProgress
          Indicator whether to show progress of iteration.
 int userCount
          The number of users.
protected  SparseMatrix userFeatures
          User profile in low-rank matrix form.
 
Constructor Summary
MatrixFactorizationRecommender(int uc, int ic, double max, double min, int fc, double lr, double r, double m, int iter, boolean verbose)
          Construct a matrix-factorization-based model with the given data.
 
Method Summary
 void buildModel(SparseMatrix rateMatrix)
          Build a model with given training set.
 EvaluationMetrics evaluate(SparseMatrix testMatrix)
          Evaluate the designated algorithm with the given test data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

userCount

public int userCount
The number of users.


itemCount

public int itemCount
The number of items.


maxValue

public double maxValue
Maximum value of rating, existing in the dataset.


minValue

public double minValue
Minimum value of rating, existing in the dataset.


featureCount

public int featureCount
The number of features.


learningRate

public double learningRate
Learning rate parameter.


regularizer

public double regularizer
Regularization factor parameter.


momentum

public double momentum
Momentum parameter.


maxIter

public int maxIter
Maximum number of iteration.


showProgress

public boolean showProgress
Indicator whether to show progress of iteration.


offset

protected double offset
Offset to rating estimation. Usually this is the average of ratings.


userFeatures

protected SparseMatrix userFeatures
User profile in low-rank matrix form.


itemFeatures

protected SparseMatrix itemFeatures
Item profile in low-rank matrix form.

Constructor Detail

MatrixFactorizationRecommender

public MatrixFactorizationRecommender(int uc,
                                      int ic,
                                      double max,
                                      double min,
                                      int fc,
                                      double lr,
                                      double r,
                                      double m,
                                      int iter,
                                      boolean verbose)
Construct a matrix-factorization-based 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 used for describing user and item profiles.
lr - Learning rate for gradient-based or iterative optimization.
r - Controlling factor for the degree of regularization.
m - Momentum used in gradient-based or iterative optimization.
iter - The maximum number of iterations.
verbose - Indicating whether to show iteration steps and train error.
Method Detail

buildModel

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

Specified by:
buildModel in interface Recommender
Parameters:
rateMatrix - The rating matrix with train data.

evaluate

public EvaluationMetrics evaluate(SparseMatrix testMatrix)
Evaluate the designated algorithm with the given test data.

Specified by:
evaluate in interface Recommender
Parameters:
testMatrix - The rating matrix with test data.
Returns:
The result of evaluation, such as MAE, RMSE, and rank-score.