14 #ifndef MLPACK_METHODS_ANN_INIT_RULES_GAUSSIAN_INIT_HPP 15 #define MLPACK_METHODS_ANN_INIT_RULES_GAUSSIAN_INIT_HPP 38 mean(mean), variance(variance)
56 W.set_size(rows, cols);
58 W.imbue( [&]() {
return arma::as_scalar(
RandNormal(mean, variance)); } );
70 Log::Fatal <<
"Cannot initialize an empty matrix." << std::endl;
72 W.imbue( [&]() {
return arma::as_scalar(
RandNormal(mean, variance)); } );
90 W.set_size(rows, cols, slices);
92 for (
size_t i = 0; i < slices; ++i)
93 Initialize(W.slice(i), rows, cols);
101 template<
typename eT>
105 Log::Fatal <<
"Cannot initialize an empty matrix." << std::endl;
107 for (
size_t i = 0; i < W.n_slices; ++i)
108 Initialize(W.slice(i));
Linear algebra utility functions, generally performed on matrices or vectors.
void Initialize(arma::Mat< eT > &W, const size_t rows, const size_t cols)
Initialize the elements weight matrix using a Gaussian Distribution.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Initialize(arma::Cube< eT > &W)
Initialize randomly the elements of the specified weight 3rd order tensor.
GaussianInitialization(const double mean=0, const double variance=1)
Initialize the gaussian with the given mean and variance.
static MLPACK_EXPORT util::PrefixedOutStream Fatal
Prints fatal messages prefixed with [FATAL], then terminates the program.
double RandNormal()
Generates a normally distributed random number with mean 0 and variance 1.
Miscellaneous math routines.
void Initialize(arma::Mat< eT > &W)
Initialize the elements weight matrix using a Gaussian Distribution.
Miscellaneous math random-related routines.
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.
This class is used to initialize weigth matrix with a gaussian.