NoAgg#

class tpcp.validate.NoAgg(_value: T)[source]#

Wrapper to wrap one or multiple output values of a scorer to prevent aggregation of these values.

If one of the values in the return dictionary of a multi-value score function is wrapped with this class, the scorer will not aggregate the value. This allows to pass arbitary data from the score function through the scorer. As example, this could be some general metadata, some non-numeric scores, or an array of values (e.g. when the actual score is the mean of such values).

Examples

>>> def score_func(pipe, dataset):
...     ...
...     return {"score_val_1": score, "some_metadata": NoAgg(metadata)}
>>> my_scorer = Scorer(score_func)

Methods

aggregate(values, datapoints)

Return nothing, indicating no aggregation.

get_value()

Return the value wrapped by aggregator.

__init__(_value: T) None[source]#
classmethod aggregate(values: Sequence[Any], datapoints: Sequence[Dataset]) _Nothing[source]#

Return nothing, indicating no aggregation.

get_value() T[source]#

Return the value wrapped by aggregator.

Examples using tpcp.validate.NoAgg#

Custom Scorer

Custom Scorer