plotly#

Plotly figure-generating functions

Functions

MDS_plot(campaign)

Creates a Multi-Dimensional Scaling (MDS) plot of the campaign data, colored by iteration.

factor_plot(optimizer[, feature_id, ...])

Produces a plot of surrogate model predictions at an OFAT range in one variable.

optim_progress(campaign[, response_ids, ...])

Generates a plotly figure to visualize optimization progress

parity_plot(optimizer[, f_transform, ...])

Produces a plot of surrogate model predictions at an OFAT range in one variable.

surface_plot(optimizer[, feature_ids, ...])

Produces a surface plot of surrogate model predictions over a 2-parameter grid range.

visualize_inputs(campaign)

Visualizes the input variables of a campaign.

obsidian.plotting.plotly.MDS_plot(campaign: Campaign) Figure[source]#

Creates a Multi-Dimensional Scaling (MDS) plot of the campaign data, colored by iteration.

This plot is helpful to visualize the convergence of the optimizer on a 2D plane.

Parameters:

campaign (Campaign) – The campaign object containing the data.

Returns:

The MDS plot

Return type:

fig (Figure)

obsidian.plotting.plotly.factor_plot(optimizer: Optimizer, feature_id: int = 0, response_id: int = 0, f_transform: bool = False, X_ref: DataFrame | None = None, plotRef: bool = True, ylim: tuple[float, float] | None = None) Figure[source]#

Produces a plot of surrogate model predictions at an OFAT range in one variable.

Parameters:
  • optimizer (Optimizer) – The optimizer object which contains a surrogate that has been fit to data and can be used to make predictions.

  • feature_id (int, optional) – The index of the desired variable to plot from the last data used to fit the surrogate model. The default value is 0.

  • response_id (int, optional) – Index of the response for potential multi-response models. Default value is 0 (single-response).

  • f_transform (bool, optional) – An indicator for whether or not to plot the response value in the “objective function” form which is directly used by the optimizer, else using the “measured response” form which the optimizer preproceses. Default value is False which plots the raw measured response scale.

  • plotRef (bool, optional) – An indicator for whether or not to plot the reference data points. Default value is True.

  • ylim (tuple, optional) – The y-axis limits for the plot. Default value is None.

Returns:

The matplotlib plot of response value versus 1 predictor variable.

Return type:

fig (Figure)

Raises:
  • TypeError – If the optimizer is not an instance of obsidian Optimizer

  • UnfitError – If the optimizer is not fit

  • ValueError – If the feature_id is not a valid feature index

  • ValueError – If the response_id is not a valid response index

  • ValueError – If X_ref is provided and not a pd.Series

obsidian.plotting.plotly.optim_progress(campaign: Campaign, response_ids: int | tuple[int] | None = None, color_feature_id: int | None | str = 'Iteration', X_suggest: DataFrame | None = None) Figure[source]#

Generates a plotly figure to visualize optimization progress

Parameters:
  • campaign (Campaign) – The campaign object containing the data.

  • response_ids (list[int], optional) – The indices of the responses to plot. Defaults to [0, 1].

  • color_feature_id (int | None, optional) – The index of the feature to use for coloring the markers. Defaults to None, which will color by iteration.

  • X_suggest (pd.DataFrame | None, optional) – The suggested next experiments to evaluate. Defaults to None.

Returns:

The plotly figure.

Return type:

Figure

obsidian.plotting.plotly.parity_plot(optimizer: Optimizer, f_transform: bool = False, response_id: int = 0) Figure[source]#

Produces a plot of surrogate model predictions at an OFAT range in one variable.

Parameters:
  • optimizer (Optimizer) – The optimizer object which contains a surrogate that has been fit to data and can be used to make predictions.

  • f_transform (bool, optional) – An indicator for whether or not to plot the response value in the “objective function” form which is directly used by the optimizer, else using the “measured response” form which the optimizer preproceses. Default value is False which plots the raw measured response scale.

  • response_id (int, optional) – Index of the response for potential multi-response models. Default value is 0 (single-response).

Returns:

The optimizer fit parity plot

Return type:

fig (Figure)

Raises:
  • TypeError – If the optimizer is not an instance of obsidian Optimizer

  • UnfitError – If the optimizer is not fit

  • ValueError – If the response_id is not a valid response index

obsidian.plotting.plotly.surface_plot(optimizer: Optimizer, feature_ids: list[int, int] = [0, 1], response_id: int = 0, f_transform: bool = False, plot_bands: bool = True, plot_data: bool = False) Figure[source]#

Produces a surface plot of surrogate model predictions over a 2-parameter grid range.

Parameters:
  • optimizer (Optimizer) – The optimizer object which contains a surrogate that has been fit to data and can be used to make predictions.

  • feature_ids (list, optional) – A list of integers containing the indices of the desired variables to plot from the last data used to fit the surrogate model. Default value is [0,1].

  • f_transform (bool, optional) – An indicator for whether or not to plot the response value in the “objective function” form which is directly used by the optimizer, else using the “measured response” form which the optimizer preprocesses. Default value is False which plots the raw measured response scale.

  • plot_bands (bool, optional) – An indicator for whether or not to plot the confidence bands as a wire frame around the surface plot. Default is True.

  • plot_data (bool, optional) – An indicator for whether or not to plot the raw data locations. Default is False, as the data z-height can be misleading for >2D data on a 3D plot.

  • response_id (int, optional) – Index of the response for potential multi-response models. Default value is 0 (single-response).

Returns:

The matplotlib plot of surfaces over a 2-parameter grid.

Return type:

fig (Figure)

Raises:
  • TypeError – If the optimizer is not an instance of obsidian Optimizer

  • UnfitError – If the optimizer is not fit

  • ValueError – If the feature_ids are not valid feature indices

  • ValueError – If the response_id is not a valid response index

obsidian.plotting.plotly.visualize_inputs(campaign: Campaign) Figure[source]#

Visualizes the input variables of a campaign.

Parameters:

campaign (Campaign) – The campaign object containing the input data.

Returns:

The plotly Figure object containing the visualization.

Return type:

Figure