Inheritance diagram for nipy.algorithms.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(x) | Update probabilistic memberships of the three components |
Mstep(x, z) | Mstep of the estimation: |
component_likelihood(x) | Compute the likelihood of the data x under |
estimate(x[, niter, delta, bias, verbose, ...]) | Whole EM estimation procedure: |
init(x[, mixt]) | initialization of the differnt parameters |
init_fdr(x[, dof, copy]) | 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. |
parameters() | Print the parameters |
posterior(x) | Compute the posterior probability of the three components |
show(x[, mpaxes]) | Vizualization of the mixture, superimposed on the empirical |
Constructor
Parameters : | shape_n : float, optional scale_n: float, optional :
mean : float, optional var : float, optional
shape_p : float, optional scale_p : float, optional
mixt : array of shape (3,), optional
|
---|
Update probabilistic memberships of the three components
Parameters : | x: array of shape (nbitems,) :
|
---|---|
Returns : | z: ndarray of shape (nbitems, 3) :
|
Notes
z[0,:] is the membership the negative gamma z[1,:] is the membership of the gaussian z[2,:] is the membership of the positive gamma
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) :
|
---|
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
Parameters : | x: array of shape(nbitems) :
mixt : None or array of shape(3), optional
|
---|
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 :
|
---|
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) :
|
Notes
ng + y + pg = np.ones(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(x) | E step of the estimation: |
Mstep(x, z) | Mstep of the model: maximum likelihood |
estimate(x[, niter, delta, verbose]) | Complete EM estimation procedure |
parameters() | print the paramteres of self |
posterior(x) | Posterior probability of observing the data x for each component |
show(x) | vizualisation of the mm based on the empirical histogram of x |
E step of the estimation: Estimation of ata membsership
Parameters : | x: array of shape (nbitems,) :
|
---|---|
Returns : | z: array of shape (nbitems, 2) :
|
Mstep of the model: maximum likelihood estimation of the parameters of the model
Parameters : | x : array of shape (nbitems,)
z array of shape(nbitrems, 2) :
|
---|
Complete EM estimation procedure
Parameters : | x : array of shape (nbitems,)
niter : int, optional
delta : float, optional
verbose : bool, optional
|
---|---|
Returns : | LL, float :
|
print the paramteres of self
Posterior probability of observing the data x for each component
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,)
|
---|
Bases: object
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(x) | |
estimate(x[, eps]) | ML estimation of the Gamma parameters |
parameters() |
ML estimation of the Gamma parameters