Abstract class for distributions. More...
#include <shark/Rng/AbstractDistribution.h>
Public Member Functions | |
virtual | ~AbstractDistribution () |
Dtor. More... | |
virtual double | p (double x) const =0 |
virtual double | logP (double x) const |
Abstract class for distributions.
Definition at line 44 of file AbstractDistribution.h.
|
inlinevirtual |
|
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 in shark::Normal< RngType >, and shark::Normal< Rng::rng_type >.
Definition at line 64 of file AbstractDistribution.h.
References p(), and shark::safeLog().
|
pure virtual |
Calculate probability for a given input
x | the input for calculating probability |
Implemented in shark::Uniform< RngType >, shark::Normal< RngType >, and shark::Normal< Rng::rng_type >.
Referenced by logP(), and ~AbstractDistribution().