Results¶
The Results dataclass aggregates the metrics computed on a surrogate’s predictions
relative to the targets (for example, accuracy, recall, regret), storing
per-round metrics and summary statistics. The metrics computed depend on whether the
task is classification or regression; see alf_core.utils.metrics for more
details and examples. It is the primary return value of a completed ALF experiment
and is used to evaluate and compare experiment runs.
- class alf_core.dataclasses.results.Results(targets, predictions, problem_type)[source]¶
Bases:
objectComputes metrics based on the predictions and targets.
- targets¶
A numpy array of ground truth target values.
- predictions¶
A Predictions object containing model predictions.
- problem_type¶
Type of problem determining which metrics are computed.
- compute_metrics()[source]¶
Compute evaluation metrics based on predictions and targets.
For regression, routes to the variance-aware regression registry. For classification (binary or multiclass), routes to the classification metric registry using the probability array stored in
predictions.means.- Raises:
ValueError – If the problem type is unrecognized.
- Return type:
dict[str,Union[float,int,number]]- Returns:
A dictionary of metric names to their computed values.
- predictions: Predictions¶
- problem_type: ProblemType¶
- targets: ndarray¶