Software Demos · Interactive demo

Model selection for the Gaussian-gated localized mixture of experts (GLoME)

Fit a Gaussian-gated mixture of experts for every candidate number of experts, then let the slope heuristic read the penalty constant off the data via the dimension jump and select the oracle model. Use the buttons beside each control (or the Run the experiments launchers) to auto-play; everything runs client-side.

Model selection for the Gaussian-gated localized mixture of experts (GLoME)

How many experts does the data support? Data come from a true K₀ = 2 component Gaussian-gated localized mixture of experts (GLoME). For every candidate K = 1..8 we fit the Gaussian-gated linear-expert family (GLLiM) by EM, then let the slope heuristic (Birge-Massart, via the capushe dimension jump) pick K. Toggle the truth between well-specified (linear experts, the family contains the truth) and misspecified (parabola experts, the linear family only approximates it). The method knows the penalty shape D(K) = 6K−1 but not its multiplicative constant κ. Slide κ and watch the selected model walk down a staircase; the dimension jump reads the right constant off the data, recovering K = 2 when well-specified and a larger K (about 3-4) when the parabola must be approximated.

Penalized model selectionSlope heuristic / dimension jumpGaussian-gated mixture of expertsNon-asymptotic oracle inequality
Data-driven penalty calibration: the dimension jump
points = sample · teal = selected-K fitted E[y|x] · dashed = true mean · faint = per-expert lines
staircase = selected dimension vs κ · amber = dimension jump κ̂ · teal = prescribed 2κ̂

The covariate x is drawn from a two-component Gaussian mixture (centers 0.2 and 0.8, variances 0.10 and 0.15), and the response follows a Gaussian-gated localized mixture of experts: the gate posterior τk(x) ∝ πk N(x; ck, Γk) picks an expert, and inside its region y = meank(x) + σ noise with σ = 0.30. In the well-specified case the two experts are linear (y = −5x + 2 and y = 0.1x); in the misspecified case they are parabolas (y = 1 − 6x + 3x² and y = −1.5x², an illustratively amplified curvature, see the note below). For each candidate K = 1..8 we fit the Gaussian-gated linear-expert family (GLLiM) by EM (a few random restarts), recording its conditional log-likelihood and its dimension D(K) = 6K − 1 (per expert: gate mean + gate variance + slope + intercept + expert variance = 5, plus K−1 mixing weights; K = 1 is a single linear regression with D(1) = 3). The paper proves a non-asymptotic oracle inequality for the penalized maximum-likelihood estimator under the Jensen-Kullback-Leibler loss: as long as the penalty is at least a known shape times a large-enough constant, the selected model performs as well as the oracle. Since the shape is known only up to a multiplicative constant κ, we select K by minimizing −logLik(K) + κ·D(K). The slope heuristic (capushe Djump) reads κ off the data: as κ grows the selected dimension collapses in a staircase, and the location κ̂ of its biggest drop (the dimension jump) is the minimal penalty. The theory prescribes κ* = 2κ̂, which recovers K = 2 when well-specified and a larger K (about 3-4) when the linear family must approximate the parabola. AIC (κ = 1) and BIC (κ = ½ log n) are marked as fixed ticks. (This is a faithful but 1D, small-n port of the author's R package NamsGLoME: the published experiments use n = 2000 and 10000 with GLLiM fitted by xLLiM and penalties calibrated by capushe over 100 trials, and the guarantee is the asymptotic-free oracle inequality, not the finite staircase you drag here. The well-specified experts are the author's exact linear coefficients; the misspecified parabola's curvature is amplified beyond the author's gentle x² / −0.4x² (which a faithful fit already approximates well with K = 2 at every sample size) so the linear-expert family visibly needs a larger order (K ≈ 3-4) here, reproducing the paper's well-vs-misspecified contrast at browser scale. In-browser EM uses few restarts, so a candidate fit can occasionally miss its global optimum and the recovered K can wobble, especially in the misspecified case at small n.)

Run the experiments

Every animation runs live in your browser. Click a button to run that experiment on the demo (it scrolls up and starts); drag any control to take over. Nothing is downloaded, it is generated on the fly.

Drag the penalty constant

Sweep the penalty constant κ and watch the selected model collapse down a staircase, with the fitted conditional-mean curve on the left changing in lockstep. The amber dimension jump κ-hat and the teal prescribed 2·κ-hat mark where the slope heuristic lands.

Grow the sample size

Increase the sample size n and refit every candidate model by EM. More data sharpens the dimension jump and makes the recovered model track K = 2 (well-specified) or a larger K, about 3-4 (misspecified) more reliably.

Turn up the expert noise

Raise the expert noise standard deviation σ. As the experts blur together the log-likelihood gains from extra experts shrink, so the slope heuristic favors a more parsimonious model.

Well-specified vs misspecified

Toggle between LINEAR experts (well-specified: the Gaussian-gated linear family contains the truth, so the slope heuristic recovers K0 = 2) and PARABOLA experts (misspecified: the oracle selects a larger K to approximate the parabola).

Draw fresh samples

Redraw the sample from the same GLoME generating model and refit all candidate K. The dimension jump and selected model shift slightly with sampling noise but stay centered on the oracle.

The idea in three steps

1 · Fit

Every candidate K

Fit the Gaussian-gated linear-expert family (GLLiM) for K = 1..8 by penalized maximum likelihood (EM). Each fit gives a conditional log-likelihood and a known dimension D(K) = 6K−1, the two ingredients the penalty needs.

2 · Calibrate

The dimension jump

The penalty shape is known, its constant κ is not. Sweep κ: the selected dimension falls in a staircase, and the κ̂ where it drops hardest is the minimal penalty the oracle inequality allows.

3 · Select

Twice the jump

The slope heuristic prescribes κ* = 2κ̂. The model chosen at κ* matches the oracle: it recovers K₀ = 2 when well-specified (linear), and the best parsimonious approximation (about K = 4) when misspecified (parabola).

For the weak oracle inequalities, the Jensen-Kullback-Leibler loss, the block-diagonal-covariance localized experts and the high-dimensional theory, see A non-asymptotic approach for model selection via penalization in high-dimensional mixture of experts models (TrungTin Nguyen, Ho, Nguyen, Chamroukhi, Forbes, Electronic Journal of Statistics).