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

Class ConditionalGaussDistribution

source code


Constructor for conditional Gauss distributions. Conditional Gaussians use a sparse formulation of the covariance matrix, which allows computationally efficient modeling of covariance for high-dimensional data.

Also, the conditional Gaussians implement a tree dependency structure.

(XXX add reference XXX)

Instance Methods [hide private]
 
__init__(self, p, mu, w, sigma, parents)
Constructor
source code
 
__str__(self)
String representation of the DataSet
source code
 
sample(self)
Samples a single value from the distribution.
source code
 
sampleSet(self, nr)
Samples several values from the distribution.
source code
 
pdf(self, data)
Density function.
source code
 
MStep(self, posterior, data, mix_pi=None)
Maximization step of the EM procedure.
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

Inherited from ProbDistribution: __copy__, __eq__, flatStr, formatData, merge, posteriorTraceback, sufficientStatistics, update_suff_p

Method Details [hide private]

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

source code 

Constructor

Parameters:
  • p - dimensionality of the distribution
  • mu - mean parameter vector
  • w - covariance weights (representing off-diagonal entries in the full covariance matrix)
  • sigma - standard deviations (diagonal entries of the covariance matrix)
  • parents - parents in the tree structure implied by w
Overrides: ProbDistribution.__init__

__str__(self)
(Informal representation operator)

source code 

String representation of the DataSet

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

sample(self)

source code 

Samples a single value from the distribution.

Returns:
sampled value
Overrides: ProbDistribution.sample
(inherited documentation)

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)

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)

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)