uqmodels.visualization package

Submodules

uqmodels.visualization.aux_visualization module

uqmodels.visualization.aux_visualization.aux_adjust_axes(ax, x, y_list, ylim=None, x_lim=None, margin=0.05, x_margin=0.5)[source]

Adjust x/y axis limits based on data and optional explicit limits.

Parameters:
  • ax (Axes)

  • x (array-like)

  • y_list (array-like or list of array-like) – One or several y-series to consider for limits.

  • ylim (tuple or None) – If not None, force (ymin, ymax).

  • x_lim (tuple or None) – If not None, force (xmin, xmax).

  • margin (float) – Relative margin applied to inferred y-limits (ignored if ylim is set).

  • x_margin (float) – Margin added around min/max of x (ignored if x_lim is set).

uqmodels.visualization.aux_visualization.aux_build_data_colors(data, list_anom_ind=None)[source]

Construit la palette de couleurs par canal, en surlignant éventuellement certains indices anormaux.

uqmodels.visualization.aux_visualization.aux_compute_layout_params(n_score, dim_score, true_label, score2, data, grid_spec=None)[source]

Calcule n_fig, sharey, grid_spec.

uqmodels.visualization.aux_visualization.aux_create_score_figure(n_fig, sharey, grid_spec, figsize)[source]

Crée la figure et les axes pour la matrice d’anomalies.

uqmodels.visualization.aux_visualization.aux_fill_area(ax, x, env_bot, env_top, config=None)[source]

Fill an envelope between two curves on an Axes.

Parameters:
  • ax (Axes)

  • x (array-like) – Coordinates and envelope bounds.

  • env_bot (array-like) – Coordinates and envelope bounds.

  • env_top (array-like) – Coordinates and envelope bounds.

  • config (dict, optional) – Style overrides (color, alpha, label).

uqmodels.visualization.aux_visualization.aux_fill_between(ax, x, y1, y2, where=None, config=None)[source]

Wrapper around ax.fill_between with configurable style.

Parameters:
  • ax (Axes)

  • x (array-like)

  • y1 (array-like)

  • y2 (array-like)

  • where (array-like or None) – Boolean mask for conditional fill.

  • config (dict, optional) – Style overrides (color, facecolor, alpha, label, interpolate, zorder).

uqmodels.visualization.aux_visualization.aux_finalize_figure(fig, show_plot=True)[source]

Finalise la figure (tight_layout + show optionnel).

uqmodels.visualization.aux_visualization.aux_format_time_axis(ax, x_flag, x_date)[source]

Configure l’axe des x comme temporel et éventuellement applique un formatter.

uqmodels.visualization.aux_visualization.aux_norm_score_inputs(score, f_obs=None, cmap=None)[source]

Normalise score en liste, infère len_score, dim_score, n_score et f_obs.

uqmodels.visualization.aux_visualization.aux_overlay_score_anoms_on_data(ax, x, data, score, f_obs, dim, threshold=1.0)[source]

Superpose les points où |score| > threshold sur les séries de données.

uqmodels.visualization.aux_visualization.aux_overlay_setup_grid(ax, setup, n_points)[source]

Superpose la grille channels/sensors sur une matrice de score. setup = (n_chan, n_sensor)

uqmodels.visualization.aux_visualization.aux_overlay_true_label_on_data(ax, x, data, true_label, f_obs, color='purple')[source]

Superpose les labels vrais sur les séries temporelles.

uqmodels.visualization.aux_visualization.aux_plot_PIs(ax, x, list_PIs, list_alpha_PIs, list_colors_PIs=['lightblue', 'lightgreen'], list_alpha_fig_PIs=[0.3, 0.15], list_label_PIs=None, config=None)[source]

Plot multiple prediction interval envelopes on an Axes.

