Package csb :: Package statistics :: Module mixtures :: Class GaussianMixture |
[frames] | no frames]

# Class GaussianMixture

source code

    object --+
             |
            GaussianMixture

Known Subclasses:
  - AbstractStructureMixture

Gaussian mixture model for multi-dimensional data.

Instance Methods
__init__(self, X, K, train=True, axis=None) x.__init__(...) initializes x; see help(type(x)) for signature | source code
anneal(self, betas) Deterministic annealing | source code
numpy array |
datapoint(self, m, k) Training point number `m` as if it would belong to component `k` | source code
del_cache(self) Clear model parameter cache (force recalculation) | source code
e_step(self, beta=1.0) Expectation step for EM | source code
em(self, n_iter=100, eps=1e-30) Expectation maximization | source code
estimate_means(self) Update means from current model and samples | source code
estimate_scales(self, beta=1.0) Update scales from current model and samples | source code
GaussianMixture subclass |
increment_K(self, train=True) Split component with largest sigma | source code
m_step(self) Maximization step for EM | source code
float in interval [0.0, 1.0] |
overlap(self, other) Similarity of two mixtures measured in membership overlap | source code
randomize_means(self) Pick `K` samples from `X` as means | source code
randomize_scales(self, ordered=True) Random `scales` initialization | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Methods
GaussianMixture subclass |
new(cls, X, K=0) Factory method with optional `K`. | source code
generator |
series(cls, X, start=1, stop=9) Iterator with mixture instances for `K in range(start, stop)` | source code

Class Variables
| ALPHA_SIGMA = `0.0001`
| BETA_SIGMA = `0.01`
| MIN_SIGMA = `0.0`
| use_cache = `True`

Properties
float | BIC Bayesian information criterion, calculated as BIC = M * ln(sigma_e^2) + K * ln(M)
int | K Number of components
int | M Number of data points
int | N Length of component axis
(N, K) numpy array | delta Squared "distances" between data and components
int | dimension Dimensionality of the mixture domain
float | log_likelihood Log-likelihood of the extended model (with indicators)
float | log_likelihood_reduced Log-likelihood of the marginalized model (no auxiliary indicator variables)
(K, ...) numpy array | means
(N,) numpy array | membership Membership array
(K, N) numpy array | scales
(K,) numpy array | sigma Component variations
(K,) numpy array | w Component weights
Inherited from `object`: `__class__`

Method Details

### __init__(self, X, K, train=True, axis=None) (Constructor) | source code
x.__init__(...) initializes x; see help(type(x)) for signature Parameters: `X` ((M,...) numpy array) - multi dimensional input vector with samples along first axis `K` (int) - number of components `train` (bool) - train model `axis` (int) - component axis in `X` Overrides: object.__init__

### anneal(self, betas) | source code
Deterministic annealing Parameters: `betas` (iterable of floats) - sequence of inverse temperatures

### e_step(self, beta=1.0) | source code
Expectation step for EM Parameters: `beta` (float) - inverse temperature

### em(self, n_iter=100, eps=1e-30) | source code
Expectation maximization Parameters: `n_iter` (int) - maximum number of iteration steps `eps` (float) - log-likelihood convergence criterion

### estimate_scales(self, beta=1.0) | source code
Update scales from current model and samples Parameters: `beta` (float) - inverse temperature

### increment_K(self, train=True) | source code
Split component with largest sigma Returns: GaussianMixture subclass new instance of mixture with incremented `K`

### new(cls, X, K=0) Class Method | source code
Factory method with optional `K`. If `K=0`, guess best `K` according to BIC. Parameters: `X` ((M,...) numpy array) - multi dimensional input vector with samples along first axis Returns: GaussianMixture subclass Mixture instance

### overlap(self, other) | source code
Similarity of two mixtures measured in membership overlap Parameters: `other` (GaussianMixture or sequence) - Mixture or membership array Returns: float in interval [0.0, 1.0] segmentation overlap

### series(cls, X, start=1, stop=9) Class Method | source code
Iterator with mixture instances for `K in range(start, stop)` Parameters: `X` ((M,...) numpy array) `stop` (int) `start` (int) Returns: generator

Property Details

### BIC Bayesian information criterion, calculated as BIC = M * ln(sigma_e^2) + K * ln(M) Get Method: unreachable.BIC(self) - Bayesian information criterion, calculated as BIC = M * ln(sigma_e^2) + K * ln(M) Type: float

### K Number of components Get Method: unreachable.K(self) - Number of components Type: int

### M Number of data points Get Method: unreachable.M(self) - Number of data points Type: int

### N Length of component axis Get Method: unreachable.N(self) - Length of component axis Type: int

### delta Squared "distances" between data and components Get Method: unreachable.delta(self) - Squared "distances" between data and components Type: (N, K) numpy array

### dimension Dimensionality of the mixture domain Get Method: unreachable.dimension(self) - Dimensionality of the mixture domain Type: int

### log_likelihood Log-likelihood of the extended model (with indicators) Get Method: unreachable.log_likelihood(self) - Log-likelihood of the extended model (with indicators) Type: float

### log_likelihood_reduced Log-likelihood of the marginalized model (no auxiliary indicator variables) Get Method: unreachable.log_likelihood_reduced(self) - Log-likelihood of the marginalized model (no auxiliary indicator variables) Type: float

### means Get Method: unreachable.means(self) Set Method: unreachable.means(self, means) Type: (K, ...) numpy array

### membership Membership array Get Method: unreachable.membership(self) - Membership array Type: (N,) numpy array

### scales Get Method: unreachable.scales(self) Set Method: unreachable.scales(self, scales) Type: (K, N) numpy array

### sigma Component variations Get Method: unreachable.sigma(self) - Component variations Type: (K,) numpy array

### w Component weights Get Method: unreachable.w(self) - Component weights Type: (K,) numpy array