Skip to content

Normalise the semantics of DataStructureMetadata.n_trials (per subject vs dataset total) #1202

Open

Description

@bruAristimunha

Problem

DataStructureMetadata.n_trials is documented as "Total number of trials per subject" (moabb/datasets/metadata/schema.py), but the catalogue does not follow one convention. On develop (9c6b1ccfa, 160 metadata entries):

n_trials type count
int 79
None 43
str (textual summary) 24
dict (per subset) 14

Among the 30 int entries that can be cross-checked against n_trials_per_class, 25 equal the per-subject sum, 1 equals the per-subject sum over all sessions, and 4 match neither (e.g. Tavakolan2017 = 2880 with 60 trials/class × 12 subjects × 4 sessions, BNCI2020_001 = 80 vs 241 per class). The open dataset PRs add more variants: dataset totals (Corsi2026 14 431, Ma2022 11 988, LioiXP1 780), per-block counts (Iwama2023 20), and per-session values.

The paper-grounded metadata audit (2026-09-30) flagged n_trials as the single largest source of low-confidence mismatches (50 of ~200), almost all of them per-run vs per-session vs per-subject vs dataset-total ambiguities rather than wrong numbers.

Proposal

  1. Keep the schema meaning: n_trials = trials per subject, summed over sessions and runs (the quantity a user gets from get_data() for one subject). Document it explicitly with the formula n_trials ≈ sum(n_trials_per_class.values()) × sessions_per_subject when classes are balanced across sessions.
  2. Add a validate_metadata_against_dataset check (warning level) comparing n_trials with n_trials_per_class × sessions_per_subject and with the #Trials / class × #Classes × #Sessions columns of summary_*.csv.
  3. Move dataset-wide totals and per-run/per-block counts into trials_context (free text) or n_blocks, never into n_trials.
  4. Normalise the 24 str and 14 dict entries where the sources allow an integer; keep str only for genuinely irregular designs.
  5. One sweep PR over the 160 develop entries plus the new-dataset PRs (Add Ma2022 (SHU) cross-session motor imagery dataset #1178, Add four OpenNeuro motor-imagery datasets (Lee2022, Lioi2020_XP1, Lioi2020_XP2, Iwama2023) #1186, Add NETBCI2026 longitudinal motor-imagery dataset (Networks for BCI) #1188–Add Leelakittisin2025, PerezBlanco2026 and Vagaja2023 archive datasets #1199) once the convention is agreed.

References

  • Schema: moabb/datasets/metadata/schema.py (DataStructureMetadata)
  • Audit reports listing the affected fields per dataset: audit/metadata-paper-check branch (scripts/paper_audit/), per-group reports in the audit cache.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions