Inheritance diagram for nipy.neurospin.clustering.ggmixture:
One-dimensional Gamma-Gaussian mixture density classes : Given a set of points the algo provides approcumate maximum likelihood estimates of the mixture distribution using an EM algorithm.
Author: Bertrand Thirion and Merlin Keller 2005-2008
Bases: object
The basic one dimensional Gamma-Gaussian-Gamma Mixture estimation class, where the first gamma has a negative sign, while the second one has a positive sign.
7 parameters are used: - shape_n: negative gamma shape - scale_n: negative gamma scale - mean: gaussian mean - var: gaussian variance - shape_p: positive gamma shape - scale_p: positive gamma scale - mixt: array of mixture parameter (weights of the n-gamma,gaussian and p-gamma)
Methods
Estep | |
Mstep | |
ROC | |
SAEM | |
check | |
component_likelihood | |
estimate | |
init | |
init_fdr | |
parameters | |
posterior | |
show |
Initialization of the class
Parameters : | - shape_n=1, scale_n=1: parameters of the nehative gamma : Note that they should be positive : - mean=0,var=1: parameters of the gaussian : var>0 : - shape_p=1, scale_p=1: parameters of the positive gamma : Note that they should be positive : - mixt=np.array([1.0,1.0,1.0])/3 the mixing proportions : they should be positive and sum to 1 : |
---|
E step: update probabilistic memberships of the three components
Parameters : | x: array of shape (nbitems,) :
|
---|---|
Returns : | z: ndarray of shape (nbitems, 3) :
|
Notes
Mstep of the estimation: Maximum likelihood update the parameters of the three components
Parameters : | x: array of shape (nbitem,) :
z: array of shape (nbitems,3) :
|
---|
ROC curve for seperating positive Gamma distribution from two other modes, predicted by current parameter values -x: vector of observations
Output: P P[0]: False positive rates P[1]: True positive rates
SAEM estimation procedure:
Parameters : | x: ndarray :
burnin: integer, optional :
niter: integer, optional :
verbose: 0 or 1 :
|
---|---|
Returns : | LL: ndarray :
|
Notes
The Gaussian disribution mean is fixed to zero
Not implemented yet
Compute the likelihood of the data x under the three components negative gamma, gaussina, positive gaussian
Parameters : | x: array of shape (nbitem,) :
|
---|---|
Returns : | ng,y,pg: three arrays of shape(nbitem) :
|
Whole EM estimation procedure:
Parameters : | x: array of shape (nbitem) :
niter: integer, optional :
delta: float, optional :
bias: float, optional :
gaussian_mix: float, optional :
verbose: 0, 1 or 2 :
|
---|---|
Returns : | z: array of shape (nbitem, 3) :
|
initialization of the differnt parameters
Initilization of the class based on a fdr heuristic: the probability to be in the positive component is proportional to the ‘positive fdr’ of the data. The same holds for the negative part. The point is that the gamma parts should model nothing more that the tails of the distribution.
Parameters : | x: array of shape(nbitem) :
dof: integer, optional :
copy: boolean, optional :
|
---|
Simply print the parameters
Compute the posterior probability of the three components given the data
Parameters : | x: array of shape (nbitem,) :
|
---|---|
Returns : | ng,y,pg: three arrays of shape(nbitem) :
|
Vizualization of the mixture, superimposed on the empirical histogram of x
Parameters : | x: ndarray of shape (nditem,) :
mpaxes: matplotlib axes, optional :
|
---|
Bases: object
This is the basic one dimensional Gaussian-Gamma Mixture estimation class Note that it can work with positive or negative values, as long as there is at least one positive value. NB : The gamma distribution is defined only on positive values.
5 scalar members - mean: gaussian mean - var: gaussian variance (non-negative) - shape: gamma shape (non-negative) - scale: gamma scale (non-negative) - mixt: mixture parameter (non-negative, weight of the gamma)
Methods
Estep | |
Mstep | |
estimate | |
parameters | |
posterior | |
show |
E step of the estimation: Estimation of ata membsership
Parameters : | x: array of shape (nbitems,) :
|
---|---|
Returns : | z: array of shape (nbitrems,2) :
|
Mstep of the model: maximum likelihood estimation of the parameters of the model
Complete EM estimation procedure
Parameters : | x: array of shape(nbitems): the data to be processed : niter = 100: max nb of iterations : delta = 0.001: criterion for convergence : |
---|---|
Returns : | LL, float, average final log-likelihood : |
print the paramteres of self
Compute the posterior probability of observing the data x under the two components
Parameters : | x: array of shape (nbitems,) :
|
---|---|
Returns : | y,pg : arrays of shape (nbitem)
|
vizualisation of the mm based on the empirical histogram of x
Parameters : | x: array of shape(nbitems): the data to be processed : |
---|
Bases: object
This is the basic one dimensional Gaussian-Gamma Mixture estimation class Note that it can work with positive or negative values, as long as there is at least one positive value. NB : The gamma distribution is defined only on positive values. 5 parameters are used: - mean: gaussian mean - var: gaussian variance - shape: gamma shape - scale: gamma scale - mixt: mixture parameter (weight of the gamma)
Methods
check | |
estimate | |
parameters |
ML estimation of the Gamma parameters