Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sleep Stage Classifier

A tabular machine-learning ensemble for four-class sleep-stage prediction. The project focuses on robust macro-F1 rather than public-leaderboard guessing: models are trained in fold-safe pipelines, compared with out-of-fold predictions, blended only when they add validation signal, and tuned with per-class decision weights.

Result Trail

Candidate OOF Macro-F1
LightGBM family 0.8186
CatBoost family 0.8166
SVM/RBF candidate 0.8228
Three-model blend + class weights 0.8314
Four-model blend + one-pass class weights 0.8335

The main notebook, notebooks/sleep_stage_final.ipynb, documents why the fourth model was accepted: it was not redundant with the existing blend and produced a measurable OOF gain.

Why It Is Interesting

  • Macro-F1 optimization: the project optimizes class balance, not raw accuracy.
  • Fold-safe feature handling: preprocessing and imputation happen inside cross-validation folds.
  • Model family diversity: tree ensembles, SVMs, MLP-style rescue experiments, and meta/blend layers are compared through OOF predictions.
  • Decision calibration: the final lift comes from class-specific weights on validated probabilities, not a blind argmax.
  • Experiment hygiene: generated predictions and probability arrays are excluded; the repo keeps source, notebooks, and result logs.

Repository Layout

.
├── notebooks/
│   ├── sleep_stage_final.ipynb
│   └── sleep_stage_final_solution.ipynb
├── scripts/
│   ├── push86_experiment.py
│   └── run_rescue_variant.py
├── reports/
│   ├── model_report.md
│   ├── push86_stdout.log
│   └── rescue_stdout.log
├── data/
│   └── README.md
├── requirements.txt
└── .gitignore

Data Contract

Place the competition files at the repository root:

train.csv
test.csv
sample_submission.csv

The raw data and generated submissions are intentionally not committed.

Run

python -m venv .venv
./.venv/Scripts/python -m pip install -r requirements.txt
./.venv/Scripts/python scripts/push86_experiment.py

On macOS/Linux, replace ./.venv/Scripts/... with ./.venv/bin/....

For the narrative workflow:

jupyter notebook notebooks/sleep_stage_final.ipynb

Caveat

This is a competition-style classifier. The public repo is meant to show modeling discipline and reproducible experimentation, not to ship a medical sleep-stage diagnostic device.

About

Tabular sleep-stage classification ensemble optimized for macro-F1 with fold-safe validation.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages