GaussianMixture ¶
Mixture of Gaussians fitted by expectation-maximization.
A smooth reference for one variable (NormalScore(reference=...)) or for
several, e.g. two mineral associations that one Gaussian cannot represent.
Rows may miss variables (NaN): each weighs the components by its present
entries. The components start from a k-means++ clustering drawn from
seed, so a seed gives one fit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
components
|
int
|
Number of Gaussians; by default the count from 1 to |
required |
max_components
|
int
|
|
6
|
seed
|
int
|
|
0
|
Attributes:
| Name | Type | Description |
|---|---|---|
proportions_ |
(ndarray, shape(k))
|
|
means_ |
(ndarray, shape(k, d))
|
|
covariances_ |
(ndarray, shape(k, d, d))
|
|
bic_ |
dict
|
Bayesian information criterion by number of components fitted. |
fit
method descriptor
¶
fit(data, *, weights=None)
Fits the mixture.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
(array_like, shape(n) or (n, d))
|
One variable or |
required |
weights
|
array_like
|
Declustering weights of the rows. |
None
|
from_json
staticmethod
¶
from_json(text)
Reads to_json output; raises InvalidInput on another class's JSON
or a newer format.
predict
method descriptor
¶
predict(data)
Most probable component of each row given its present entries.
sample
method descriptor
¶
sample(n, *, seed=0)
n rows drawn from the mixture, shape (n, d); the same seed gives
the same rows.
used in