surrogates

Surrogate alarm-time generators for chance-baseline comparisons (IoC).

Each surrogate takes a description of the recording and returns synthetic alarm times. Used by forecasting metrics to estimate Improvement-over- Chance.

Built-in surrogates: - poisson: uniform-random alarm times at matched rate - periodic: alarms on a fixed period (circadian-style) - persistence:alarm fires every X seconds since the last seizure

scitex_seizure_metrics.surrogates.circadian(n_alarms, total_seconds, rng, period_seconds=86400.0)[source]

Alarms entrained to a 24-h cycle at a random phase.

Stand-in for circadian-only forecasters (Karoly 2017): if a method cannot beat regular daily ticks, it has no signal beyond the clock.

Parameters:
Return type:

ndarray

scitex_seizure_metrics.surrogates.from_history(n_alarms, total_seconds, rng, seizure_history_seconds=None)[source]

Alarm at every (last_seizure + mean_interval) — Karoly 2019 style.

Requires seizure_history_seconds (the past seizure timestamps in the same recording). Falls back to uniform-random if no history given.

Parameters:
Return type:

ndarray

scitex_seizure_metrics.surrogates.get(name)[source]
Parameters:

name (str)

Return type:

Callable[[int, float, Generator], ndarray]

scitex_seizure_metrics.surrogates.multidien(n_alarms, total_seconds, rng, period_seconds=604800.0)[source]

Alarms entrained to a multi-day cycle (default 7 days).

Karoly 2018 / Proix 2021 baseline — a method that exploits no per- seizure signal but tracks the multidien rhythm.

Parameters:
Return type:

ndarray

scitex_seizure_metrics.surrogates.periodic(n_alarms, total_seconds, rng)[source]

Equally-spaced alarms with a random phase offset.

Stand-in for circadian-only forecasters (Karoly 2017): if a method can’t beat regular ticks, the forecaster has no signal beyond the daily clock.

Parameters:
Return type:

ndarray

scitex_seizure_metrics.surrogates.persistence(n_alarms, total_seconds, rng)[source]

Single alarm at a random time. Models ‘always predict at last known seizure’ style baselines collapsed to one decision.

Parameters:
Return type:

ndarray

scitex_seizure_metrics.surrogates.poisson(n_alarms, total_seconds, rng)[source]

Uniform-random alarm times. The classic null model.

Parameters:
Return type:

ndarray

scitex_seizure_metrics.surrogates.register(name)[source]

Decorator to register a surrogate generator.

Parameters:

name (str)