trieste.experimental.plotting.plotting_plotly
#
Module Contents#
-
format_point_markers
(num_pts: int, num_init: int, idx_best: Optional[int] = None, mask_fail: Optional[trieste.types.TensorType] = None, m_init: str = 'x', m_add: str = 'circle', c_pass: str = 'green', c_fail: str = 'red', c_best: str = 'darkmagenta') → tuple[trieste.types.TensorType, trieste.types.TensorType][source]# Prepares point marker styles according to some BO factors
- Parameters
num_pts – total number of BO points
num_init – initial number of BO points
idx_best – index of the best BO point
mask_fail – Bool vector, True if the corresponding observation violates the constraint(s)
m_init – marker for the initial BO points
m_add – marker for the other BO points
c_pass – color for the regular BO points
c_fail – color for the failed BO points
c_best – color for the best BO points
- Returns
2 string vectors col_pts, mark_pts containing marker styles and colors
-
add_surface_plotly
(xx: trieste.types.TensorType, yy: trieste.types.TensorType, f: trieste.types.TensorType, fig: plotly.graph_objects.Figure, alpha: float = 1.0, figrow: int = 1, figcol: int = 1) → plotly.graph_objects.Figure[source]# Adds a surface to an existing plotly subfigure
- Parameters
xx – [n, n] array (input)
yy – [n, n] array (input)
f – [n, n] array (output)
fig – the current plotly figure
alpha – transparency
figrow – row index of the subfigure
figcol – column index of the subfigure
- Returns
updated plotly figure
-
add_bo_points_plotly
(x: trieste.types.TensorType, y: trieste.types.TensorType, z: trieste.types.TensorType, fig: plotly.graph_objects.Figure, num_init: int, idx_best: Optional[int] = None, mask_fail: Optional[trieste.types.TensorType] = None, figrow: int = 1, figcol: int = 1) → plotly.graph_objects.Figure[source]# Adds scatter points to an existing subfigure. Markers and colors are chosen according to BO factors. :param x: [N] x inputs :param y: [N] y inputs :param z: [N] z outputs :param fig: the current plotly figure :param num_init: initial number of BO points :param idx_best: index of the best BO point :param mask_fail: Bool vector, True if the corresponding observation violates the constraint(s) :param figrow: row index of the subfigure :param figcol: column index of the subfigure :return: a plotly figure
-
plot_model_predictions_plotly
(model: trieste.models.interfaces.ProbabilisticModel, mins: trieste.types.TensorType, maxs: trieste.types.TensorType, grid_density: int = 100, num_samples: Optional[int] = None, alpha: float = 0.85) → plotly.graph_objects.Figure[source]# Plots 2-dimensional plot of model’s predictions. We first create a regular grid of points and evaluate the model on these points. We then plot the mean and 2 standard deviations to show epistemic uncertainty.
For
DeepGaussianProcess
modelsnum_samples
should be used and set to some positive number. This is needed as predictions from deep GP’s are stochastic and we need to take more than one sample to estimate the mean and variance.- Parameters
model – A probabilistic model
mins – List of 2 lower bounds for creating a grid of points for model predictions.
maxs – List of 2 upper bounds for creating a grid of points for model predictions.
grid_density – Number of points per dimension. This will result in a grid size of grid_density^2.
num_samples – Number of samples to use with deep GPs.
alpha – Transparency.
- Returns
A plotly figure.
-
plot_function_plotly
(obj_func: Callable[[trieste.types.TensorType], trieste.types.TensorType], mins: trieste.types.TensorType, maxs: trieste.types.TensorType, grid_density: int = 100, title: Optional[str] = None, xlabel: Optional[str] = None, ylabel: Optional[str] = None, alpha: float = 1.0) → plotly.graph_objects.Figure[source]# Plots 2-dimensional plot of an objective function. To illustrate the function we create a regular grid of points and evaluate the function on these points.
- Parameters
obj_func – The vectorized objective function.
mins – List of 2 lower bounds for creating a grid of points for model predictions.
maxs – List of 2 upper bounds for creating a grid of points for model predictions.
grid_density – Number of points per dimension. This will result in a grid size of grid_density^2.
title – optional titles
xlabel – optional xlabel
ylabel – optional ylabel
alpha – transparency
- Returns
A plotly figure.