PCAScanResult

class PCAScanResult(x_offsets, y_offsets, values, parameter_sets, center, principal_component_x, principal_component_y, explained_variance_ratio, projected_samples, scan_component_ids, program_type)[source]

Bases: object

Attributes Summary

Methods Summary

plot(*[, ax, show, levels, add_colorbar, ...])

Plot the sampled PCA landscape and return (fig, ax).

plot_3d(*[, ax, show])

Render the PCA landscape as a 3D surface and return (fig, ax).

Attributes Documentation

center: ndarray[tuple[Any, ...], dtype[float64]]
explained_variance_ratio: ndarray[tuple[Any, ...], dtype[float64]]
parameter_sets: ndarray[tuple[Any, ...], dtype[float64]]
principal_component_x: ndarray[tuple[Any, ...], dtype[float64]]
principal_component_y: ndarray[tuple[Any, ...], dtype[float64]]
program_type: str
projected_samples: ndarray[tuple[Any, ...], dtype[float64]]
scan_component_ids: tuple[int, int]
values: ndarray[tuple[Any, ...], dtype[float64]]
x_offsets: ndarray[tuple[Any, ...], dtype[float64]]
y_offsets: ndarray[tuple[Any, ...], dtype[float64]]

Methods Documentation

plot(*, ax=None, show=False, levels=20, add_colorbar=True, show_samples=True, sample_kwargs=None, show_trajectory=False, trajectory_kwargs=None, show_gradients=False, gradient_kwargs=None, **contour_kwargs)[source]

Plot the sampled PCA landscape and return (fig, ax).

Parameters:
  • ax – Optional matplotlib axes to draw into. When omitted, a new figure and axes are created.

  • show (bool) – Whether to call matplotlib.pyplot.show() after drawing.

  • levels (int) – Number of discrete color bands (BoundaryNorm) for pcolormesh.

  • add_colorbar (bool) – Whether to attach a colorbar to the figure.

  • show_samples (bool) – Whether to overlay the projected PCA samples on top of the heatmap.

  • sample_kwargs (dict | None) – Optional keyword arguments forwarded to ax.scatter for the PCA sample overlay.

  • show_trajectory (bool) – Whether to draw a connected line through projected_samples in order. The samples must have been supplied in temporal order (e.g. from param_history()).

  • trajectory_kwargs (dict | None) – Optional keyword arguments forwarded to ax.plot for the trajectory line. Defaults to a thin white line with start/end markers.

  • show_gradients (bool) – Whether to overlay a quiver plot of the numerical gradient (computed via numpy.gradient() on the grid).

  • gradient_kwargs (dict | None) – Optional keyword arguments forwarded to ax.quiver for the gradient overlay.

  • **contour_kwargs – Additional keyword arguments forwarded to ax.pcolormesh (corner_mask is ignored). PCA scans use a cell heatmap instead of contourf so noisy objectives still fill the axes.

Returns:

(fig, ax) for the rendered plot.

Return type:

tuple

plot_3d(*, ax=None, show=False, **surface_kwargs)[source]

Render the PCA landscape as a 3D surface and return (fig, ax).

Parameters:
  • ax – Optional Axes3D. When omitted, a new figure with a 3D projection is created.

  • show (bool) – Whether to call matplotlib.pyplot.show() after drawing.

  • **surface_kwargs – Additional keyword arguments forwarded to ax.plot_surface.

Returns:

(fig, ax) for the rendered 3D plot.

Return type:

tuple