Performs a matrix factorization on the given data set. The factorization is done using a stochastic gradient decent method.
gmf(Y, q, maxit = 1000, lambda = 0.01, cor_rate = 0.9)
A list containing,
A numeric matrix of size \(p \times q\)
A numeric matrix of size \(n \times q\) matrix
data matrix containing all numerical values.
maximum number of iterations.
number of factors.
initial learning rate.
correction rate.
Unsupervised matrix factorization of a \(n \times p\) data matrix \(Y\) can be expressed as, $$ Y^{\top} \approx A B^{\top}, $$ where \(A\) is a \(p \times q\) matrix and \(B\) is \(n \times q\) matrix. With this matrix factorization method, one replaces the \(i\)th row in matrix \(Y\) by the \(i\)th row in matrix \(B\). The matrices \(A\) and \(B\) are chosen to minimize an objective function \(f(Y, A, B)\) with under constraints specific to the matrix factorization method.
It is imperative that columns of the data matrix be on the same scale. Otherwise, it may not be possible to obtain a factorization of the data using this approach.
Nikulin V, Huang T-H, Ng SK, Rathnayake SI, & McLachlan GJ (2011). A very fast algorithm for matrix factorization. Statistics & Probability Letters 81, 773--782.
lst <- gmf(iris[, -5], q = 2, maxit = 100)
Run the code above in your browser using DataLab