Module mixture :: Class MultiNormalDistribution
[hide private]
[frames] | no frames]

Class MultiNormalDistribution

source code


Multivariate Normal Distribution

Instance Methods [hide private]
 
__init__(self, p, mu, sigma)
Constructor
source code
 
__copy__(self)
Interface for the copy.copy function
source code
 
__str__(self)
String representation of the DataSet
source code
 
__eq__(self, other)
Interface for the '==' operation
source code
 
pdf(self, data)
Density function.
source code
 
MStep(self, posterior, data, mix_pi=None)
Maximization step of the EM procedure.
source code
 
sample(self, A=None)
Samples from the mulitvariate Normal distribution.
source code
 
sampleSet(self, nr)
Samples several values from the distribution.
source code
 
isValid(self, x)
Checks whether 'x' is a valid argument for the distribution and raises InvalidDistributionInput exception if that is not the case.
source code
 
flatStr(self, offset)
Returns the model parameters as a string compatible with the WriteMixture/ReadMixture flat file format.
source code

Inherited from ProbDistribution: formatData, merge, posteriorTraceback, sufficientStatistics, update_suff_p

Method Details [hide private]

__init__(self, p, mu, sigma)
(Constructor)

source code 

Constructor

Parameters:
  • p - dimensionality of the distribution
  • mu - mean parameter vector
  • sigma - covariance matrix
Overrides: ProbDistribution.__init__

__copy__(self)

source code 

Interface for the copy.copy function

Overrides: ProbDistribution.__copy__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

String representation of the DataSet

Returns:
string representation
Overrides: ProbDistribution.__str__
(inherited documentation)

__eq__(self, other)
(Equality operator)

source code 

Interface for the '==' operation

Parameters:
  • other - object to be compared
Overrides: ProbDistribution.__eq__
(inherited documentation)

pdf(self, data)

source code 

Density function. MUST accept either numpy or DataSet object of appropriate values. We use numpys as input for the atomar distributions for efficiency reasons (The cleaner solution would be to construct DataSet subset objects for the different features and we might switch over to doing that eventually).

Parameters:
  • data - DataSet object or numpy array
Returns:
log-value of the density function for each sample in 'data'
Overrides: ProbDistribution.pdf
(inherited documentation)

MStep(self, posterior, data, mix_pi=None)

source code 

Maximization step of the EM procedure. Reestimates the distribution parameters using the posterior distribution and the data.

MUST accept either numpy or DataSet object of appropriate values. numpys are used as input for the atomar distributions for efficiency reasons

Parameters:
  • posterior - posterior distribution of component membership
  • data - DataSet object or 'numpy' of samples
  • mix_pi - mixture weights, necessary for MixtureModels as components.
Overrides: ProbDistribution.MStep
(inherited documentation)

sample(self, A=None)

source code 

Samples from the mulitvariate Normal distribution.

Parameters:
  • A - optional Cholesky decomposition of the covariance matrix self.sigma, can speed up the sampling
Returns:
sampled value
Overrides: ProbDistribution.sample

sampleSet(self, nr)

source code 

Samples several values from the distribution.

Parameters:
  • nr - number of values to be sampled.
Returns:
sampled values
Overrides: ProbDistribution.sampleSet
(inherited documentation)

isValid(self, x)

source code 

Checks whether 'x' is a valid argument for the distribution and raises InvalidDistributionInput exception if that is not the case.

Parameters:
  • x - single sample in external representation, i.e.. an entry of DataSet.dataMatrix
Returns:
True/False flag
Overrides: ProbDistribution.isValid
(inherited documentation)

flatStr(self, offset)

source code 

Returns the model parameters as a string compatible with the WriteMixture/ReadMixture flat file format.

Parameters:
  • offset - number of ' ' characters to be used in the flatfile.
Overrides: ProbDistribution.flatStr
(inherited documentation)