piglot.objectives.response_objective.ResponseSingleObjective
- class ResponseSingleObjective(name: str, prediction: List[str], quantity: Reduction, maximise: bool = False, weight: float = 1.0, bounds: Tuple[float, float] | None = None, flatten_utility: FlattenUtility | None = None, prediction_transform: ResponseTransformer | None = None)[source]
Bases:
IndividualObjective,ABCBase class for generic response-based objectives.
Methods
Evaluate objective value for the given results.
Evaluate the objective value(s) from the latent space representation.
Compute latent space representation of the given results (for composite objectives).
Plot the response for this objective.
Read the objective spec from the configuration dictionary.
- evaluate(params: ndarray, raw_results: Dict[str, OutputResult]) Tuple[float, float][source]
Evaluate objective value for the given results.
Parameters
- paramsnp.ndarray
Parameter values for this evaluation.
- raw_resultsDict[str, OutputResult]
Raw responses from the solver.
Returns
- Tuple[float, float]
Mean and variance of the objective.
- evaluate_from_latent_space(params: Tensor, latent_responses: Tensor) Tensor[source]
Evaluate the objective value(s) from the latent space representation.
Parameters
- paramstorch.Tensor
Parameter values for these results.
- latent_responsestorch.Tensor
Response(s) in the latent space representation.
Returns
- torch.Tensor
Objective value(s) for the response(s).
- latent_space(raw_results: Dict[str, OutputResult]) Tuple[ndarray, ndarray][source]
Compute latent space representation of the given results (for composite objectives).
Parameters
- raw_resultsDict[str, OutputResult]
Raw responses from the solver.
Returns
- Tuple[np.ndarray, np.ndarray]
Mean and variance of the latent space representation.
- abstract plot(axis: Axes, raw_results: Dict[str, OutputResult]) Dict[Line2D, str][source]
Plot the response for this objective.
Parameters
- axisplt.Axes
Axis to plot the response on.
- raw_resultsDict[str, OutputResult]
Raw responses from the solver.
Returns
- Dict[Line2D, str]
Mapping of lines to response names (for dynamically updating plots).
- abstract classmethod read(name: str, config: Dict[str, Any], output_dir: str) T[source]
Read the objective spec from the configuration dictionary.
Parameters
- namestr
Name of the objective.
- configDict[str, Any]
Configuration dictionary.
- output_dir: str
Output directory.
Returns
- ResponseSingleObjective
Single objective to use.