Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/api/datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ Available Datasets
datasets/pyhealth.datasets.COVID19CXRDataset
datasets/pyhealth.datasets.ChestXray14Dataset
datasets/pyhealth.datasets.PhysioNetDeIDDataset
datasets/pyhealth.datasets.EEGBCIDataset
datasets/pyhealth.datasets.TUABDataset
datasets/pyhealth.datasets.TUEVDataset
datasets/pyhealth.datasets.ClinVarDataset
Expand Down
7 changes: 7 additions & 0 deletions docs/api/datasets/pyhealth.datasets.EEGBCIDataset.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pyhealth.datasets.EEGBCIDataset
================================

.. autoclass:: pyhealth.datasets.EEGBCIDataset
:members:
:undoc-members:
:show-inheritance:
1 change: 1 addition & 0 deletions docs/api/tasks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ Available Tasks
Sleep Staging <tasks/pyhealth.tasks.sleep_staging>
Sleep Staging (SleepEDF) <tasks/pyhealth.tasks.SleepStagingSleepEDF>
Temple University EEG Tasks <tasks/pyhealth.tasks.temple_university_EEG_tasks>
EEGBCI Tasks <tasks/pyhealth.tasks.eegbci>
Sleep Staging v2 <tasks/pyhealth.tasks.sleep_staging_v2>
Benchmark EHRShot <tasks/pyhealth.tasks.benchmark_ehrshot>
ChestX-ray14 Binary Classification <tasks/pyhealth.tasks.ChestXray14BinaryClassification>
Expand Down
7 changes: 7 additions & 0 deletions docs/api/tasks/pyhealth.tasks.eegbci.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pyhealth.tasks.eegbci
=====================

.. automodule:: pyhealth.tasks.eegbci
:members:
:undoc-members:
:show-inheritance:
56 changes: 56 additions & 0 deletions examples/eeg/eegbci/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# EEGBCI Pattern Discovery

This example uses `EEGBCIDataset` and `EEGBCIPatternDiscovery` to create
2-second EEGBCI windows with task labels, Welch bandpower features, and cautious
frequency-profile interpretations.

The interpretations are exploratory signal metadata. They are not clinical
diagnoses and do not prove a subject's cognition.

Run a tiny real-data example:

```bash
python examples/eeg/eegbci/eegbci_pattern_discovery.py \
--subjects 1 \
--runs 3 \
--max-windows 20 \
--download
```

Outputs are written to `outputs/eegbci_pattern_discovery/` by default:

- `eegbci_pattern_windows.csv`
- `eegbci_pattern_summary.md`

The CSV has one row per emitted 2-second window. Key columns include subject/run
metadata, `event_code`, decoded `task_label`, raw EEGBCI numeric label
(`eegbci_label` / `label`), PyHealth model-local label (`model_label`),
absolute window timing, band powers, relative band powers, `dominant_band`,
frequency ratios, and `interpretation`.

The moment-report columns add analysis-grade fields:

- `analysis_version`
- `state_hypothesis`, `state_confidence`, and `evidence_score`
- `evidence_summary`
- `rest_reference_scope` and rest-normalized relative band deltas
- `task_state_relation`, `task_state_rationale`, and `task_state_confidence`
- `is_low_confidence`, `is_possible_artifact`, and `is_mixed_or_ambiguous`

The `interpretation` column is report-level text derived from these moment-report
fields. Legacy task-level fields such as `brain_state_hypothesis`, `confidence`,
and `quality_flags` are intentionally not written to the CSV.

The Markdown report summarizes state counts, task-label/state agreement,
rest-normalized bandpower deltas, confidence and quality flags, representative
windows, limitations, and next checks. These labels are signal-pattern
summaries from short EEG windows, not clinical findings or evidence of a
subject's cognition.

Implementation details are tracked in
`docs/eeg_pattern_discovery/moment_report_implementation_plan.md`.

`--root` points to the local EEGBCI data directory. With `--download`, MNE
downloads any missing EDF files under that root. PyHealth task caches are stored
under the configured PyHealth cache directory and are keyed by the requested
subject/run selection.
Loading