13 #ifndef MLPACK_METHODS_ANN_INIT_RULES_RANDOM_INIT_HPP
14 #define MLPACK_METHODS_ANN_INIT_RULES_RANDOM_INIT_HPP
35 const double upperBound = 1) :
36 lowerBound(lowerBound), upperBound(upperBound) { }
46 lowerBound(-std::abs(bound)), upperBound(std::abs(bound)) { }
56 void Initialize(arma::Mat<eT>& W,
const size_t rows,
const size_t cols)
58 W = lowerBound + arma::randu<arma::Mat<eT>>(rows, cols) *
59 (upperBound - lowerBound);
75 W = arma::Cube<eT>(rows, cols, slices);
77 for (
size_t i = 0; i < slices; i++)
83 const double lowerBound;
86 const double upperBound;
This class is used to initialize randomly the weight matrix.
RandomInitialization(const double lowerBound=-1, const double upperBound=1)
Initialize the random initialization rule with the given lower bound and upper bound.
void Initialize(arma::Mat< eT > &W, const size_t rows, const size_t cols)
Initialize randomly the elements of the specified weight matrix.
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
RandomInitialization(const double bound)
Initialize the random initialization rule with the given bound.
void Initialize(arma::Cube< eT > &W, const size_t rows, const size_t cols, const size_t slices)
Initialize randomly the elements of the specified weight 3rd order tensor.