Mean
minnt.metrics.Mean
Bases: Metric
A class tracking the (optionally weighted) mean of given values.
Source code in minnt/metrics/mean.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
__init__
__init__(device: device | None = None) -> None
Create the Mean metric object.
Source code in minnt/metrics/mean.py
17 18 19 20 21 | |
update
Update the accumulated mean by introducing new values.
Optional sample weight might be provided; if not, all values are weighted with 1.
Parameters:
-
y(Tensor) –The values to average.
-
y_true(Tensor | None, default:None) –This parameter is present for minnt.Metric compatibility, but must be
Nonefor this metric. -
sample_weights(Tensor | None, default:None) –Optional sample weights. Their shape must be broadcastable to a prefix of the shape of
y.
Returns:
-
Self–self
Source code in minnt/metrics/mean.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
compute
compute() -> Tensor
Compute the accumulated metric value.
Returns:
-
Tensor–A (usually scalar) tensor representing the accumulated metric value.
Source code in minnt/metrics/mean.py
49 50 | |
reset
reset()
Reset the internal state of the metric.
Returns:
-
Self–self
Source code in minnt/metrics/mean.py
52 53 54 55 | |