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).

Warning

Experimental — this method returns a yasa.EpochByEpochAgreement object whose API may change before the full release planned for v0.8.0.

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        0.550
balanced_acc    0.355
kappa           0.227
mcc             0.231
precision       0.515
recall          0.550
f1              0.524
Name: agreement, dtype: float64