Implements a univariate normal (Gaussian) distribution. More...
#include <shark/Rng/Normal.h>
Public Member Functions | |
Normal (RngType &rng, double mean=0., double variance=1.) | |
double | operator() (double mean, double variance) |
double | mean () const |
double | variance () const |
void | mean (double newMean) |
void | variance (double newVariance) |
double | p (double x) const |
double | logP (double x) const |
![]() | |
virtual | ~AbstractDistribution () |
Dtor. More... | |
Implements a univariate normal (Gaussian) distribution.
For backwards compatibility with older shark versions instead of the standard deviation sigma the variance=sigma^2 is used as argument.
|
inline |
|
inlinevirtual |
Calculate log(p(x))
std::log can get -inf before it returns NaN. shark::safeLog tries to save the day, however is not perfect. The only real solution is to implement a function logP inside the distributions which returns the energy of the state
x | the input for calculating log of probability |
Reimplemented from shark::AbstractDistribution.
Definition at line 103 of file Normal.h.
References shark::Normal< RngType >::mean(), shark::safeLog(), shark::sqr(), and shark::SQRT_2_PI.
|
inline |
Definition at line 77 of file Normal.h.
Referenced by shark::Normal< RngType >::logP(), shark::Normal< RngType >::p(), shark::NormalTrainer::train(), and shark::Normal< RngType >::variance().
|
inline |
|
inline |
|
inlinevirtual |
Calculate probability for a given input
x | the input for calculating probability |
Implements shark::AbstractDistribution.
Definition at line 97 of file Normal.h.
References shark::Normal< RngType >::mean(), shark::sqr(), and shark::SQRT_2_PI.
|
inline |
Definition at line 82 of file Normal.h.
Referenced by shark::NormalTrainer::train().
|
inline |
Definition at line 92 of file Normal.h.
References shark::Normal< RngType >::mean().