Skip to content
svgchangepoint-timeline

Change-points on a timeline

When did this monitored metric shift, and which detectors noticed?

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

How to read it

  1. Read the line as one metric across monitor runs, oldest on the left.
  2. A dashed line marks a run where a detector signalled; its label says which one, or how many.
  3. Online detectors signal a little after a shift, so look at the runs just before a mark.
  1. Callout 1: A detector signalled at this run.
  2. Callout 2: The stable level before the shift.

Watch out

  • A signal is a reason to look, not proof that something changed: stable series still false-alarm a few percent of the time.
  • With fewer than 8 runs the detectors stay silent, which says nothing about whether the metric moved.

Defaults

No settings: the chart draws one way.

Pinned in the code

  • Draws the host's numbers as given; the chart computes nothing statistical.
  • Online detectors (Page–Hinkley, CUSUM) mark the run at which they first noticed, a little after the shift; Pettitt marks the first run after its single shift; ADWIN marks the run at which it dropped older runs.
  • A signal is a reason to look, not proof: over 50 stable runs Page–Hinkley and CUSUM still false-alarm a few percent of the time.
# Change-points on a timeline — Codesplash Chart Lab (recipe "changepoint-timeline")
# controls: defaults
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("changepoint-timeline-demo.csv", keep_default_na=False, na_values=[""])  # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV
df["run"] = pd.to_datetime(df["run"])

T = "run"
V = "PSI of tenure"
M = "detectors"
d = df.dropna(subset=[T, V]).sort_values(T)
fig, ax = plt.subplots(figsize=(8, 4))
if M:
    for _, row in d[d[M].fillna("").astype(str).str.len() > 0].iterrows():
        ax.axvline(row[T], color="#c0392b", linestyle="--", linewidth=1)
        ax.annotate(str(row[M]), (row[T], 1), xycoords=("data", "axes fraction"), xytext=(3, -10), textcoords="offset points", fontsize=8, color="#c0392b")
ax.plot(d[T], d[V], marker="o", markersize=3)
ax.set_xlabel(T)
ax.set_ylabel(V)
plt.show()

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