Parameters:
  • ax (Axes)

  • x (array-like)

  • list_PIs (list of array-like) – [low_1, …, low_k, high_k, …, high_1].

  • list_alpha_PIs (list of float) – Quantile levels for each bound.

  • list_colors_PIs (list, optional) – Per-interval colors overriding config.

  • list_alpha_fig_PIs (list, optional) – Per-interval alphas overriding config.

  • list_label_PIs (list, optional) – Per-interval labels.

  • config (dict, optional) – Global style config: {“line”: {…}, “fill”: {…}}.

uqmodels.visualization.aux_visualization.aux_plot_anom(ax, x, y, config=None)[source]

Plot anomalous observations on an Axes using aux_plot_line.

Parameters:
  • ax (Axes)

  • x (array-like) – Coordinates and anomalous values.

  • y (array-like) – Coordinates and anomalous values.

  • config (dict, optional) – Style overrides for anomalous points.

uqmodels.visualization.aux_visualization.aux_plot_conf_score(ax, x, pred, confidence_lvl, label, mode_res=False, config=None)[source]

Plot confidence scores as colored markers on an Axes.

Parameters:
  • ax (Axes)

  • x (array-like) – Coordinates and predictions.

  • pred (array-like) – Coordinates and predictions.

  • confidence_lvl (array-like) – Discrete confidence levels (int).

  • label (list of str) – Legend labels per confidence level.

  • mode_res (bool, default False) – If True, plot residual scores around zero.

  • config (dict, optional) – Style overrides (marker, s, edgecolors, linewidth, cmap, zorder_base).

uqmodels.visualization.aux_visualization.aux_plot_confiance(ax, y, pred, var_A, var_E, born=None, born_bis=None, ylim=None, split_values=-1, x=None, mode_res=False, min_A=0.08, min_E=0.02, env=[0.95, 0.68], config=None, **kwarg)[source]

Plot prediction, uncertainty intervals and anomaly regions on an Axes.

uqmodels.visualization.aux_visualization.aux_plot_data_timeseries(ax, x, data, f_obs, dim, colors, lw=0.9)[source]

Trace les séries temporelles multicanal.

uqmodels.visualization.aux_visualization.aux_plot_line(ax, x, y, config=None)[source]

Plot a line (or markers only) on an Axes with configurable style.

Parameters:
  • ax (Axes)

  • x (array-like)

  • y (array-like)

  • config (dict, optional) – Keys: color, linestyle, linewidth, marker, markersize, label, zorder.

uqmodels.visualization.aux_visualization.aux_plot_pred(ax, x, y, pred, config=None)[source]

Plot observations and predictions on a given Axes with optional style config.

Parameters:
  • ax (Axes)

  • x (array-like) – Coordinates, observations, and predictions.

  • y (array-like) – Coordinates, observations, and predictions.

  • pred (array-like) – Coordinates, observations, and predictions.

  • config (dict, optional) – Style overrides for truth line, prediction line, and observation scatter. Keys: “truth_line”, “pred_line”, “obs_scatter”.

uqmodels.visualization.aux_visualization.aux_plot_score_matrix(ax, score_mat, f_obs, extent, vmin, vmax, cmap, title='score')[source]

Affiche une matrice de score via imshow.

uqmodels.visualization.aux_visualization.aux_plot_true_label_matrix(ax, true_label, f_obs, extent)[source]

Affiche la matrice de labels vrais.

uqmodels.visualization.aux_visualization.aux_prepare_x_extent(x, f_obs, dim_score)[source]

Prépare x (échelle) et la liste d’extent pour imshow. Retourne x, x_flag (datetime ou non), list_extent.

uqmodels.visualization.aux_visualization.provide_cmap(mode='bluetored')[source]

Generate a bluetored or a cyantopurple cutsom cmap

Parameters:

mode (str, optional) – Values: bluetored’ or ‘cyantopurple ‘

Returns:

Colormap matplotlib

uqmodels.visualization.old_visualisation module

uqmodels.visualization.old_visualisation.plot_prediction_interval(y: array, y_pred_lower: array, y_pred_upper: array, X: array | None = None, y_pred: array | None = None, save_path: str | None = None, sort_X: bool = False, **kwargs) None[source]

