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

Class MixtureModelPrior

source code


Mixture model prior.

Instance Methods [hide private]
 
__init__(self, structPrior, nrCompPrior, piPrior, compPrior)
Constructor
source code
 
__str__(self)
String representation of the DataSet
source code
 
__eq__(self, other)
Interface for the '==' operation
source code
 
__copy__(self)
Interface for the copy.copy function
source code
 
pdf(self, mix)
Returns the log-density of the ProbDistribution object(s) 'm' under the prior.
source code
 
mapMStep(self, dist, posterior, data, mix_pi=None, dist_ind=None)
Maximization step of the maximum aposteriori EM procedure.
source code
 
updateHyperparameters(self, dists, posterior, data)
Update the hyperparameters in an empirical Bayes fashion.
source code
 
flatStr(self, offset)
Returns the model parameters as a string compatible with the WriteMixture/ReadMixture flat file format.
source code
 
posterior(self, dist) source code
 
isValid(self, m)
Checks whether 'x' is a valid argument for the distribution and raises InvalidDistributionInput exception if that is not the case.
source code
 
structPriorHeuristic(self, delta, N)
Heuristic for setting the structure prior hyper-parameter 'self.structPrior', depending on the size of a data set 'N' and parameter 'delta'.
source code
 
mapMStepMerge(self, group_list)
Computes the MAP parameter estimates for a candidate merge in the structure learning based on the information of two CandidateGroup objects.
source code

Inherited from PriorDistribution: mapMStepSplit, marginal

Inherited from ProbDistribution: MStep, formatData, merge, posteriorTraceback, sample, sampleSet, sufficientStatistics, update_suff_p

Method Details [hide private]

__init__(self, structPrior, nrCompPrior, piPrior, compPrior)
(Constructor)

source code 

Constructor

Parameters:
  • structPrior - hyperparameter over structure complexity (0< structPrior < 1), stored on log scale internally
  • nrCompPrior - hyperparameter over number of components (0< nrCompPrior < 1), stored on log scale internally
  • piPrior - DirichletPrior object
  • compPrior - list of PriorDistribution objects
Overrides: ProbDistribution.__init__

__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)

__copy__(self)

source code 

Interface for the copy.copy function

Overrides: ProbDistribution.__copy__
(inherited documentation)

pdf(self, mix)

source code 

Returns the log-density of the ProbDistribution object(s) 'm' under the prior.

Parameters:
  • m - single appropriate ProbDistribution object or list of ProbDistribution objects
Returns:
log-value of the density function for each sample in 'data'
Overrides: ProbDistribution.pdf
(inherited documentation)

mapMStep(self, dist, posterior, data, mix_pi=None, dist_ind=None)

source code 

Maximization step of the maximum aposteriori EM procedure. Reestimates the distribution parameters of argument 'dist' using the posterior distribution, the data and a conjugate prior.

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

Parameters:
  • dist - distribution whose parameters are to be maximized
  • posterior - posterior distribution of component membership
  • data - DataSet object or 'numpy' of samples
  • mix_pi - mixture weights, necessary for MixtureModels as components.
  • dist_ind - optional index of 'dist', necessary for ConditionalGaussDistribution.mapMStep (XXX)
Overrides: PriorDistribution.mapMStep
(inherited documentation)

updateHyperparameters(self, dists, posterior, data)

source code 

Update the hyperparameters in an empirical Bayes fashion.

Parameters:
  • dists - list of ProbabilityDistribution objects
  • posterior - numpy matrix of component membership posteriors
  • data - DataSet object
Overrides: PriorDistribution.updateHyperparameters
(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)

posterior(self, dist)

source code 
Overrides: PriorDistribution.posterior

isValid(self, m)

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)

mapMStepMerge(self, group_list)

source code 

Computes the MAP parameter estimates for a candidate merge in the structure learning based on the information of two CandidateGroup objects.

Parameters:
  • group_list - list of CandidateGroup objects
Returns:
CandidateGroup object with MAP parameters
Overrides: PriorDistribution.mapMStepMerge
(inherited documentation)