yasa.Hypnogram.evaluate#

Hypnogram.evaluate(obs_hyp)[source]#

Evaluate agreement between two hypnograms of the same sleep session.

For example, the reference hypnogram (i.e., self) might be a manually-scored hypnogram and the observed hypnogram (i.e., obs_hyp) might be a hypnogram from actigraphy, a wearable device, or an automated scorer (e.g., yasa.SleepStaging.predict).

Parameters:
obs_hypyasa.Hypnogram

The observed or to-be-evaluated hypnogram.

Returns:
ebeyasa.EpochByEpochAgreement

See EpochByEpochAgreement documentation for more detail.

Examples

>>> from yasa import simulate_hypnogram
>>> hyp_a = simulate_hypnogram(tib=90, scorer="AASM", seed=8)
>>> hyp_b = hyp_a.simulate_similar(scorer="YASA", seed=9)
>>> ebe = hyp_a.evaluate(hyp_b)
>>> ebe.get_agreement().round(3)
accuracy        55.000
balanced_acc    35.497
kappa            0.227
mcc              0.231
precision       51.484
f1              52.380
Name: agreement, dtype: float64