Plot prediction intervals whose bounds are given by y_pred_lower and y_pred_upper. True values and point estimates are also plotted if given as argument.

Parameters:
  • y – label true values.

  • y_pred_lower – lower bounds of the prediction interval.

  • y_pred_upper – upper bounds of the prediction interval.

  • <optionnal> (y_pred) – abscisse vector.

  • <optionnal> – predicted values.

  • kwargs – plot parameters.

uqmodels.visualization.old_visualisation.plot_sorted_pi(y: array, y_pred_lower: array, y_pred_upper: array, X: array | None = None, y_pred: array | None = None, **kwargs) None[source]

Plot prediction intervals in an ordered fashion (lowest to largest width), showing the upper and lower bounds for each prediction. :param y: label true values. :param y_pred_lower: lower bounds of the prediction interval. :param y_pred_upper: upper bounds of the prediction interval. :param X <optionnal>: abscisse vector. :param y_pred <optionnal>: predicted values. :param kwargs: plot parameters.

uqmodels.visualization.old_visualisation.show_dUQ_refinement(UQ, y=None, d=0, f_obs=None, max_cut_A=0.99, q_Eratio=2, E_cut_in_var_nominal=False, A_res_in_var_atypic=False)[source]
uqmodels.visualization.old_visualisation.visu_latent_space(grid_dim, embedding, f_obs, context_grid, context_grid_name=None)[source]

uqmodels.visualization.visualization module

Visualization module.

uqmodels.visualization.visualization.aux_get_var_color_sets()[source]

Return the color sets used for percentile envelope visualization in plot_var.

Returns:

  • color_full (list of tuple) – Colors for filled regions between percentile curves.

  • color_full2 (list of tuple) – Colors for percentile boundary lines.

uqmodels.visualization.visualization.plot_anom_matrice(score, score2=None, f_obs=None, true_label=None, data=None, x=None, vmin=-3, vmax=3, cmap=None, list_anom_ind=None, figsize=(15, 6), grid_spec=None, x_date=False, show_plot=True, setup=None)[source]

Visualize anomaly score matrices and optional ground-truth labels or data.

This function plots one or several anomaly score matrices (e.g., per model or per transformation), an optional secondary anomaly score matrix, optional ground-truth anomaly labels, and optional multichannel time series data. It supports contextual segmentation, date-based x-axes, sensor/channel structural overlays, and anomaly highlighting. The function preserves its original API while delegating rendering to modular helpers.

Parameters:
  • score (array-like or list of array-like) – Primary anomaly score matrix or list of matrices. Each matrix must be of shape (n_samples, n_features).

  • score2 (array-like, optional) – Secondary anomaly score matrix of shape (n_samples, n_features).

  • f_obs (array-like, optional) – Indices of samples to visualize; defaults to all.

  • true_label (array-like, optional) – Ground-truth anomaly labels of shape (n_samples, n_features).

  • data (array-like, optional) – Multichannel time series of shape (n_samples, n_features), used for overlaying raw data and score-based anomaly markers.

  • x (array-like, optional) – X-axis values. If None, integer indices are used. If datetime-like, the function automatically switches to a date axis.

  • vmin (float, default=(-3, 3)) – Color limits for the anomaly score colormap.

  • vmax (float, default=(-3, 3)) – Color limits for the anomaly score colormap.

  • cmap (Colormap, optional) – Colormap for score matrices. If None, a default diverging map is used.

  • list_anom_ind (list of int, optional) – Indices of features/sensors to highlight in the time-series panel.

  • figsize (tuple, default=(15, 6)) – Figure size in inches.

  • grid_spec (array-like, optional) – Height ratios for subplot layout. If None, all subplots have equal height.

  • x_date (bool, default=False) – If True, the x-axis is formatted as a date axis (dd/mm HH:MM).

  • show_plot (bool, default=True) – Whether to display the resulting figure.

  • setup (tuple, optional) – Tuple (n_channel_per_sensor, n_sensor) enabling structural overlays (horizontal grid lines) on score matrices for multi-sensor setups.

