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 bin edges for the training and synthetic principal components. |
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 reference, output, 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 reference and output 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
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='Reference')
¶
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='Reference', **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 bin edges for the training and synthetic principal components.
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(reference_correlation, output_correlation, correlation_difference)
¶
Combine reference, output, and difference correlation heatmaps into one row.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference_correlation
|
DataFrame
|
Correlation matrix of the reference data. |
required |
output_correlation
|
DataFrame
|
Correlation matrix of the output 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
|
Marker color (defaults to the first palette color). |
_REPORT_PALETTE[0]
|
|
maximum_points
|
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(reference, output)
¶
Generate side-by-side PCA scatter plots for reference and output 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
|
Share x-axes across subplots. |
True
|
|
shared_yaxes
|
Share y-axes across subplots. |
True
|
|
height
|
Optional explicit figure height in pixels. |
None
|
|
margin
|
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(reference_distribution, output_distribution)
¶
Generate a grouped bar chart comparing two categorical distributions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference_distribution
|
dict
|
Mapping of |
required |
output_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(reference, output)
¶
Generate overlaid histograms for a numeric distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference
|
Series
|
Numeric reference series. |
required |
output
|
Series
|
Numeric output 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
654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 | |