|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectprea.recommender.etc.NonlinearPMF
public class NonlinearPMF
This is a class implementing Non-linear Probabilistic Matrix Factorization. Technical detail of the algorithm can be found in Neil D. Lawrence and Raquel Urtasun, Non-linear Matrix Factorization with Gaussian Processes, Proceedings of the 26th International Conference on Machine Learning, 2009.
Field Summary | |
---|---|
static int |
ATOX
|
int |
featureCount
The number of features. |
static int |
GRADFACT
|
(package private) int[] |
index1toAll
list of number from 1 to n |
int |
itemCount
The number of items. |
SparseMatrix |
itemFeatures
Item profile in low-rank matrix form. |
SparseMatrix |
itemFeaturesChange
Change of Item profile in low-rank matrix form. |
DenseVector |
kernParam
kernel parameter value |
int |
kernParamNum
kernel parameter number |
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. |
SparseMatrix |
rateMatrix
Rating matrix for each user (row) and item (column) |
boolean |
showProgress
Indicator whether to show progress of iteration. |
int |
userCount
The number of users. |
static int |
XTOA
|
Constructor Summary | |
---|---|
NonlinearPMF(int uc,
int ic,
double max,
double min,
int fc,
double l,
double m,
int iter,
double kernInverseWidth,
double kernVarianceRbf,
double kernVarianceBias,
double kernVarianceWhite)
Construct a matrix-factorization model with the given data. |
Method Summary | |
---|---|
void |
buildModel(SparseMatrix rm)
Build a model with the given data and algorithm. |
private DenseVector |
collabLogLikeGradients(int user,
DenseVector kernParam,
double momentum,
double learningRate)
Compute the gradients of the model (latent factors and kernel parameters) given one users ratings. |
private DenseMatrix |
distancePairWise(DenseMatrix X1,
DenseMatrix X2)
Compute the squared Euclidean distance between the row vectors of one matrix and the row vectors of another matrix. |
private DenseVector |
distancePairWise(DenseMatrix X1,
DenseVector x)
Compute the squared euclidean distance between the row vectors of one matrix and a vector. |
EvaluationMetrics |
evaluate(SparseMatrix testMatrix)
Evaluate the designated algorithm with the given test data. |
private DenseVector |
expTransform(DenseVector x,
int transformType)
Transform a vector by log function, exponential function or linear function. |
private DenseVector |
getEstimation(int u,
int[] testItemsRaw)
Estimate of ratings for a given user and a set of test items. |
private DenseMatrix |
kernCompute(DenseMatrix X1,
DenseMatrix X2,
boolean whiteNoiseFlag)
Compute kernel parameters for vectors in matrix X1 and vectors in matrix X2. |
private DenseMatrix |
rbfKernCompute(DenseMatrix distance,
double kernInverseWidth,
double kernVarianceRbf)
Compute RBF(radial basis function) kernel parameters for given distances. |
private DenseMatrix |
rbfKernGradXpoint(DenseVector x,
DenseMatrix X2,
double kernInverseWidth,
double kernVarianceRbf)
Compute the gradient of RBF kernel with respect to input locations. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ATOX
public static final int XTOA
public static final int GRADFACT
public SparseMatrix rateMatrix
public int userCount
public int itemCount
public int featureCount
public double maxValue
public double minValue
public double learningRate
public double momentum
public int maxIter
public SparseMatrix itemFeatures
public SparseMatrix itemFeaturesChange
public boolean showProgress
public int kernParamNum
public DenseVector kernParam
int[] index1toAll
Constructor Detail |
---|
public NonlinearPMF(int uc, int ic, double max, double min, int fc, double l, double m, int iter, double kernInverseWidth, double kernVarianceRbf, double kernVarianceBias, double kernVarianceWhite)
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.iter
- The maximum number of iteration.kernInverseWidth
- the kernel inverse width for the RBF kernel.kernVarianceRbf
- the variance for the RBF kernel.kernVarianceBias
- the variance for the bias.kernVarianceWhite
- the variance for the white noise.Method Detail |
---|
public void buildModel(SparseMatrix rm)
buildModel
in interface Recommender
rm
- The rating matrix with train data.public EvaluationMetrics evaluate(SparseMatrix testMatrix)
evaluate
in interface Recommender
testMatrix
- The rating matrix with test data.
private DenseVector getEstimation(int u, int[] testItemsRaw)
u
- The user number.testItemsRaw
- The list of items to be predicted.
private DenseVector expTransform(DenseVector x, int transformType)
x
- The input vector.transformType
- the type of function.
private DenseMatrix distancePairWise(DenseMatrix X1, DenseMatrix X2)
X1
- matrix1.X2
- matrix2.
private DenseVector distancePairWise(DenseMatrix X1, DenseVector x)
X1
- matrix1.x
- vector.
private DenseMatrix rbfKernCompute(DenseMatrix distance, double kernInverseWidth, double kernVarianceRbf)
distance
- The distance matrix.kernInverseWidth
- The kernal inverse bandwidth.kernVarianceRbf
- The kern variance.
private DenseMatrix rbfKernGradXpoint(DenseVector x, DenseMatrix X2, double kernInverseWidth, double kernVarianceRbf)
x
- row locations against which gradients are being computed.X2
- column locations against which gradients are being computed.kernInverseWidth
- The kernal inverse bandwidth.kernVarianceRbf
- The kern variance.
private DenseMatrix kernCompute(DenseMatrix X1, DenseMatrix X2, boolean whiteNoiseFlag)
X1
- the matrix1.X2
- the matrix2.whiteNoiseFlag
- the flag for combining whiteNoise.
private DenseVector collabLogLikeGradients(int user, DenseVector kernParam, double momentum, double learningRate)
user
- the userId.kernParam
- the kernel parameters.momentum
- the momentum.learningRate
- the learningRate.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |