cascade.metrics#
- class cascade.metrics.Accuracy(value: SupportsFloat | None = None, name: str = 'accuracy', dataset: str | None = None, split: str | None = None, interval: Tuple[SupportsFloat, SupportsFloat] | None = None, extra: Dict[str, SupportsFloat] | None = None, **kwargs: Any)[source]#
Accuracy metric - the number of correct answers divided by the number of all
By default name is
accuracy
, can be changed Direction is always upCan be computed iteratively using
compute_add
- __init__(value: SupportsFloat | None = None, name: str = 'accuracy', dataset: str | None = None, split: str | None = None, interval: Tuple[SupportsFloat, SupportsFloat] | None = None, extra: Dict[str, SupportsFloat] | None = None, **kwargs: Any) None [source]#
Creates Metric
- Parameters:
name (str) – Name of the metric
value (Optional[MetricType]) – Scalar value of the metric, by default None
dataset (Optional[str]) – Dataset on which metric was computed, by default None
split (Optional[str]) – The split of the dataset for example train or test, by default None
direction (Literal["up", "down", None]) – Is metric better when it is greater or less, by default None
interval (Optional[Tuple[MetricType, MetricType]]) – Upper and lower boundaries of value, by default None
extra (Optional[Dict[str, Any]]) – Extra values that needs to be stored with metric, by default None
- class cascade.metrics.Loss(value: SupportsFloat | None = None, name: str = 'loss', dataset: str | None = None, split: str | None = None, **kwargs: Any)[source]#
Loss is the convenience metric which by default has name
loss
and is always directed down
- class cascade.metrics.Metric(name: str, value: SupportsFloat | None = None, dataset: str | None = None, split: str | None = None, direction: Literal['up', 'down'] | None = None, interval: Tuple[SupportsFloat, SupportsFloat] | None = None, extra: Dict[str, Any] | None = None)[source]#
Base class for every metric, defines the way of computation and serves as the value and metadata storage
Metrics should always be scalar. If your metric returns some complex types like dicts or lists consider using multiple Metric objects. Or if values are connected, use extra keyword.
- __init__(name: str, value: SupportsFloat | None = None, dataset: str | None = None, split: str | None = None, direction: Literal['up', 'down'] | None = None, interval: Tuple[SupportsFloat, SupportsFloat] | None = None, extra: Dict[str, Any] | None = None) None [source]#
Creates Metric
- Parameters:
name (str) – Name of the metric
value (Optional[MetricType]) – Scalar value of the metric, by default None
dataset (Optional[str]) – Dataset on which metric was computed, by default None
split (Optional[str]) – The split of the dataset for example train or test, by default None
direction (Literal["up", "down", None]) – Is metric better when it is greater or less, by default None
interval (Optional[Tuple[MetricType, MetricType]]) – Upper and lower boundaries of value, by default None
extra (Optional[Dict[str, Any]]) – Extra values that needs to be stored with metric, by default None
- compute(*args: Any, **kwargs: Any) SupportsFloat [source]#
The method to compute metric’s value. Should always populate the internal
self.value
field and return it.
- cascade.metrics.MetricType#
alias of
SupportsFloat