window_group_mia_figures
window_group_mia_figures
¶
Plotly report figures for window membership inference protection.
Each builder summarizes values stored by the metric in WindowGroupMIA.details.
Functions:
| Name | Description |
|---|---|
generate_window_group_mia_distance_figure |
Plot the distribution of each window's distance to its nearest synthetic window. |
generate_window_group_mia_group_figure |
Plot the share of each training group's windows that are flagged, for the 12 most-flagged groups. |
generate_window_group_mia_closest_match_figure |
Plot the synthetic window closest to the training data, with its training window for exact copies. |
generate_window_group_mia_distance_figure(details)
¶
Plot the distribution of each window's distance to its nearest synthetic window.
Distances are shown as the typical difference per value, in training standard deviations: the Euclidean distance divided by the square root of the number of values in a window. Training windows are drawn in training blue, holdout windows in gray, and the flag threshold as a dashed line. When training windows pile up to the left of the holdout windows, the synthetic data sits closer to training data than to unseen data. The holdout trace is not named after a dataset, so the report's dataset theming leaves its color alone.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
details
|
Mapping[str, Any]
|
|
required |
Returns:
| Type | Description |
|---|---|
Figure
|
A Plotly overlaid histogram figure. |
Raises:
| Type | Description |
|---|---|
DataError
|
If no training distances are stored. |
Source code in src/nemo_safe_synthesizer/evaluation/components/window_group_mia_figures.py
generate_window_group_mia_group_figure(per_group, holdout_flag_rate)
¶
Plot the share of each training group's windows that are flagged, for the 12 most-flagged groups.
Bars shade from white at the holdout flag rate, which is what chance alone produces, to red when every window of the group is flagged. The holdout flag rate is drawn as a dashed line, and the x-axis always spans 0 to 100% so small excesses look small. Group names are shortened only in the axis labels; hover shows the full name, window count, and exact copies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
per_group
|
Sequence[Mapping[str, Any]]
|
|
required |
holdout_flag_rate
|
float
|
Share of holdout windows flagged. |
required |
Returns:
| Type | Description |
|---|---|
Figure
|
A Plotly horizontal bar figure. |
Raises:
| Type | Description |
|---|---|
DataError
|
If no group summaries with flag rates are supplied. |
Source code in src/nemo_safe_synthesizer/evaluation/components/window_group_mia_figures.py
generate_window_group_mia_closest_match_figure(details)
¶
Plot the synthetic window closest to the training data, with its training window for exact copies.
The training window is plotted only when the match stores its values,
which WindowGroupMIA does only for exact copies, so the report never
shows training values that the synthetic data doesn't already contain.
Each value column contributes two consecutive traces, training then
synthetic, or only the synthetic trace when the training window is
hidden. Columns follow details["columns"] order, and only the first
column is visible so the report can switch columns by trace index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
details
|
Mapping[str, Any]
|
|
required |
Returns:
| Type | Description |
|---|---|
Figure
|
A Plotly line figure with one visible column at a time. |
Raises:
| Type | Description |
|---|---|
DataError
|
If no closest match is stored. |