mlrl.testbed.experiments.output.evaluation.measures module¶
Author Michael Rapp (michael.rapp.ml@gmail.com)
Provides classes for implementing evaluation measures.
- class mlrl.testbed.experiments.output.evaluation.measures.AggregationMeasure(option_key: str, name: str, aggregation_function: AggregationFunction, can_be_averaged: bool = True, **kwargs)¶
Bases:
OutputValueAn aggregation measure that aggregates evaluation results for several experiments.
- aggregate(values: list[float], smaller_is_better: bool) Iterable[float]¶
Applies the aggregation function to given evaluation results.
- Parameters:
values – A list that stores the values to be aggregated
smaller_is_better – True, if smaller values are better than larger ones, False otherwise
- Returns:
An iterable that provides access to the aggregated values
- class mlrl.testbed.experiments.output.evaluation.measures.Measure(option_key: str, name: str, evaluation_function: EvaluationFunction, smaller_is_better: bool = False, percentage: bool = True, **kwargs)¶
Bases:
OutputValueAn evaluation measure.
- UNIT_SECONDS = 'seconds'¶
- evaluate(ground_truth: Any, predictions: Any) float¶
Applies the evaluation function to given predictions and the corresponding ground truth.
- Parameters:
ground_truth – A numpy.ndarray, scipy.sparse.spmatrix or scipy.sparse.sparray, shape (num_examples, num_outputs), that stores the ground truth
predictions – A numpy.ndarray, scipy.sparse.spmatrix or scipy.sparse.sparray, shape (num_examples, num_outputs), that stores the predictions to be evaluated
- Returns:
An evaluation score in [0, 1]