|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectMatrixFactorization
public class MatrixFactorization
This is a class implementing matrix-factorization-based CF algorithms, including regularized SVD, NMF (Lee and Seung, NIPS 2001), PMF (NIPS 2008), and Bayesian PMF (ICML 2008).
Field Summary | |
---|---|
static int |
BAYESIAN_PROBABLISTIC_MF
Algorithm Code for Bayesian PMF |
int |
featureCount
The number of features. |
int |
itemCount
The number of items. |
SparseMatrix |
itemFeatures
Item profile in low-rank matrix form. |
double |
learningRate
Learning rate parameter. |
int |
maxIter
Maximum number of iteration. |
int |
maxValue
Maximum value of rating, existing in the dataset. |
int |
minValue
Minimum value of rating, existing in the dataset. |
double |
momentum
Momentum parameter. |
static int |
NON_NEGATIVE_MF_FROB
Algorithm Code for NMF, optimizing Frobenius Norm |
static int |
NON_NEGATIVE_MF_KLD
Algorithm Code for NMF, optimizing KL Divergence |
double |
offset
Offset to rating estimation. |
static int |
PROBABLISTIC_MF
Algorithm Code for PMF |
SparseMatrix |
rateMatrix
Rating matrix for each user (row) and item (column) |
static int |
REGULARIZED_SVD
Algorithm Code for Regularized SVD |
double |
regularizer
Regularization factor parameter. |
boolean |
showProgress
Indicator whether to show progress of iteration. |
SparseMatrix |
testMatrix
Rating matrix for test items. |
int |
userCount
The number of users. |
SparseMatrix |
userFeatures
User profile in low-rank matrix form. |
private SparseMatrix |
validationMatrix
Rating matrix for items which will be used during the validation phase. |
double |
validationRatio
Proportion of dataset, using for validation purpose. |
Constructor Summary | |
---|---|
MatrixFactorization(SparseMatrix rm,
SparseMatrix tm,
int uc,
int ic,
int max,
int min,
int fc,
double lr,
double r,
double m,
int iter)
Construct a matrix-factorization model with the given data. |
Method Summary | |
---|---|
void |
buildModel(int method)
Build a model with the given data and algorithm. |
EvaluationMetrics |
evaluate(int method)
Evaluate the designated algorithm with the given test data. |
private void |
makeValidationSet(double validationRatio)
Items which will be used for validation purpose are moved from rateMatrix to validationMatrix. |
private void |
restoreValidationSet()
Items in validationMatrix are moved to original rateMatrix. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int REGULARIZED_SVD
public static final int NON_NEGATIVE_MF_FROB
public static final int NON_NEGATIVE_MF_KLD
public static final int PROBABLISTIC_MF
public static final int BAYESIAN_PROBABLISTIC_MF
public SparseMatrix rateMatrix
public SparseMatrix testMatrix
private SparseMatrix validationMatrix
public int featureCount
public int userCount
public int itemCount
public int maxValue
public int minValue
public double learningRate
public double regularizer
public double momentum
public int maxIter
public double offset
public double validationRatio
public SparseMatrix userFeatures
public SparseMatrix itemFeatures
public boolean showProgress
Constructor Detail |
---|
public MatrixFactorization(SparseMatrix rm, SparseMatrix tm, int uc, int ic, int max, int min, int fc, double lr, double r, double m, int iter)
rm
- The rating matrix which will be used for training.tm
- The rating matrix which will be used for testing.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.Method Detail |
---|
public void buildModel(int method)
method
- The code of algorithm to be tested.
It can have one of the following: REGULARIZED_SVD, NON_NEGATIVE_MF_FROB,
NON_NEGATIVE_MF_KLD, PROBABLISTIC_MF, and BAYESIAN_PROBABLISTIC_MF.public EvaluationMetrics evaluate(int method)
method
- The code of algorithm to be tested.
It can have one of the following: REGULARIZED_SVD, NON_NEGATIVE_MF_FROB,
NON_NEGATIVE_MF_KLD, PROBABLISTIC_MF, and BAYESIAN_PROBABLISTIC_MF.
private void makeValidationSet(double validationRatio)
validationRatio
- Proportion of dataset, using for validation purpose.private void restoreValidationSet()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |