ClassificationMetric

class ClassificationMetric[source]

Bases: Metric

A base class for classification metrics.

Attributes Summary

binarize

whether the metric needs binarized scores

closed_expectation

whether there is a closed-form solution of the expectation

closed_variance

whether there is a closed-form solution of the variance

key

Return the key for use in metric result dictionaries.

supports_weights

whether the metric supports weights

synonyms

synonyms for this metric

Methods Summary

extra_repr()

Generate the extra repr, cf.

get_description()

Get the description.

get_link()

Get the link from the docdata.

get_range()

Get the math notation for the range of this metric.

iter_extra_repr()

Iterate over the components of the extra_repr().

score(y_true, y_score)

Run the scoring function.

Attributes Documentation

binarize: ClassVar[Optional[bool]] = None

whether the metric needs binarized scores

closed_expectation: ClassVar[bool] = False

whether there is a closed-form solution of the expectation

closed_variance: ClassVar[bool] = False

whether there is a closed-form solution of the variance

key

Return the key for use in metric result dictionaries.

Return type

str

supports_weights: ClassVar[bool] = False

whether the metric supports weights

synonyms: ClassVar[Collection[str]] = ()

synonyms for this metric

Methods Documentation

extra_repr()

Generate the extra repr, cf. :meth`torch.nn.Module.extra_repr`.

Return type

str

Returns

the extra part of the repr()

classmethod get_description()[source]

Get the description.

Return type

str

Get the link from the docdata.

Return type

str

classmethod get_range()

Get the math notation for the range of this metric.

Return type

str

iter_extra_repr()

Iterate over the components of the extra_repr().

This method is typically overridden. A common pattern would be

def iter_extra_repr(self) -> Iterable[str]:
    yield from super().iter_extra_repr()
    yield "<key1>=<value1>"
    yield "<key2>=<value2>"
Return type

Iterable[str]

Returns

an iterable over individual components of the extra_repr()

classmethod score(y_true, y_score)[source]

Run the scoring function.

Return type

float