void CAlgorithmParabola::caseA() { m_sigma = qAbs(deltaH(QPoint(m_x,m_y)))-qAbs(deltaD(QPoint(m_x,m_y))); if(m_sigma<=0) { m_x++; m_delta+= 2* qAbs(m_p); } else{ caseV(); } }
/** * The update rule for the encoding matrix H. * The function takes in all the matrices and only changes the * value of the H matrix. * * @param V Input matrix to be factorized. * @param W Basis matrix. * @param H Encoding matrix to be updated. */ inline void HUpdate(const arma::sp_mat& /* V */, const arma::mat& W, arma::mat& H) { arma::mat deltaH(H.n_rows, 1); deltaH.zeros(); size_t currentUserIndex = it->col(); size_t currentItemIndex = it->row(); deltaH += (**it - arma::dot(W.row(currentItemIndex), H.col(currentUserIndex))) * arma::trans(W.row(currentItemIndex)); if (kh != 0) deltaH -= kh * H.col(currentUserIndex); H.col(currentUserIndex) += u * deltaH; }
inline void HUpdate(const MatType& V, const arma::mat& W, arma::mat& H) { arma::mat deltaH(H.n_rows, 1); deltaH.zeros(); for(size_t i = 0;i < n;i++) { double val; if((val = V(i, currentUserIndex)) != 0) deltaH += (val - arma::dot(W.row(i), H.col(currentUserIndex))) * arma::trans(W.row(i)); } if(kh != 0) deltaH -= kh * H.col(currentUserIndex); H.col(currentUserIndex++) += u * deltaH; currentUserIndex = currentUserIndex % m; }
inline void SVDIncompleteIncrementalLearning:: HUpdate<arma::sp_mat>(const arma::sp_mat& V, const arma::mat& W, arma::mat& H) { arma::mat deltaH(H.n_rows, 1); deltaH.zeros(); for(arma::sp_mat::const_iterator it = V.begin_col(currentUserIndex); it != V.end_col(currentUserIndex);it++) { double val = *it; size_t i = it.row(); if((val = V(i, currentUserIndex)) != 0) deltaH += (val - arma::dot(W.row(i), H.col(currentUserIndex))) * arma::trans(W.row(i)); } if(kh != 0) deltaH -= kh * H.col(currentUserIndex); H.col(currentUserIndex++) += u * deltaH; currentUserIndex = currentUserIndex % m; }