TimeGym source notebooks¶
These 15 notebooks are TimeGym's source code. Each one explains a part of the
package and holds the implementation cells that tools/export_notebooks.py
writes into timegym/. The source map gives each of the 25
package modules one owning notebook. To use TimeGym rather than change it, read
the tutorials instead.
The 11 original notebooks from 2021 keep the development history and saved figures at the v1.4.0 tag in Git. They are not part of the current tree, source distributions or notebook checks; the 15 source notebooks and the 12 tutorials are.
Open and edit¶
From a clone or extracted source distribution:
python -m pip install -e '.[notebooks]'
python -m jupyterlab source
The source notebooks combine reasoning, editable implementation cells, examples, and plots. Implementation cells are collapsed for reading; expand them to work on the code.
| Source notebook | Responsibility |
|---|---|
| 01 · Synthetic data | Recipes for test series and their answer keys: six kinds of series, what the model sees, measurement noise |
| 02 · Real data | Freeze a stock download in a snapshot; test three simple rules on a hidden year of airline passengers |
| 03 · Smoothing | Trailing averages: how long a window, why a centered one leaks the future, exponential weights |
| 04 · Feature engineering | Inputs known at forecast time: past values as columns, cycles as circles, calendar columns |
| 05 · Target engineering | Differences, logs and Box-Cox: when forecasting the changes helps, and how a forecast is turned back without a bias |
| 06 · Forecasting models | Built-in baselines, which one to beat, and three ways to turn a regressor into a forecaster |
| 07 · Pipeline | test, predict, scorecard and run: a fresh model for every case, runs kept for plots, your own cases and forecasts made elsewhere |
| 08 · Forecast contracts | What a model sees and returns, the five output checks, what sample paths say that quantiles can't, and your own series cut into cases |
| 09 · Metrics and diagnostics | Which metric to read, why the answer key settles comparisons sooner, metrics for yes/no outcomes and your own metrics, whether one forecaster beats another, checks of your own, whether yes/no chances are honest, the five verdicts, and what each check catches |
| 10 · Reports and replay | Read a report, gate CI on it, save and load it strictly, and replay a case months later |
| 11 · Plotting | Forecast panels, error histograms and reliability diagrams: read a forecast against the answer key, find the draws a model gets wrong |
| 12 · Package | Shared guards, which notebook owns each public name, and how an edit becomes package code |
| 13 · Scorecard | How the scorecard is built and read: ten patterns at two noise levels, the score, named mistakes, seeds, a kind of series of your own |
| 14 · Controlled processes | Series built one ingredient at a time, plus jumps, calm and stormy periods and hidden regimes, each with its answer key |
| 15 · Joint controlled processes | Several series with declared links: shared jumps, one hidden regime, CCC-GARCH, and links zero correlation misses |
Develop the package here¶
Save notebook edits, then follow Contributing and the build guide: export, check, test.
Execute and review¶
python tools/check_notebooks.py
python tools/check_notebooks.py --group source
python tools/check_notebooks.py --group tutorials
python tools/check_notebooks.py --group examples
python tools/check_notebooks.py --write --html-dir /tmp/timegym-notebooks
The checker runs the source notebooks, the tutorials and the
examples in fresh kernels with
the invoking Python interpreter. It clears old outputs before execution, rejects
uncaught errors and skipped code. --write saves the
executed outputs; the HTML option makes plot and narrative review convenient. A
single notebook path can also be passed to the checker while developing it.
Historical themes that remain unfinished are identified in the archive guide at the v1.4.0 tag.