pybop._result#
Classes#
Stores the result of the optimisation. |
Module Contents#
- class pybop._result.OptimisationResult(optim: pybop.BaseOptimiser, logger: pybop.Logger, time: float, optim_name: str | None = None, message: str | None = None, scipy_result=None)[source]#
Stores the result of the optimisation.
- logger#
The log of the optimisation process.
- Type:
- scipy_result[source]#
The result obtained from a SciPy optimiser.
- Type:
scipy.optimize.OptimizeResult, optional
- __str__() str[source]#
A string representation of the OptimisationResult object.
- Returns:
A formatted string containing optimisation result information.
- Return type:
str
- _check_for_finite_cost() None[source]#
Validate the optimised parameters and ensure they produce a finite cost value.
- Raises:
ValueError – If the optimised parameters do not produce a finite cost value.
- static combine(results: list[OptimisationResult]) OptimisationResult[source]#
Combine multiple OptimisationResult objects into a single one.
- Parameters:
results (list[OptimisationResult]) – List of OptimisationResult objects to combine.
- Returns:
Combined OptimisationResult object.
- Return type:
- plot_contour(**kwargs)[source]#
Generate and plot a 2D visualisation of the cost landscape with the optimisation trace.
- Parameters:
gradient (bool, optional) – If True, gradient plots are also generated (default: False).
bounds (numpy.ndarray | list[list[float]], optional) – A 2x2 array specifying the [min, max] bounds for each parameter.
transformed (bool, optional) – Uses the transformed parameter values, as seen by the optimiser (default: False).
steps (int, optional) – The number of grid points to divide the parameter space into along each dimension (default: 10).
show (bool, optional) – If True, the figure is shown upon creation (default: True).
**layout_kwargs (optional) – Valid Plotly layout keys and their values.
- plot_convergence(**kwargs)[source]#
Plot the evolution of the best cost during the optimisation.
- Parameters:
show (bool, optional) – If True, the figure is shown upon creation (default: True).
**layout_kwargs (optional) – Valid Plotly layout keys and their values.
- plot_parameters(**kwargs)[source]#
Plot the evolution of parameter values during the optimisation.
- Parameters:
show (bool, optional) – If True, the figure is shown upon creation (default: True).
**layout_kwargs (optional) – Valid Plotly layout keys and their values.
- plot_surface(**kwargs)[source]#
Plot a 2D representation of the Voronoi diagram with color-coded regions.
- Parameters:
bounds (numpy.ndarray, optional) – A 2x2 array specifying the [min, max] bounds for each parameter.
normalise (bool, optional) – If True, the voronoi regions are computed using the Euclidean distance between points normalised with respect to the bounds (default: True).
resolution (int, optional) – Resolution of the plot (default: 500).
show (bool, optional) – If True, the figure is shown upon creation (default: True).
**layout_kwargs (optional) – Valid Plotly layout keys and their values.
- total_evaluations() numpy.floating | None[source]#
Calculates the total number of evaluations across all runs.
- total_iterations() numpy.floating | None[source]#
Calculates the total number of iterations across all runs.
- property optim: pybop.BaseOptimiser[source]#
The optimisation problem.