-
Notifications
You must be signed in to change notification settings - Fork 558
[Conformal EEG] K-means clustering #795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds K-means clustering-based conformal prediction (ClusterLabel) for multiclass classification in EEG analysis. The method groups patients into clusters using K-means on embeddings and computes cluster-specific calibration thresholds to improve prediction set efficiency compared to global thresholds.
Changes:
- Implemented
ClusterLabelclass that performs K-means clustering on patient embeddings and applies cluster-specific calibration thresholds - Added comprehensive test suite covering initialization, calibration, and prediction
- Included example script demonstrating usage on TUEV EEG dataset with ContraWR model
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pyhealth/calib/predictionset/cluster/cluster_label.py | Core implementation of cluster-based conformal prediction with K-means clustering |
| pyhealth/calib/predictionset/cluster/init.py | Module initialization exporting ClusterLabel class |
| pyhealth/calib/predictionset/init.py | Updated to export ClusterLabel from cluster submodule |
| tests/core/test_cluster_label.py | Test suite covering initialization, calibration, and forward pass with various configurations |
| examples/conformal_eeg/tuev_kmeans_conformal.py | Example script demonstrating ClusterLabel usage on TUEV EEG events dataset |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Tbh, the copilot suggestions were pretty valid. Implemented some of them. |
siddharthal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This PR adds the k-means clustering conformal prediction.