pyiron_contrib.protocol.math module

pyiron_contrib.protocol.math.welford_online(x, mean, std, k)[source]

Computes the cummulative mean and standard deviation.

Note: The standard deviation calculated is for the population (ddof=0). For the sample (ddof=1) it would need to be extended.

Parameters
  • x (float/numpy.ndarray) – The new sample.

  • mean (float/numpy.ndarray) – The mean so far.

  • std (float/numpy.ndarray) – The standard deviation so far.

  • k (int) – How many samples were used to calculate the existing mean and std.

Returns

The new mean and standard deviation for k+1 values.

Return type

float/numpy.ndarray, float/numpy.ndarray