ggml_ot.pl.panel_synth_dataset

ggml_ot.pl.panel_synth_dataset#

ggml_ot.pl.panel_synth_dataset(dataset, *, palette=None, color_key='labels', point_alpha=0.1, figsize=None, unmixed_components=(0, 1), show_learned_panel=True, fitted_gmm_view='auto', mode_coloring='signal', selected_patient_ids=None, point_view='all', point_alpha_background=0.05, show=None, save=None)[source]#

Multi-panel figure for a synthetic-GMM TripletDataset.

Reads generation metadata from dataset.synth_data (set when the dataset was created via ggml_ot.data.from_synth_gmm()) and automatically produces up to three panels:

  • Panel 1 – Signal subspace (before mixing). Uses the aggregate ground-truth GMM for global/class-average views and the final clean-space patient-specific GMMs for per-patient views. Always shown.

  • Panel 2 – Unmixed subspace (selected via unmixed_components) with fitted GMMs projected back by undoing Q_mixing and the synthetic signal-plane rotation R_rotation. Shown only when dataset.covariances contains a fitted GMM.

  • Panel 3 – Learned latent space with the same fitted GMMs. Shown only after ggml_ot.train() has been called and show_learned_panel=True.

Parameters:
dataset

A TripletDataset with a synth_data attribute (i.e. created via ggml_ot.data.from_synth_gmm()).

palette UnionType[dict, str, None] (default: None)

Colour mapping for class labels.

color_key str (default: 'labels')

Metadata array in dataset.synth_data["samples"] used for point hue (default "labels").

point_alpha float (default: 0.1)

Opacity for scatter points.

figsize Optional[tuple[float, float]] (default: None)

Figure size; auto-set from number of panels when None.

unmixed_components tuple[int, int] (default: (0, 1))

Pair of dimensions in the clean synthetic basis obtained after undoing Q_mixing and R_rotation. Use (0, 1) for signal dimensions (default) or e.g. (2, 3) for two noise dimensions.

show_learned_panel bool (default: True)

Whether to include panel 3 when a learned projection is available. Set False to compare only unmixed dimensions (e.g. signal or noise) without the learned latent panel.

fitted_gmm_view Literal['auto', 'selected_patients', 'class_average', 'all_patients'] (default: 'auto')

How fitted GMMs are shown when identical_supports=False: "auto" (default) – uses "selected_patients" for per-patient GMMs and "class_average" for globally-fitted GMMs; "class_average", "selected_patients", or "all_patients".

mode_coloring Literal['signal', 'patients', 'none'] (default: 'signal')

Colour strategy for fitted GMM overlays in panels 2/3: "signal" colours only signal modes when their identity is known; "patients" colours every fitted component by patient id using patient colours derived from the class palette; and "none" draws all fitted components in grey.

selected_patient_ids Optional[Sequence[int]] (default: None)

Patient ids to use when fitted_gmm_view="selected_patients". If None, one patient per class is selected automatically.

point_view Literal['all', 'highlight_selected', 'selected_only'] (default: 'all')

How points are shown when selected patients are active: "all", "highlight_selected", or "selected_only".

point_alpha_background float (default: 0.05)

Background alpha used by point_view="highlight_selected".

show Optional[bool] (default: None)

Passed to savefig_or_show().

save UnionType[str, bool, None] (default: None)

Passed to savefig_or_show().

Return type:

Figure

Returns:

matplotlib.figure.Figure