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));
static MLPACK_EXPORT util::PrefixedOutStream Fatal
Prints fatal messages prefixed with [FATAL], then terminates the program.
Definition: log.hpp:90
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Initialize(arma::Mat< eT > &W, const size_t rows, const size_t cols)
Initialize the elements weight matrix using a Gaussian Distribution.
Definition: gaussian_init.hpp:51
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.
Definition: gaussian_init.hpp:84
void Initialize(arma::Cube< eT > &W)
Initialize randomly the elements of the specified weight 3rd order tensor.
Definition: gaussian_init.hpp:102
double RandNormal()
Generates a normally distributed random number with mean 0 and variance 1.
Definition: random.hpp:127
Miscellaneous math routines.
Definition: ccov.hpp:20
void Initialize(arma::Mat< eT > &W)
Initialize the elements weight matrix using a Gaussian Distribution.
Definition: gaussian_init.hpp:67
GaussianInitialization(const double mean=0, const double variance=1)
Initialize the gaussian with the given mean and variance.
Definition: gaussian_init.hpp:37
Miscellaneous math random-related routines.
This class is used to initialize weigth matrix with a gaussian.
Definition: gaussian_init.hpp:28