SufficientStats API¶
SufficientStats is the accumulator the GaussianMixture M-step reads
from (nk, s1, s2, n_samples); see the sufficient-statistics
design
doc
for the derivation. Most users won't construct one directly -- it's public
mainly so later mixture families and streaming/mini-batch fitting can
share the same accumulator type.
SufficientStats
dataclass
¶
Accumulated sufficient statistics for one (chunk of a) mixture E-step,
per component :math:k.
Attributes:
| Name | Type | Description |
|---|---|---|
nk |
(Tensor, shape(n_components))
|
:math: |
s1 |
(Tensor, shape(n_components, n_features))
|
:math: |
s2 |
Tensor
|
Covariance-type-specific second moment, centered on each
component's empirical mean :math: |
n_samples |
int
|
Number of rows this instance summarizes. |
aux |
(dict[str, Tensor], optional)
|
Family-specific accumulators that don't fit the Gaussian-shaped
|
Source code in tgmm/stats.py
Methods:¶
scale(factor)
¶
Scale nk/s1/s2/aux by factor; n_samples is
left untouched since it tracks how many physical rows contributed,
not a quantity meaningful to reweight. Used by online/mini-batch EM
(Phase 2) to blend a running accumulator with a new batch's
statistics.