pyepilepsy.metrics.compute_sensitivity_chance_pred
- pyepilepsy.metrics.compute_sensitivity_chance_pred(preictal_duration: float, tau: float, rho: float) float
Compute the sensitivity of a random poisson based chance predictor given the time in warning ratio of the predictor.
- Parameters:
- preictal_durationfloat
The preictal duration in minutes
- taufloat
The firing duration in minutes
- rhofloat
The time in warning ratio of the predictor to compare with chance
- Returns:
- float
Sensitivity of a random poisson based chance predictor
Notes
See The Statistics of a Practical Seizure Warning System for more detail. (doi:10.1088/1741-2560/5/4/004)
Note that I am not sure about the validity of the formula without
preictal_duration=tau
, even if it looks logical.Examples
Let’s say we have built a classifier with a postprocessing stage that gives
tiw=0.2
for a preictal duration of 60min. To compare with alarm systems, we usetau=preictal_duration
, so that any preictal detection leads to a warning during the seizure. We then have:>>> from pyepilepsy.metrics import compute_sensitivity_chance_pred >>> compute_sensitivity_chance_pred(preictal_duration=60, tau=60, rho=0.2) 0.19999999999999996
We find, as in the paper, that \(Sen_{chance-predictor} \approx rho\)