A mixture model represents data as coming from several hidden groups. Instead of assigning observations to known categories, it infers subpopulations whose distributions combine to explain the observed pattern. section 8.0 section 8.12
Think of shoppers as bargain hunters or brand loyalists, or eruption waits as short or long. Each component has a weight, center, and width; together, these describe the overall distribution. Bayesian treatment represents these quantities as uncertain and can estimate each observation’s membership probabilities. section 8.0 section 8.4 section 8.8
Old Faithful waiting times
Standardized waiting times show two modes: short waits and long waits. A two-component Gaussian mixture learns their centers, spreads, and prevalence, then estimates how likely a particular waiting time belongs to either cluster. Posterior predictive samples provide a check that the fitted mixture can reproduce the observed distribution. section 8.3 section 8.8
with pm.Model(
coords={"cluster": np.arange(K)} #A
) as dp_model:
beta = pm.Beta(
"beta", alpha=1, beta=1, dims="cluster"
) #B
w = pm.Deterministic(
"w", stick_breaking(beta), dims="cluster"
) #C
Inspect the PyMC setup for a truncated stick-breaking mixture, where Beta variables generate component weights. section 8.10
When the number of groups is unknown, stick-breaking supplies a prior that allows infinitely many components while leaving only a few with meaningful weight in practice. Computation truncates the process at a finite upper bound; the concentration parameter controls whether weight favors fewer large clusters or many smaller ones. section 8.10 section 8.12

