🧠

MOBA

Mosaics of Brain Activity

MOBA— Mosaics of Brain Activity

About this view

MOBA — Mosaics of Brain Activity — is an interactive 3D dashboard for clustering iEEG contacts. Pick a run from the dropdown above to see all contacts plotted on a translucent fsaverage cortex, with synced sample thumbnails on the right and live metrics below.

Runs & canonical dataset

Each run is a method × feature_set combination. Four feature sets are available: raw (full 129×300 ERSP), blob (valley-segmented blob feature vectors), −101 (full-res painted ±1/0 segmentation maps), and hg (high-gamma 70–150 Hz time series). Two methods: K-Means and Hierarchical (Ward / average). All four feature sets cluster on the same canonical sample set (high-activity-gated, built once by lf_dataset.prepare_dataset) so cross-feature and cross-method comparisons are valid.

Brain

Each sphere is one (patient × electrode × condition) sample, positioned at its MNI coordinate on FreeSurfer's fsaverage. Drag to rotate, scroll to zoom, right-drag to pan. Hover for a tooltip; click an electrode to highlight its sample thumbnail on the right. Color is set by the Color by filter (Cluster / Patient / Condition). The Palette button switches between the curated cohort-aware palette and a 32-color glasbey set for maximum perceptual distinctness across patients.

Samples pane

Thumbnails are one per (patient × electrode × condition) sample. The view toggle in the header swaps between four representations of the same sample:

Top-right badge on each card = per-sample silhouette (green ≥ 0, red < 0).

K-cut slider

For any run saved with k_range (most KMeans + HC sweep runs), a slider appears below the Color-by row. Scrubbing the slider re-points every sample's cluster assignment via cluster_labels_by_k.csv — the brain, chips, samples and metrics all update live. Label shows silhouette at the current K plus a ★ on the silhouette-optimal K. Best button jumps back to the best K.

Cluster chips

Each chip shows the cluster's centroid thumbnail (mean ERSP for raw / hg, medoid sample with q34-style blob overlay for blob, mean painted −101 map for −101). Top-right of each chip is a patient-diversity badge:

Hover the badge for the comma-separated patient list. The denominator is the number of recording centers (BERN / GVA / MicroEPI) represented in the cluster.

Filters

Toggling cluster / patient / condition chips updates the brain, samples grid and metrics simultaneously. High-sil only hides any sample with silhouette ≤ 0 — useful for showing the confident core of each cluster. 🧠 Brain toggles the fsaverage cortex mesh (electrodes always shown).

Metrics (live)

Summary line counts currently-visible samples (post-filter). The two stacked bars show patient and condition makeup of that selection — a cluster dominated by one patient is a likely artifact; high patient diversity = real cross-patient pattern.

PDF export

The 📄 PDF button generates a multi-page summary — one A4 page per enabled cluster, with the 3D brain colored by patient, the cluster's mean ERSP / centroid, and patient + condition breakdowns.

Run-specific stats

(stats will populate once a run loads)

Run diagnostics

K-selection curves

Silhouette by K
Silhouette by K (Kaufman & Rousseeuw 1990) — higher = better
Gap statistic by K
Gap statistic by K (Tibshirani et al. 2001) — best K = smallest K with Gap(K) ≥ Gap(K+1) − sK+1

Silhouette analysis (best K)

Silhouette knife plot + PCA projection
Left: per-sample silhouette (knife plot), grouped & sorted by cluster, dashed line = overall mean. Right: PCA(2) of the feature matrix coloured by cluster, with projected centroids. Computed at the run's best K.

Per-cluster diagnostics

(pick a run to load per-cluster diagnostics)
Stability columns come from 211_validation.ipynb running consensus clustering (Monti et al. 2003) and per-cluster Jaccard (Hennig 2007). Anatomy columns come from projecting each electrode to the nearest fsaverage cortical vertex and reading its Desikan-Killiany aparc label.
3D Brain · fsaverage
Pick a run to start.
Samples
Pick a run to start.
Color by
Clusters
Patients
Conditions
Pick a run to start.
By patient
By condition