26 #ifndef MLPACK_METHODS_ANN_INIT_RULES_NGUYEN_WIDROW_INIT_HPP 27 #define MLPACK_METHODS_ANN_INIT_RULES_NGUYEN_WIDROW_INIT_HPP 64 const double upperBound = 0.5) :
65 lowerBound(lowerBound), upperBound(upperBound) { }
76 void Initialize(arma::Mat<eT>& W,
const size_t rows,
const size_t cols)
81 double beta = 0.7 * std::pow(cols, 1.0 / rows);
82 W *= (beta / arma::norm(W));
97 double beta = 0.7 * std::pow(W.n_cols, 1.0 / W.n_rows);
98 W *= (beta / arma::norm(W));
110 template<
typename eT>
117 W.set_size(rows, cols, slices);
119 for (
size_t i = 0; i < slices; ++i)
129 template<
typename eT>
133 Log::Fatal <<
"Cannot initialize an empty matrix." << std::endl;
135 for (
size_t i = 0; i < W.n_slices; ++i)
153 static const bool UseLayer =
false;
void Initialize(arma::Cube< eT > &W)
Initialize the elements of the specified weight 3rd order tensor with the Nguyen-Widrow method...
Linear algebra utility functions, generally performed on matrices or vectors.
This class is used to initialize randomly the weight matrix.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Initialize(arma::Cube< eT > &W, const size_t rows, const size_t cols, const size_t slices)
Initialize the elements of the specified weight 3rd order tensor with the Nguyen-Widrow method...
void Initialize(arma::Mat< eT > &W)
Initialize the elements of the specified weight matrix with the Nguyen-Widrow method.
void Initialize(arma::Mat< eT > &W, const size_t rows, const size_t cols)
Initialize randomly the elements of the specified weight matrix.
static MLPACK_EXPORT util::PrefixedOutStream Fatal
Prints fatal messages prefixed with [FATAL], then terminates the program.
NguyenWidrowInitialization(const double lowerBound=-0.5, const double upperBound=0.5)
Initialize the random initialization rule with the given lower bound and upper bound.
This is a template class that can provide information about various initialization methods...
void Initialize(arma::Mat< eT > &W, const size_t rows, const size_t cols)
Initialize the elements of the specified weight matrix with the Nguyen-Widrow method.
This class is used to initialize the weight matrix with the Nguyen-Widrow method. ...