polars_online.sim¶
A seeded simulator of streams whose correlation changes by regime.
The detectors in this library (deco, hmm, corrchange, bocpd)
make claims about streams whose correlation structure changes. Such a claim can
only be measured against data whose truth is known. regimes() produces
that data from one seed, and hands back the truth beside it. The truth has to
include the awkward parts of real streams, and each is a parameter:
the awkward part |
the parameter |
|---|---|
series that report at their own times |
|
levels observed with additive noise |
|
autocorrelated increments |
|
a scale that moves with the regime |
|
a periodic pattern in the correlation |
|
an activity clock |
|
Everything is drawn from numpy.random.default_rng(seed) in one order, so
two calls with the same seed give byte-identical frames under one numpy
version. numpy’s Generator makes no promise across versions. The module
needs numpy, an optional extra of this package
(pip install polars-online[numpy]), and nothing else.
Warning
This module is considered unstable: its keywords, its frames and the
draws behind them may change in any release without that counting as a
breaking change. Under POLARS_ONLINE_WARN_UNSTABLE=1 each call issues
polars_online.UnstableWarning.
Simulation¶
A seeded simulator of correlation regimes.
Simulate a stream of |