Notes

  • The function supports:
    • multiple score matrices displayed in stacked subplots,

    • contextual slicing when x contains datetime values,

    • ground-truth anomaly maps,

    • multichannel data with anomaly highlighting,

    • optional highlighting of anomalous sensor indices.

  • Rendering is internally modularized via helper functions to improve clarity and maintainability, while keeping the public API identical.

Returns:

The function creates the figure and optionally displays it.

Return type:

None

uqmodels.visualization.visualization.plot_pi(y, y_pred, y_pred_lower, y_pred_upper, mode_res=False, f_obs=None, X=None, size=(12, 2), name=None, show_plot=True, config=None, ylim=None, xlim=None, **kwargs)[source]

Plot prediction intervals (PI) together with observations and predictions.

Displays observed values, predicted values, and their prediction interval (upper/lower bounds). Optionally plots residuals instead of absolute values (mode_res=True). Observations falling outside the PI are highlighted. Parameter f_obs selects which observation indices to display.

uqmodels.visualization.visualization.plot_var(Y, data_full, variance, impact_anom=None, anom=None, f_obs=None, dim=(400, 20, 3), g=0, res_flag=False, fig_s=(20, 3), title=None, ylim=None)[source]

Plot empirical variance envelopes around a univariate time series.

This function builds a set of percentile-based envelopes from the provided variance and overlays them on the original (or residual) series together with anomaly markers. It visualizes how the variance translates into coverage levels for a given component of a multivariate signal.

Parameters:
  • Y (array-like) – Ground-truth series of shape (n_samples, n_dim).

  • data_full (array-like) – Reference series used to construct the envelopes, same shape as Y.

  • variance (array-like) – Point-wise variance of shape (n_samples, n_dim) for the selected component.

  • impact_anom (array-like, optional) – Anomaly impact indicator of shape (n_samples, n_dim). Non-zero entries are flagged as anomalies.

  • anom (array-like, optional) – Unused placeholder kept for backward compatibility.

  • f_obs (array-like, optional) – Indices of samples to visualize. If None, all samples are used.

  • dim (tuple, default=(400, 20, 3)) – Unused placeholder describing (n_samples, n_time, n_groups). Kept for backward compatibility.

  • g (int, default=0) – Index of the dimension (component) to plot.

  • res_flag (bool, default=False) – If True, envelopes are computed around data_full - data_full (i.e. residuals), otherwise around data_full.

  • fig_s (tuple, default=(20, 3)) – Figure size in inches.

  • title (str, optional) – Figure title.

  • ylim (tuple, optional) – Manual y-axis limits (ymin, ymax). If None, limits are inferred from the outer envelopes.

Returns:

  • per (list of np.ndarray) – List of envelope curves (one array per percentile in per_list).

  • per_list (list of float) – Percentile levels used to build the envelopes.

uqmodels.visualization.visualization.uncertainty_plot(y, output, context=None, size=(15, 5), f_obs=None, name='UQplot', mode_res=False, born=None, born_bis=None, dim=0, confidence_lvl=None, list_percent=[0.8, 0.9, 0.99, 0.999, 1], env=[0.95, 0.65], type_UQ='old', show_plot=True, with_colorbar=False, **kwarg)[source]

Visualize uncertainty diagnostics for multivariate predictive models.

This function plots observations, predictions, prediction intervals, aleatoric/epistemic uncertainty contributions, confidence-level scores, optional anomaly bounds, and context-based segmentations. It supports multi-output signals, multiple contextual partitions, residual mode, and both full UQ views and data-only views. The function preserves the original API and integrates with modular visualization helpers (aux_*).

