1 #ifndef SVD_COMPLETE_INCREMENTAL_LEARNING_HPP_INCLUDED
2 #define SVD_COMPLETE_INCREMENTAL_LEARNING_HPP_INCLUDED
11 template <
class MatType>
21 void Initialize(
const MatType& dataset,
const size_t rank)
59 arma::mat deltaW(1, W.n_cols);
95 arma::mat deltaH(H.n_rows, 1);
144 void Initialize(
const arma::sp_mat& dataset,
const size_t rank)
150 it =
new arma::sp_mat::const_iterator(dataset.begin());
167 if(!isStart) (*it)++;
168 else isStart =
false;
173 it =
new arma::sp_mat::const_iterator(V.begin());
179 arma::mat deltaW(1, W.n_cols);
182 deltaW += (**it - arma::dot(W.row(currentItemIndex), H.col(currentUserIndex)))
183 * arma::trans(H.col(currentUserIndex));
184 if(
kw != 0) deltaW -=
kw * W.row(currentItemIndex);
186 W.row(currentItemIndex) +=
u*deltaW;
204 arma::mat deltaH(H.n_rows, 1);
210 deltaH += (**it - arma::dot(W.row(currentItemIndex), H.col(currentUserIndex)))
211 * arma::trans(W.row(currentItemIndex));
212 if(
kh != 0) deltaH -=
kh * H.col(currentUserIndex);
214 H.col(currentUserIndex++) +=
u * deltaH;
226 arma::sp_mat::const_iterator*
it;
235 #endif // SVD_COMPLETE_INCREMENTAL_LEARNING_HPP_INCLUDED
void HUpdate(const arma::sp_mat &V, const arma::mat &W, arma::mat &H)
The update rule for the encoding matrix H.
void WUpdate(const MatType &V, arma::mat &W, const arma::mat &H)
The update rule for the basis matrix W.
void HUpdate(const MatType &V, const arma::mat &W, arma::mat &H)
The update rule for the encoding matrix H.
~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)
SVDCompleteIncrementalLearning(double u=0.01, double kw=0, double kh=0)
void Initialize(const MatType &dataset, const size_t rank)
void Initialize(const arma::sp_mat &dataset, const size_t rank)