14 #ifndef __MLPACK_METHODS_AMF_SVD_COMPLETE_INCREMENTAL_LEARNING_HPP 15 #define __MLPACK_METHODS_AMF_SVD_COMPLETE_INCREMENTAL_LEARNING_HPP 46 template <
class MatType>
94 deltaW.zeros(1, W.n_cols);
130 deltaH.zeros(H.n_rows, 1);
185 void Initialize(
const arma::sp_mat& dataset,
const size_t rank)
191 it =
new arma::sp_mat::const_iterator(dataset.begin());
208 if(!isStart) (*it)++;
209 else isStart =
false;
214 it =
new arma::sp_mat::const_iterator(V.begin());
220 arma::mat deltaW(1, W.n_cols);
223 deltaW += (**it - arma::dot(W.row(currentItemIndex), H.col(currentUserIndex)))
224 * arma::trans(H.col(currentUserIndex));
225 if(
kw != 0) deltaW -=
kw * W.row(currentItemIndex);
227 W.row(currentItemIndex) +=
u*deltaW;
245 arma::mat deltaH(H.n_rows, 1);
251 deltaH += (**it - arma::dot(W.row(currentItemIndex), H.col(currentUserIndex)))
252 * arma::trans(W.row(currentItemIndex));
253 if(
kh != 0) deltaH -=
kh * H.col(currentUserIndex);
255 H.col(currentUserIndex) +=
u * deltaH;
267 arma::sp_mat::const_iterator*
it;
void HUpdate(const arma::sp_mat &V, const arma::mat &W, arma::mat &H)
The update rule for the encoding matrix H.
This class computes SVD using complete incremental batch learning, as described in the following pape...
void WUpdate(const MatType &V, arma::mat &W, const arma::mat &H)
The update rule for the basis matrix W.
Linear algebra utility functions, generally performed on matrices or vectors.
void HUpdate(const MatType &V, const arma::mat &W, arma::mat &H)
The update rule for the encoding matrix H.
double kw
Regularization parameter for matrix W.
~SVDCompleteIncrementalLearning()
arma::sp_mat::const_iterator * it
void WUpdate(const arma::sp_mat &V, arma::mat &W, const arma::mat &H)
The update rule for the basis matrix W.
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
SVDCompleteIncrementalLearning(double u=0.0001, double kw=0, double kh=0)
Initialize the SVDCompleteIncrementalLearning class with the given parameters.
SVDCompleteIncrementalLearning(double u=0.01, double kw=0, double kh=0)
double kh
Regularization parameter for matrix H.
void Initialize(const MatType &, const size_t)
Initialize parameters before factorization.
void Initialize(const arma::sp_mat &dataset, const size_t rank)
size_t currentUserIndex
User of index of current entry.
double u
Step count of batch learning.
size_t currentItemIndex
Item index of current entry.