Skip to content

Make model evaluation reproducible and compare model errors in the MAE table - #63

Merged
chanshing merged 3 commits into
OxWearables:masterfrom
aidanacquah:fix/reproducible-evaluation
Oct 26, 2026
Merged

chanshing merged 3 commits into
OxWearables:masterfrom
aidanacquah:fix/reproducible-evaluation

Conversation

@chanshing

Copy link
Copy Markdown
Member

Seeds all random number generators and enables deterministic PyTorch/cuDNN in the evaluation notebook so that repeated runs give the same results. Fixes the MAE table p-value, which tested the baseline's predictions against its own ground truth; it now runs a paired t-test on the per-participant errors of ActiNet against those of the baseline. The baseline random forest now uses sleep-transition handling in its HMM.

Breaking Changes

  • build_pvalue_cell parameters are renamed from true_values/pred_values to values1/values2. Callers that pass them by keyword must be updated. Positional calls and the return format are unchanged.
  • The "p-value" row returned by build_mae_table now has a different meaning: it compares the two models' errors instead of testing the baseline's predictions against the ground truth. Values will differ from earlier runs.

Files Changed

src/actinet/utils/eval_utils.py

  • build_mae_table: the p-value is now a paired t-test between ActiNet's per-participant signed errors (true minus predicted) and the baseline's
  • build_pvalue_cell: parameters are now generic, two paired samples instead of true and predicted values; the test itself is unchanged
  • Formatting-only changes elsewhere

EvaluateModel.ipynb

  • New seeding step that runs before evaluation. It seeds Python, NumPy and PyTorch (CPU and CUDA), sets PYTHONHASHSEED and the cuBLAS workspace config, enables torch.use_deterministic_algorithms, and disables cuDNN benchmarking
  • Baseline random forest now runs with hmm_handle_sleep_transitions enabled
  • The per-fold test participant list is now written to the versioned evaluation output directory, not a fixed outputs/actinet_vs_bbaa path
  • Cells reformatted with Black; outputs remain cleared

@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@chanshing
chanshing marked this pull request as ready for review October 26, 2026 18:07
@chanshing
chanshing merged commit 3cf6da9 into OxWearables:master Oct 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants