piglot.objectives.analytical.AnalyticalSingleObjective
- class AnalyticalSingleObjective(parameters: ParameterSet, expression: str, variance: str | None = None, random_evals: int = 0, maximise: bool = False, weight: float = 1.0, bounds: Tuple[float, float] | None = None)[source]
Bases:
IndividualObjectiveObjective function derived from an analytical expression.
Methods
Evaluate objective value for the given results.
Plot the objective in 1D.
Plot the objective in 2D.
Read the objective from a configuration dictionary.
- evaluate(params: ndarray, use_random: bool = True) Tuple[float, float][source]
Evaluate objective value for the given results.
Parameters
- paramsnp.ndarray
Parameter values for this evaluation.
- use_randombool
Whether to use random evaluations (true by default).
Returns
- Tuple[float, float]
Mean and variance of the objective.
- plot_1d(values: ndarray, append_title: str) Figure[source]
Plot the objective in 1D.
Parameters
- valuesnp.ndarray
Parameter values to plot for.
- append_titlestr
String to append to the title.
Returns
- Figure
Figure with the plot.
- plot_2d(values: ndarray, append_title: str) Figure[source]
Plot the objective in 2D.
Parameters
- valuesnp.ndarray
Parameter values to plot for.
- append_titlestr
String to append to the title.
Returns
- Figure
Figure with the plot
- classmethod read(config: Dict[str, Any], parameters: ParameterSet) AnalyticalSingleObjective[source]
Read the objective from a configuration dictionary.
Parameters
- configDict[str, Any]
Terms from the configuration dictionary.
- parametersParameterSet
Set of parameters for this problem.
Returns
- AnalyticalSingleObjective
Objective function to optimise.