axtreme.plotting.gp_fit

Plotting module for visualizing how well the GP fits the data.

Functions

plot_1d_model(model[, X, ax])

Plots a model with 1d in put, and any number of outputs..

plot_gp_fits_2d_surface(model_bridge, ...[, ...])

Plot the GP fit for the given metrics over the 2D search space.

plot_surface_over_2d_search_space(...[, ...])

Creates a figure with the functions in funcs ploted over the search_space.

scatter_plot_training(model_bridge, metric_name)

Make a scattter plot of a metric for the training data of the model.

axtreme.plotting.gp_fit.plot_1d_model(model: SingleTaskGP, X: Tensor | None = None, ax: None | Axes = None) Axes

Plots a model with 1d in put, and any number of outputs..

Parameters:
  • model – Only SingleTaskGp is supported an training data is extracted from the model.

  • X – (n,1): Linspace of [0,1] is used by default. Only 1d is currently supported.

  • ax – will plot to this axis if provied

axtreme.plotting.gp_fit.plot_gp_fits_2d_surface(model_bridge: TorchModelBridge, search_space: SearchSpace, metrics: dict[str, Callable[[ndarray[tuple[int, int], dtype[float64]]], ndarray[tuple[int], dtype[float64]]]] | None = None, num_points: int = 101) Figure

Plot the GP fit for the given metrics over the 2D search space.

Parameters:
  • model_bridge – The model bridge used to make predictions.

  • search_space – The search space over which the functions are to be evaluated and plotted.

  • metrics – A dictionary of metrics to plot. The keys are the names of the metrics in the model bridge model and the values are callables that return the metric value for a given input.

  • num_points – The number of points in each dimension to evaluate the functions at.

axtreme.plotting.gp_fit.plot_surface_over_2d_search_space(search_space: SearchSpace, funcs: list[Callable[[ndarray[tuple[int, int], dtype[float64]]], ndarray[tuple[int], dtype[float64]]]], colors: list[str] | None = None, num_points: int = 101) Figure

Creates a figure with the functions in funcs ploted over the search_space.

Note

Currently only support search spaces with 2 parameters.

Parameters:
  • search_space – The search space over which the functions are to be evaluated and plotted.

  • funcs – A list of callables that take in a numpy array with shape (num_values, num_parameters=2 ) and return a numpy array with (num_values) elements.

  • colors – A list of colors to use for each function. If None, will use default Plotly colors.

  • num_points – The number of points in each dimension to evaluate the functions at.

axtreme.plotting.gp_fit.scatter_plot_training(model_bridge: TorchModelBridge, metric_name: str, axis: tuple[int, int] = (0, 1), figure: Figure | None = None, *, error_bars: bool = True, error_bar_confidence_interval: float = 0.95) Figure

Make a scattter plot of a metric for the training data of the model.

Parameters:
  • model_bridge – The model the training data scatter plot is to be made for.

  • metric_name – The name of the metric to plot. Must match the name of a metric in the model.

  • axis – The axis of the input space to plot the scatter plot in

  • figure – The figure to add the scatter plot to. If None, a new figure is created.

  • error_bars – Whether to add error bars to the plot.

  • error_bar_confidence_interval – The confidence interval the error bars in the scatter plot represents.

Returns:

A Scatter3d plot of the training data for the given metric.