Repository navigation
You have a model, or several, and a stream of scored predictions. After each
new observation you look at the running error. You want an upper bound on the
true error that stays valid however often you look and whichever model you
end up choosing.
v0.4.0 proves such a bound for observations drawn independently from any
probability distribution, including real-valued ones. Earlier versions
required the observations to take finitely many values. The loss is any
measurable function with values in [0, 1], for example squared error on
[0, 1].
The main theorem
exists_generalInfiniteEmpiricalBernstein_event
gives one event of probability at most delta. Outside it, for every sample
size n >= 2 and every posterior that is absolutely continuous with respect
to the prior with an integrable log-likelihood ratio, the posterior risk is
below
Rhat_n + (5/2) sqrt(Vhat_n L_n / n) + 5 L_n / n
Here Rhat_n is the posterior average of the observed mean loss, Vhat_n is
the posterior average of the Bessel variance of the first n losses, and
L_n = KL + log(r (r + 1)^2 / delta) with r = floor(log2 n). The constants
and the complexity term are those of the finite-observation theorem, whose
statement is now derived from this one.
Use the theorem from another Lean package
The downstream example
imports FormalSLT.PACBayes and proves
Downstream.SelectedModel.selectedRiskBound. Two models are scored on the
same observations, and at each sample size the one with the lower observed
mean loss is chosen. One event bounds the risk of the chosen model at every
n >= 2, and the choice costs log 2.
Run the example from a checkout of this version with Lean 4.32.2:
make downstreamReplay the bound on data
From the repository root:
python3 benchmark/general_observation_empirical_bernstein.pyThe script evaluates the bound at every sample size on real-valued streams,
including rows resampled from the tracked occupancy predictions, and writes
the replay report.
Its numbers are floating-point evidence about one transcription of the
theorem. They are not a Lean proof check.
Other additions since v0.3.0
- A model chosen after looking at the data, among
Kmodels with a uniform
prior, payslog K.
Finite-hypothesis theorems - The same bound holds for the Gibbs posterior on an arbitrary hypothesis
space. The temperature may depend on the data and onn, and for a
nonnegative temperaturelamthe divergence term is at mostlam.
Gibbs posterior theorems - A forward bound covers the same setting with confidence term
log(1/delta)at one tilt. With the tilt selected from a geometric catalog
nothing is tuned, and the width is one square-root expression at every
n >= 4.
Forward theorems - Each numerical receipt states the guarantee of its theorem for one event,
shows that the exhibited path lies off that event, and proves a rational
ceiling on the right-hand side at that path. The checked ceilings are
7/20for a Gibbs posterior with a density, and29/100and3/10for
the forward bounds.
Gibbs receipt ·
forward receipts - The overview film is now a
38-second introduction in plain words, and the README opens by saying what
the library is.
The library has 8,855 theorems and lemmas, up from 8,579 in v0.3.0. The Lean
4.32.2 toolchain and the Mathlib pin are unchanged. The four supported topic
imports and the 19 declarations in the v0.2 signature snapshot carry forward.
The
API policy names the entry points that joined the topic
imports in this version and describes the scope of patch-level compatibility.
Use the citation metadata when citing this version and
the release checklist for tag verification
and archival packaging.
Release verification
- Merge commit
022a6afd84a1eb73c76472586bfa15e97bda4f45 - Git tree
8046ed406050fb4bab5f6474d31a14776272ad1e - Annotated tag object
8b7cea045e6632519ee1262cdb7bea4ebe6cf9c3
The attached source and documentation archives, release manifest and SHA-256 checksums are from the verified tag workflow. Both Linux and macOS installed the tagged library and built the downstream examples.