1 #ifndef SVD_INCREMENTAL_LEARNING_HPP_INCLUDED 2 #define SVD_INCREMENTAL_LEARNING_HPP_INCLUDED 17 template<
typename MatType>
18 void Initialize(
const MatType& dataset,
const size_t rank)
52 template<
typename MatType>
57 arma::mat deltaW(
n, W.n_cols);
59 for(
size_t i = 0;i <
n;i++)
65 if(
kw != 0) deltaW.row(i) -=
kw * W.row(i);
80 template<
typename MatType>
85 arma::mat deltaH(H.n_rows, 1);
88 for(
size_t i = 0;i <
n;i++)
93 arma::trans(W.row(i));
113 inline void SVDIncompleteIncrementalLearning::
114 WUpdate<arma::sp_mat>(
const arma::sp_mat& V,
118 arma::mat deltaW(
n, W.n_cols);
127 if(
kw != 0) deltaW.row(i) -=
kw * W.row(i);
134 inline void SVDIncompleteIncrementalLearning::
135 HUpdate<arma::sp_mat>(
const arma::sp_mat& V,
139 arma::mat deltaH(H.n_rows, 1);
149 arma::trans(W.row(i));
161 #endif // SVD_INCREMENTAL_LEARNING_HPP_INCLUDED
Linear algebra utility functions, generally performed on matrices or vectors.
void Initialize(const MatType &dataset, const size_t rank)
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.
SVDIncompleteIncrementalLearning(double u=0.001, double kw=0, double kh=0)