13 #ifndef MLPACK_METHODS_AMF_INIT_RULES_GIVEN_INIT_HPP 14 #define MLPACK_METHODS_AMF_INIT_RULES_GIVEN_INIT_HPP 35 w(w), h(h), wIsGiven(true), hIsGiven(true) { }
88 template<
typename MatType>
97 Log::Fatal <<
"Initial W matrix is not given!" << std::endl;
101 Log::Fatal <<
"Initial H matrix is not given!" << std::endl;
105 if (w.n_rows != V.n_rows)
107 Log::Fatal <<
"The number of rows in given W (" << w.n_rows
108 <<
") doesn't equal the number of rows in V (" << V.n_rows
109 <<
") !" << std::endl;
113 Log::Fatal <<
"The number of columns in given W (" << w.n_cols
114 <<
") doesn't equal the rank of factorization (" << r
115 <<
") !" << std::endl;
117 if (h.n_cols != V.n_cols)
119 Log::Fatal <<
"The number of columns in given H (" << h.n_cols
120 <<
") doesn't equal the number of columns in V (" << V.n_cols
121 <<
") !" << std::endl;
125 Log::Fatal <<
"The number of rows in given H (" << h.n_rows
126 <<
") doesn't equal the rank of factorization (" << r
127 <<
") !"<< std::endl;
143 template<
typename MatType>
147 const bool whichMatrix =
true)
154 Log::Fatal <<
"Initial W matrix is not given!" << std::endl;
158 if (w.n_rows != V.n_rows)
160 Log::Fatal <<
"The number of rows in given W (" << w.n_rows
161 <<
") doesn't equal the number of rows in V (" << V.n_rows
162 <<
") !" << std::endl;
166 Log::Fatal <<
"The number of columns in given W (" << w.n_cols
167 <<
") doesn't equal the rank of factorization (" << r
168 <<
") !" << std::endl;
179 Log::Fatal <<
"Initial H matrix is not given!" << std::endl;
183 if (h.n_cols != V.n_cols)
185 Log::Fatal <<
"The number of columns in given H (" << h.n_cols
186 <<
") doesn't equal the number of columns in V (" << V.n_cols
187 <<
") !" << std::endl;
191 Log::Fatal <<
"The number of rows in given H (" << h.n_rows
192 <<
") doesn't equal the rank of factorization (" << r
193 <<
") !"<< std::endl;
202 template<
typename Archive>
GivenInitialization(const arma::mat &m, const bool whichMatrix=true)
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void serialize(Archive &ar, const uint32_t)
Serialize the object (in this case, there is nothing to serialize).
static MLPACK_EXPORT util::PrefixedOutStream Fatal
Prints fatal messages prefixed with [FATAL], then terminates the program.
GivenInitialization(const arma::mat &&m, const bool whichMatrix=true)
This initialization rule for AMF simply fills the W and H matrices with the matrices given to the con...
void Initialize(const MatType &V, const size_t r, arma::mat &W, arma::mat &H)
Fill W and H with given matrices.
void InitializeOne(const MatType &V, const size_t r, arma::mat &M, const bool whichMatrix=true)
Fill W or H with given matrix.
GivenInitialization(const arma::mat &&w, const arma::mat &&h)
GivenInitialization(const arma::mat &w, const arma::mat &h)