mighty.utils.var_online.VarianceOnline¶
- class mighty.utils.var_online.VarianceOnline(tensor=None)[source]¶
Welford’s online algorithm for population mean and variance estimation.
Methods
__init__([tensor])activate(is_active)Activates or deactivates the updates.
get_mean()get_mean_std([unbiased])Return mean and std of all samples.
reset()Reset the mean and the count.
update(tensor)Update sample mean (and variance) from a batch of new values.
- activate(is_active)¶
Activates or deactivates the updates.
- Parameters:
- is_activebool
New state.
- get_mean()¶
- Returns:
- torch.Tensor
The mean of all tensors.