Public Member Functions | Protected Attributes

CGaussian Class Reference

Detailed Description

Gaussian distribution interface.

Takes as input a mean vector and covariance matrix. Also possible to train from data. Likelihood is computed using the Gaussian PDF $(2\pi)^{-\frac{k}{2}}|\Sigma|^{-\frac{1}{2}}e^{-\frac{1}{2}(x-\mu)'\Sigma^{-1}(x-\mu)}$ The actual computations depend on the type of covariance used.

Definition at line 46 of file Gaussian.h.

Inheritance diagram for CGaussian:
Inheritance graph

List of all members.

Public Member Functions

 CGaussian ()
 CGaussian (SGVector< float64_t > mean, SGMatrix< float64_t > cov, ECovType cov_type=FULL)
virtual ~CGaussian ()
void init ()
virtual bool train (CFeatures *data=NULL)
virtual int32_t get_num_model_parameters ()
virtual float64_t get_log_model_parameter (int32_t num_param)
virtual float64_t get_log_derivative (int32_t num_param, int32_t num_example)
virtual float64_t get_log_likelihood_example (int32_t num_example)
virtual float64_t compute_PDF (SGVector< float64_t > point)
virtual float64_t compute_log_PDF (SGVector< float64_t > point)
virtual SGVector< float64_tget_mean ()
virtual void set_mean (SGVector< float64_t > mean)
virtual SGMatrix< float64_tget_cov ()
virtual void set_cov (SGMatrix< float64_t > cov)
ECovType get_cov_type ()
void set_cov_type (ECovType cov_type)
SGVector< float64_tget_d ()
void set_d (SGVector< float64_t > d)
SGMatrix< float64_tget_u ()
void set_u (SGMatrix< float64_t > u)
SGVector< float64_tsample ()
virtual const char * get_name () const

Protected Attributes

float64_t m_constant
SGVector< float64_tm_d
SGMatrix< float64_tm_u
SGVector< float64_tm_mean
ECovType m_cov_type

Constructor & Destructor Documentation

CGaussian (  ) 

default constructor

Definition at line 20 of file Gaussian.cpp.

CGaussian ( SGVector< float64_t mean,
SGMatrix< float64_t cov,
ECovType  cov_type = FULL 


mean mean of the Gaussian
cov covariance of the Gaussian
cov_type covariance type (full, diagonal or shperical)

Definition at line 25 of file Gaussian.cpp.

~CGaussian (  )  [virtual]

Definition at line 60 of file Gaussian.cpp.

Member Function Documentation

float64_t compute_log_PDF ( SGVector< float64_t point  )  [virtual]

compute log PDF

point point for which to compute the log PDF
computed log PDF

Definition at line 126 of file Gaussian.cpp.

virtual float64_t compute_PDF ( SGVector< float64_t point  )  [virtual]

compute PDF

point point for which to compute the PDF
computed PDF

Definition at line 107 of file Gaussian.h.

SGMatrix< float64_t > get_cov (  )  [virtual]

get covariance

cov covariance, memory needs to be freed by user

Definition at line 165 of file Gaussian.cpp.

ECovType get_cov_type (  ) 

get covariance type

covariance type

Definition at line 167 of file Gaussian.h.

SGVector<float64_t> get_d (  ) 

get diagonal


Definition at line 187 of file Gaussian.h.

float64_t get_log_derivative ( int32_t  num_param,
int32_t  num_example 
) [virtual]

get partial derivative of likelihood function (logarithmic)

num_param derivative against which param
num_example which example
derivative of likelihood (logarithmic)

Implements CDistribution.

Definition at line 111 of file Gaussian.cpp.

float64_t get_log_likelihood_example ( int32_t  num_example  )  [virtual]

compute log likelihood for example

abstract base method

num_example which example
log likelihood for example

Implements CDistribution.

Definition at line 117 of file Gaussian.cpp.

float64_t get_log_model_parameter ( int32_t  num_param  )  [virtual]

get model parameter (logarithmic)

model parameter (logarithmic) if num_param < m_dim returns an element from the mean, else return an element from the covariance

Implements CDistribution.

Definition at line 105 of file Gaussian.cpp.

virtual SGVector<float64_t> get_mean (  )  [virtual]

get mean


Definition at line 123 of file Gaussian.h.

virtual const char* get_name (  )  const [virtual]
object name

Implements CSGObject.

Definition at line 229 of file Gaussian.h.

int32_t get_num_model_parameters (  )  [virtual]

get number of parameters in model

number of parameters in model

Implements CDistribution.

Definition at line 91 of file Gaussian.cpp.

SGMatrix<float64_t> get_u (  ) 

get unitary matrix

unitary matrix

Definition at line 207 of file Gaussian.h.

void init (  ) 

Compute the constant part

Reimplemented from CSGObject.

Definition at line 44 of file Gaussian.cpp.

SGVector< float64_t > sample (  ) 

sample from distribution


Definition at line 245 of file Gaussian.cpp.

virtual void set_cov ( SGMatrix< float64_t cov  )  [virtual]

set covariance

Doesn't store the covariance, but decomposes, thus the covariance can be freed after exit without harming the object

cov new covariance

Definition at line 153 of file Gaussian.h.

void set_cov_type ( ECovType  cov_type  ) 

set covariance type

Will only take effect after covariance is changed

cov_type new covariance type

Definition at line 178 of file Gaussian.h.

void set_d ( SGVector< float64_t d  ) 

set diagonal

d new diagonal

Definition at line 196 of file Gaussian.h.

virtual void set_mean ( SGVector< float64_t mean  )  [virtual]

set mean

mean new mean

Definition at line 132 of file Gaussian.h.

void set_u ( SGMatrix< float64_t u  ) 

set unitary matrix

u new unitary matrix

Definition at line 216 of file Gaussian.h.

bool train ( CFeatures data = NULL  )  [virtual]

learn distribution

data training data
whether training was successful

Implements CDistribution.

Definition at line 67 of file Gaussian.cpp.

Member Data Documentation

float64_t m_constant [protected]

constant part

Definition at line 243 of file Gaussian.h.

ECovType m_cov_type [protected]

covariance type

Definition at line 251 of file Gaussian.h.

SGVector<float64_t> m_d [protected]


Definition at line 245 of file Gaussian.h.

SGVector<float64_t> m_mean [protected]


Definition at line 249 of file Gaussian.h.

SGMatrix<float64_t> m_u [protected]

unitary matrix

Definition at line 247 of file Gaussian.h.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation