Multivariate Gaussian Distribution.
More...
#include <xmmGaussianDistribution.hpp>
|
| GaussianDistribution (bool bimodal=false, unsigned int dimension=1, unsigned int dimension_input=0, CovarianceMode covariance_mode=CovarianceMode::Full) |
| Default Constructor. More...
|
|
| GaussianDistribution (GaussianDistribution const &src) |
| Copy constructor. More...
|
|
| GaussianDistribution (Json::Value const &root) |
| Constructor from Json Structure. More...
|
|
GaussianDistribution & | operator= (GaussianDistribution const &src) |
| Assignment. More...
|
|
|
double | likelihood (const float *observation) const |
| Get Likelihood of a data vector. More...
|
|
double | likelihood_input (const float *observation_input) const |
| Get Likelihood of a data vector for input modality. More...
|
|
double | likelihood_bimodal (const float *observation_input, const float *observation_output) const |
| Get Likelihood of a data vector for bimodal mode. More...
|
|
void | regression (std::vector< float > const &observation_input, std::vector< float > &predicted_output) const |
| Linear Regression using the Gaussian Distribution (covariance-based) More...
|
|
|
void | regularize (std::vector< double > regularization) |
| Add offset to the diagonal of the covariance matrix. More...
|
|
void | updateInverseCovariance () |
| Compute inverse covariance matrix. More...
|
|
Ellipse | toEllipse (unsigned int dimension1, unsigned int dimension2) |
| Compute the 68%?? Confidence Interval ellipse of the Gaussian. More...
|
|
void | fromEllipse (Ellipse const &gaussian_ellipse, unsigned int dimension1, unsigned int dimension2) |
| Sets the parameters of the Gaussian distribution according to the 68%?? Confidence Interval ellipse. More...
|
|
|
Json::Value | toJson () const |
| Write the object to a JSON Structure. More...
|
|
void | fromJson (Json::Value const &root) |
| Read the object from a JSON Structure. More...
|
|
|
void | writeFile (char *fileName) const |
| write method for python wrapping ('write' keyword forbidden, name has to be different) More...
|
|
void | readFile (char *fileName) |
| read method for python wrapping ('read' keyword forbidden, name has to be different) More...
|
|
std::string | __str__ () const |
| "print" method for python => returns the results of write method More...
|
|
Multivariate Gaussian Distribution.
Full covariance, optionally multimodal with support for regression
Covariance Mode.
Enumerator |
---|
Full |
Full covariance.
|
Diagonal |
Diagonal covariance (diagonal matrix)
|
xmm::GaussianDistribution::GaussianDistribution |
( |
bool |
bimodal = false , |
|
|
unsigned int |
dimension = 1 , |
|
|
unsigned int |
dimension_input = 0 , |
|
|
CovarianceMode |
covariance_mode = CovarianceMode::Full |
|
) |
| |
Default Constructor.
- Parameters
-
bimodal | specify if the distribution is bimodal for use in regression |
dimension | dimension of the distribution |
dimension_input | dimension of the input modality in bimodal mode. |
covariance_mode | covariance mode (full vs diagonal) |
Copy constructor.
- Parameters
-
xmm::GaussianDistribution::GaussianDistribution |
( |
Json::Value const & |
root | ) |
|
|
explicit |
Constructor from Json Structure.
- Parameters
-
std::string xmm::Writable::__str__ |
( |
| ) |
const |
|
inlineinherited |
"print" method for python => returns the results of write method
- Warning
- only defined if SWIGPYTHON is defined
void xmm::GaussianDistribution::allocate |
( |
| ) |
|
|
protected |
Resize Mean and Covariance Vectors to appropriate dimension.
void xmm::GaussianDistribution::fromEllipse |
( |
Ellipse const & |
gaussian_ellipse, |
|
|
unsigned int |
dimension1, |
|
|
unsigned int |
dimension2 |
|
) |
| |
Sets the parameters of the Gaussian distribution according to the 68%?? Confidence Interval ellipse.
the ellipse is 2D, and is therefore projected over 2 axes
- Parameters
-
gaussian_ellipse | 68% Confidence Interval ellipse parameters (1x std) |
dimension1 | index of the first axis |
dimension2 | index of the second axis |
- Exceptions
-
out_of_range | if the dimensions are out of bounds |
void xmm::GaussianDistribution::fromJson |
( |
Json::Value const & |
root | ) |
|
|
virtual |
Read the object from a JSON Structure.
- Parameters
-
root | JSON value containing the object's information |
- Exceptions
-
JsonException | if the JSON value has a wrong format |
Implements xmm::Writable.
double xmm::GaussianDistribution::likelihood |
( |
const float * |
observation | ) |
const |
Get Likelihood of a data vector.
- Parameters
-
observation | data observation (must be of size dimension) |
- Returns
- likelihood
- Exceptions
-
runtime_error | if the Covariance Matrix is not invertible |
double xmm::GaussianDistribution::likelihood_bimodal |
( |
const float * |
observation_input, |
|
|
const float * |
observation_output |
|
) |
| const |
Get Likelihood of a data vector for bimodal mode.
- Parameters
-
observation_input | observation of the input modality |
observation_output | observation of the output modality |
- Exceptions
-
runtime_error | if the Covariance Matrix is not invertible |
runtime_error | if the model is not bimodal |
- Returns
- likelihood
double xmm::GaussianDistribution::likelihood_input |
( |
const float * |
observation_input | ) |
const |
Get Likelihood of a data vector for input modality.
- Parameters
-
observation_input | observation (must be of size dimension_input) |
- Returns
- likelihood
- Exceptions
-
runtime_error | if the Covariance Matrix of the input modality is not invertible |
runtime_error | if the model is not bimodal |
void xmm::GaussianDistribution::onAttributeChange |
( |
AttributeBase * |
attr_pointer | ) |
|
|
protectedvirtual |
notification function called when a member attribute is changed
void xmm::Writable::readFile |
( |
char * |
fileName | ) |
|
|
inlineinherited |
read method for python wrapping ('read' keyword forbidden, name has to be different)
- Warning
- only defined if SWIGPYTHON is defined
void xmm::GaussianDistribution::regression |
( |
std::vector< float > const & |
observation_input, |
|
|
std::vector< float > & |
predicted_output |
|
) |
| const |
Linear Regression using the Gaussian Distribution (covariance-based)
- Parameters
-
observation_input | input observation (must be of size: dimension_input) |
predicted_output | predicted output vector (size: dimension-dimension_input) |
- Exceptions
-
runtime_error | if the model is not bimodal |
void xmm::GaussianDistribution::regularize |
( |
std::vector< double > |
regularization | ) |
|
Add offset to the diagonal of the covariance matrix.
Ensures convergence + generalization on few examples
xmm::Ellipse xmm::GaussianDistribution::toEllipse |
( |
unsigned int |
dimension1, |
|
|
unsigned int |
dimension2 |
|
) |
| |
Compute the 68%?? Confidence Interval ellipse of the Gaussian.
the ellipse is 2D, and is therefore projected over 2 axes
- Parameters
-
dimension1 | index of the first axis |
dimension2 | index of the second axis |
- Exceptions
-
out_of_range | if the dimensions are out of bounds |
- Returns
- ellipse parameters
Json::Value xmm::GaussianDistribution::toJson |
( |
| ) |
const |
|
virtual |
Write the object to a JSON Structure.
- Returns
- Json value containing the object's information
Implements xmm::Writable.
void xmm::GaussianDistribution::updateInverseCovariance |
( |
| ) |
|
Compute inverse covariance matrix.
- Exceptions
-
runtime_error | if the covariance matrix is not invertible |
void xmm::GaussianDistribution::updateOutputCovariance |
( |
| ) |
|
|
protected |
Compute the conditional variance vector of the output modality (conditioned over the input).
- Exceptions
-
runtime_error | if the model is not bimodal |
void xmm::Writable::writeFile |
( |
char * |
fileName | ) |
const |
|
inlineinherited |
write method for python wrapping ('write' keyword forbidden, name has to be different)
- Warning
- only defined if SWIGPYTHON is defined
bool xmm::GaussianDistribution::bimodal_ |
|
protected |
Defines if regression parameters need to be computed.
std::vector<double> xmm::GaussianDistribution::covariance |
Covariance Matrix of the Gaussian Distribution.
double xmm::GaussianDistribution::covariance_determinant_ |
|
protected |
Determinant of the covariance matrix.
double xmm::GaussianDistribution::covariance_determinant_input_ |
|
protected |
Determinant of the covariance matrix of the input modality.
Attribute<unsigned int> xmm::GaussianDistribution::dimension |
Convert to bimodal distribution in place.
- Parameters
-
dimension_input | dimension of the input modality |
- Exceptions
-
runtime_error | if the model is already bimodal |
out_of_range | if the requested input dimension is too large Convert to unimodal distribution in place |
runtime_error | if the model is already unimodal extract a sub-distribution with the given columns |
- Parameters
-
columns | columns indices in the target order |
- Exceptions
-
runtime_error | if the model is training |
out_of_range | if the number or indices of the requested columns exceeds the current dimension |
- Returns
- a Gaussian Distribution from the current model considering only the target columns extract the sub-distribution of the input modality
- Exceptions
-
runtime_error | if the model is training or if it is not bimodal |
- Returns
- a unimodal Gaussian Distribution of the input modality from the current bimodal model extract the sub-distribution of the output modality
- Exceptions
-
runtime_error | if the model is training or if it is not bimodal |
- Returns
- a unimodal Gaussian Distribution of the output modality from the current bimodal model extract the model with reversed input and output modalities
- Exceptions
-
runtime_error | if the model is training or if it is not bimodal |
- Returns
- a bimodal Gaussian Distribution that swaps the input and output modalities Total Dimension of the multivariate normal
Attribute<unsigned int> xmm::GaussianDistribution::dimension_input |
Input Dimension of the multivariate normal.
std::vector<double> xmm::GaussianDistribution::inverse_covariance_ |
|
protected |
Inverse covariance matrix.
std::vector<double> xmm::GaussianDistribution::inverse_covariance_input_ |
|
protected |
Inverse covariance matrix of the input modality.
std::vector<double> xmm::GaussianDistribution::mean |
Mean of the Gaussian Distribution.
std::vector<double> xmm::GaussianDistribution::output_covariance |
Conditional Output Variance (updated when covariances matrices are inverted)
The documentation for this class was generated from the following files: