yasa.EpochByEpochAgreement.summary#
- EpochByEpochAgreement.summary(by_stage=False, **kwargs)[source]#
Return group-level agreement scores.
- Parameters:
- by_stagebool
If
False(default),summarywill include agreement scores derived from average-based metrics. IfTrue, returnedsummaryDataFramewill include agreement scores for each sleep stage, derived from one-vs-rest metrics.- **kwargskey, value pairs
Additional keyword arguments are passed to
pandas.DataFrame.groupby.agg. This can be used to customize the descriptive statistics returned.
- Returns:
- summary
pandas.DataFrame A
pandas.DataFramesummarizing agreement scores across the entire dataset with descriptive statistics. Each row is an agreement metric and each column is a descriptive statistic (e.g., mean, standard deviation).
- summary
Examples
Call
get_agreement(orget_agreement_bystageifby_stage=True) before callingsummary:>>> import yasa >>> ref_hyps = [yasa.simulate_hypnogram(tib=600, scorer="Human", seed=i) for i in range(5)] >>> obs_hyps = [h.simulate_similar(scorer="YASA", seed=i) for i, h in enumerate(ref_hyps)] >>> ebe = yasa.EpochByEpochAgreement(ref_hyps, obs_hyps) >>> _ = ebe.get_agreement() >>> ebe.summary() mad mean std min median max metric accuracy 0.053000 0.285833 0.062686 0.214167 0.305833 0.350833 balanced_acc 0.041301 0.241583 0.058478 0.168548 0.238700 0.326814 kappa 0.054327 0.044791 0.073235 -0.057258 0.064022 0.140052 mcc 0.054725 0.045146 0.073966 -0.058031 0.064533 0.141520 precision 0.062393 0.282627 0.073269 0.202928 0.306433 0.349311 recall 0.053000 0.285833 0.062686 0.214167 0.305833 0.350833 f1 0.058863 0.279704 0.068751 0.205014 0.305590 0.345510
To control the descriptive statistics included as columns:
>>> ebe.summary(func=["count", "mean", "sem"]) count mean sem metric accuracy 5.0 0.285833 0.028034 balanced_acc 5.0 0.241583 0.026152 kappa 5.0 0.044791 0.032752 mcc 5.0 0.045146 0.033078 precision 5.0 0.282627 0.032767 recall 5.0 0.285833 0.028034 f1 5.0 0.279704 0.030747