Parameters:
  • y (array-like) – Ground-truth observations of shape (n_samples, n_dim).

  • output (tuple or None) – UQ model outputs. Either (pred, var_A, var_E) or (pred, (var_A, var_E)), depending on type_UQ. Set to None in data-only mode.

  • context (array-like, optional) – Context matrix used for splitting the plot by contextual dimension or highlighting contextual regions.

  • size (tuple, default=(15, 5)) – Figure size in inches.

  • f_obs (array-like, optional) – Indices of samples to display; defaults to all.

  • name (str, default="UQplot") – Figure suptitle.

  • mode_res (bool, default=False) – If True, plot residuals instead of raw values.

  • born (tuple of array-like, optional) – Lower and upper anomaly bounds for each dimension.

  • born_bis (tuple of array-like, optional) – Secondary set of anomaly bounds.

  • dim (int or list of int, default=0) – Target output dimensions to visualize.

  • confidence_lvl (array-like, optional) – Precomputed confidence-level matrix. If None, it is computed internally.

  • list_percent (list of float, default=[0.8, 0.9, 0.99, 0.999, 1]) – Confidence thresholds used to compute epistemic confidence levels.

  • env (list of float, default=[0.95, 0.65]) – Default uncertainty envelopes for plotting.

  • type_UQ ({"old", "var_A&E"}, default="old") – Format specification of output.

  • show_plot (bool, default=True) – Whether to display the final figure.

  • with_colorbar (bool, default=False) – Whether to add a confidence-level colorbar.

  • **kwarg – Additional parameters, including: - “ind_ctx”: context values to include, - “split_ctx”: context dimension used for splitting subplots, - “ylim”: vertical limits, - “var_min”: minimum (var_A, var_E) values, - “only_data”: disable UQ & plot observations only, - “x”: explicit x-axis values, - “ctx_attack”: tuple defining contextual highlight rules, - “list_name_subset”: labels for contextual annotations.

Notes

  • This function acts as a high-level orchestrator and delegates rendering to modular visualization helpers (aux_plot_confiance, aux_plot_conf_score, aux_plot_line, aux_fill_between, etc.).

  • The input API is preserved for backward compatibility.

Returns:

The function creates a figure and optionally displays it.

Return type:

None

uqmodels.visualization.visualization_mutisource module

Visualization_multisource module.

uqmodels.visualization.visualization_mutisource.apply_cmap(val, vmin, vmax, cmap)[source]

Transform valyes array into color values array using cmap and considering bound [vmin,vmax]

Parameters:
  • val (array) – Values to turn to color

  • vmin (float) – min_val

  • vmax (float) – max_val

  • cmap (cmap) – matplotlib cmap

Returns:

Array of color

Return type:

_type_

uqmodels.visualization.visualization_mutisource.compute_dev_score(val, y, vmin, vmax)[source]

Compute signed relative errors

Parameters:
  • val (array) – Prediction

  • y (array) – Target

  • vmin (float) – negative minimum sensitivité

  • vmax (float) – positive minimun sensitivity

Returns:

signed relative errors.

Return type:

r

uqmodels.visualization.visualization_mutisource.load_and_select(storing, keys, x_min, x_max)[source]
uqmodels.visualization.visualization_mutisource.load_from_metadata(storing, str_keys_metadata)[source]
uqmodels.visualization.visualization_mutisource.plot_analysis(storing_data, storing_res, sensors_mask, x_min, x_max, figsize=(20, 4), matplot=True)[source]
uqmodels.visualization.visualization_mutisource.plot_anom_mat(storing_data, storing_res, sensors_mask, x_min, x_max, figsize=(20, 12), metadata=None)[source]
uqmodels.visualization.visualization_mutisource.plot_channel(storing_data, storing_res, sensors_mask, x_min, x_max, mode=None, figsize=(20, 4), canal_nature=['Mean', 'Std', 'ExT'])[source]
uqmodels.visualization.visualization_mutisource.plot_row_series(storing, sensors_mask, x_min, x_max, figsize=(12, 10), date_init=None, anom=None)[source]
uqmodels.visualization.visualization_mutisource.plot_row_series_statistics(storing, sensors_mask, x_min, x_max, figsize=(12, 10), interpolate_data=False, date_init=None)[source]

Module contents