Mean
minnt.metrics.Mean
Bases: Metric
A class tracking the (optionally weighted) mean of given values.
Source code in minnt/metrics/mean.py
12 13 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 | |
__init__
__init__() -> None
Create the Mean metric object.
Source code in minnt/metrics/mean.py
15 16 17 18 19 | |
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.
Source code in minnt/metrics/mean.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
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
41 42 | |
reset
reset()
Reset the internal state of the metric.
Source code in minnt/metrics/mean.py
44 45 46 | |