12 #ifndef MLPACK_METHODS_AMF_SVD_COMPLETE_INCREMENTAL_LEARNING_HPP 13 #define MLPACK_METHODS_AMF_SVD_COMPLETE_INCREMENTAL_LEARNING_HPP 44 template <
class MatType>
92 deltaW.zeros(1, W.n_cols);
128 deltaH.zeros(H.n_rows, 1);
183 void Initialize(
const arma::sp_mat& dataset,
const size_t rank)
189 it =
new arma::sp_mat::const_iterator(dataset.begin());
206 if (!isStart) (*it)++;
207 else isStart =
false;
212 it =
new arma::sp_mat::const_iterator(V.begin());
218 arma::mat deltaW(1, W.n_cols);
221 deltaW += (**it - arma::dot(W.row(currentItemIndex), H.col(currentUserIndex)))
222 * arma::trans(H.col(currentUserIndex));
223 if (
kw != 0) deltaW -=
kw * W.row(currentItemIndex);
225 W.row(currentItemIndex) +=
u*deltaW;
243 arma::mat deltaH(H.n_rows, 1);
249 deltaH += (**it - arma::dot(W.row(currentItemIndex), H.col(currentUserIndex)))
250 * arma::trans(W.row(currentItemIndex));
251 if (
kh != 0) deltaH -=
kh * H.col(currentUserIndex);
253 H.col(currentUserIndex) +=
u * deltaH;
265 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.
The core includes that mlpack expects; standard C++ includes and Armadillo.
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.
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.