multi_modal_figures
multi_modal_figures
¶
Plotly figure builders for the multi-modal evaluation report.
Functions:
| Name | Description |
|---|---|
degree_to_radian |
Convert degrees to radians. |
gauge_chart |
Render a semicircular gauge chart for a single evaluation score. |
pie |
Create a pie chart with privacy-grade color mapping. |
scatter |
Create a scatter trace for overlay plots. |
histogram |
Create a histogram trace for distribution plots. |
get_auto_bins |
Get common histogram bins for training/synthetic PCA projections. |
generate_mia_figure |
Generate a pie chart summarizing membership inference attack results. |
generate_aia_figure |
Generate a horizontal bar chart of per-column attribute inference risk. |
correlation_heatmap |
Generate a heatmap figure for a correlation matrix. |
generate_combined_correlation_figure |
Combine training, synthetic, and difference correlation heatmaps into one row. |
scatter_plot |
Create a scatter plot, capping the number of points to avoid browser crashes. |
structure_stability_figure |
Generate side-by-side PCA scatter plots for training and synthetic data. |
combine_subplots |
Combine multiple Plotly figures into a single-row subplot figure. |
bar_chart |
Generate a grouped bar chart comparing two categorical distributions. |
histogram_figure |
Generate overlaid histograms for a numeric distribution. |
generate_text_structure_similarity_figures |
Generate overlaid histograms of sentence/word/character distributions. |
generate_text_semantic_similarity_figures |
Generate a PCA scatter matrix for text embedding similarity. |
degree_to_radian(degrees)
¶
gauge_chart(evaluation_score, degree_start=210, degree_end=-30, min=False, dps=False)
¶
Render a semicircular gauge chart for a single evaluation score.
Source code in src/nemo_safe_synthesizer/evaluation/components/multi_modal_figures.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
pie(labels, values, textinfo='label+percent', sort=True)
¶
Create a pie chart with privacy-grade color mapping.
Source code in src/nemo_safe_synthesizer/evaluation/components/multi_modal_figures.py
scatter(x, y, mode='markers', color=_REPORT_PALETTE[0], name='Training')
¶
Create a scatter trace for overlay plots.
Source code in src/nemo_safe_synthesizer/evaluation/components/multi_modal_figures.py
histogram(x, color=_REPORT_PALETTE[0], name='Training', **kwargs)
¶
Create a histogram trace for distribution plots.
Source code in src/nemo_safe_synthesizer/evaluation/components/multi_modal_figures.py
get_auto_bins(x1, x2)
¶
Get common histogram bins for training/synthetic PCA projections.
NumPy bins="auto" is adaptive, but for some pathological distributions
(very small IQR with wide range/outliers) it can request an extreme number
of bins and raise. We cap to at most 100 bins for report stability.
Source code in src/nemo_safe_synthesizer/evaluation/components/multi_modal_figures.py
generate_mia_figure(df)
¶
Generate a pie chart summarizing membership inference attack results.
Source code in src/nemo_safe_synthesizer/evaluation/components/multi_modal_figures.py
generate_aia_figure(df)
¶
Generate a horizontal bar chart of per-column attribute inference risk.
Source code in src/nemo_safe_synthesizer/evaluation/components/multi_modal_figures.py
correlation_heatmap(matrix, name='Correlation')
¶
Generate a heatmap figure for a correlation matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
DataFrame
|
Correlation matrix (columns are truncated to 15 chars for display). |
required |
name
|
str
|
Trace name used in the legend. |
'Correlation'
|
Returns:
| Type | Description |
|---|---|
Figure
|
A Plotly |
Source code in src/nemo_safe_synthesizer/evaluation/components/multi_modal_figures.py
generate_combined_correlation_figure(training_correlation_df, synthetic_correlation_df, correlation_difference)
¶
Combine training, synthetic, and difference correlation heatmaps into one row.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
training_correlation_df
|
DataFrame
|
Correlation matrix of the training data. |
required |
synthetic_correlation_df
|
DataFrame
|
Correlation matrix of the synthetic data. |
required |
correlation_difference
|
DataFrame
|
Element-wise absolute difference matrix. |
required |
Returns:
| Type | Description |
|---|---|
Figure
|
A Plotly |
Source code in src/nemo_safe_synthesizer/evaluation/components/multi_modal_figures.py
scatter_plot(x, y, color=_REPORT_PALETTE[0], maximum_points=5000)
¶
Create a scatter plot, capping the number of points to avoid browser crashes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Series
|
Series of x-axis values. |
required |
y
|
Series
|
Series of y-axis values. |
required |
color
|
str
|
Marker color (defaults to the first palette color). |
_REPORT_PALETTE[0]
|
maximum_points
|
int
|
Maximum number of points to render. |
5000
|
Returns:
| Type | Description |
|---|---|
Figure
|
A Plotly |
Source code in src/nemo_safe_synthesizer/evaluation/components/multi_modal_figures.py
structure_stability_figure(training_df, synthetic_df)
¶
Generate side-by-side PCA scatter plots for training and synthetic data.
Source code in src/nemo_safe_synthesizer/evaluation/components/multi_modal_figures.py
combine_subplots(figures, titles=None, general_title=None, subplot_type='xy', shared_xaxes=True, shared_yaxes=True, height=None, margin=None)
¶
Combine multiple Plotly figures into a single-row subplot figure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
figures
|
list[Figure]
|
Figures to combine (one subplot column each). |
required |
titles
|
list[str] | None
|
Per-subplot titles (same length as |
None
|
general_title
|
str | None
|
Overall figure title. |
None
|
subplot_type
|
str
|
Plotly subplot type (e.g. |
'xy'
|
shared_xaxes
|
bool
|
Share x-axes across subplots. |
True
|
shared_yaxes
|
bool
|
Share y-axes across subplots. |
True
|
height
|
int | None
|
Optional explicit figure height in pixels. |
None
|
margin
|
dict | None
|
Optional margin dict passed to |
None
|
Returns:
| Type | Description |
|---|---|
Figure
|
A single Plotly |
Source code in src/nemo_safe_synthesizer/evaluation/components/multi_modal_figures.py
bar_chart(training_distribution, synthetic_distribution)
¶
Generate a grouped bar chart comparing two categorical distributions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
training_distribution
|
dict
|
Mapping of |
required |
synthetic_distribution
|
dict
|
Mapping of |
required |
Returns:
| Type | Description |
|---|---|
Figure
|
A Plotly |
Source code in src/nemo_safe_synthesizer/evaluation/components/multi_modal_figures.py
histogram_figure(training, synthetic)
¶
Generate overlaid histograms for a numeric distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
training
|
Series
|
Numeric training series. |
required |
synthetic
|
Series
|
Numeric synthetic series. |
required |
Returns:
| Type | Description |
|---|---|
Figure | None
|
A Plotly |
Source code in src/nemo_safe_synthesizer/evaluation/components/multi_modal_figures.py
generate_text_structure_similarity_figures(training_statistics, synthetic_statistics, title)
¶
Generate overlaid histograms of sentence/word/character distributions.
Source code in src/nemo_safe_synthesizer/evaluation/components/multi_modal_figures.py
generate_text_semantic_similarity_figures(training_pca, synthetic_pca, title)
¶
Generate a PCA scatter matrix for text embedding similarity.
Source code in src/nemo_safe_synthesizer/evaluation/components/multi_modal_figures.py
711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 | |