Skip to content
svgensemble-spread

Ensemble spread

Where do the members of an ensemble disagree, and does the band hold the actual values?

Demo data · seed 20261101 · 200 rows · default settings · 640 × 360SVG, lightSVG, darkDemo CSV

How to read it

  1. Read the x axis as rows ordered by the ensemble's prediction, lowest on the left.
  2. Read the grey dots at one position as the members' predictions for that row; a tall column means they disagree.
  3. Compare the ticks (actual values) with the shaded band: the legend says what share of them it holds.
  1. Callout 1: Members agree: the dots sit on the line.
  2. Callout 2: Members spread out: the model is unsure here.
  3. Callout 3: Shaded band around the consensus line.

Watch out

  • These are training rows, so the band looks better here than on new data; judge coverage from the held-out 90% coverage metric.
  • TabM's members share most weights, so their spread understates uncertainty; read it as disagreement, not as an interval.

Defaults

Member dots
On
Show each member's prediction as a dot.

Pinned in the code

  • Draws the numbers the learner published (training history, member predictions, predicted densities); the chart computes nothing statistical.
  • The band is whatever the learner published: a deep ensemble's mixture interval (mean ± 1.645 SD, 90% if Normal) or the members' lowest-to-highest range for TabM.
  • Rows are training rows, evenly spaced in the order of the ensemble's prediction; read held-out coverage from the run's metrics, not from this picture.
# Ensemble spread — Codesplash Chart Lab (recipe "ensemble-spread")
# controls: members=true
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

try:
    import codesplash as cs  # optional: the app's chart theme
except ImportError:
    cs = None
if cs:
    cs.use_codesplash(dark=False)
PALETTE = cs.palette(dark=False)["categorical"] if cs else plt.rcParams["axes.prop_cycle"].by_key()["color"]

df = pd.read_csv("ensemble-spread-demo.csv", keep_default_na=False, na_values=[""])  # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV
df["member"] = pd.Categorical(df["member"].astype("string"), categories=["member 1", "member 2", "member 3", "member 4", "member 5"])

_tokens = cs.palette(dark=False) if cs else {}
SEQ = _tokens.get("sequential", ["#eff6fd", "#1a469d"])  # sequential ramp (low → high)
DIV = _tokens.get("diverging", ["#c13e2e", "#f3f5f8", "#0859ac"])  # negative, midpoint, positive
REF = _tokens.get("reference", "#4e5661")
GREY = _tokens.get("dim", "#ced1d6")
X = "row (ordered by prediction)"
Y = "member prediction"
C = "ensemble"
LO = "90% low"
HI = "90% high"
A = "actual"
SHOW_MEMBERS = True
rows = df.drop_duplicates(subset=[X]).sort_values(X)  # one row per position: consensus, band, actual
fig, ax = plt.subplots(figsize=(7, 4.2))
if LO and HI:
    ax.fill_between(rows[X], rows[LO], rows[HI], color=PALETTE[0], alpha=0.18, linewidth=0, label="band")
if SHOW_MEMBERS:
    ax.scatter(df[X], df[Y], s=6, color=GREY, alpha=0.9, label="members")
ax.plot(rows[X], rows[C], color=PALETTE[0], linewidth=1.6, label=C)
if A:
    ax.scatter(rows[X], rows[A], marker="_", s=70, color=REF, linewidths=1.5, label=A)
ax.set_xlabel(X)
ax.set_ylabel(Y)
ax.legend(frameon=False, fontsize=8)
plt.show()

Needs pandas, numpy, matplotlib · reads ensemble-spread-demo.csv · app theme from the optional codesplash helper