pywsi.stats package

Module contents

pywsi.stats.welford_simulatenous_update(prev_avg, prev_M2, new_value, count)[source]

Perform Welford’s simulatenous update on mean and variance

M2 = n*sigma_n^2

Parameters:
prev_avg: array_like

Vector of (count-1)th step averages

prev_M2: array_like

Vector of (count-1)th step M2 stats

new_value: array_like

New incoming values vector

count: int

Current count (count starts from 1)

Returns:
new_avg: array_like

Updated average

new_M2: array_like

Updated M2 stats

new_var: array_like

Population variance

new_samplevar: array_like

Sample Variance

pywsi.stats.welford_update_M1(prev_avg, new_value, count)[source]

Welford’s updated mean.

mu_{n} = mu_{n-1} + 1/n(x_n - mu_{n-1}).

Parameters:
prev_avg: array_like

Vector of (count-1)th step averages

new_value: array_like

New incoming values vector

count: int

Current count (count starts from 1)

Returns:
new_avg: array_like

Updated average

pywsi.stats.welford_update_M2(prev_M2, new_value, prev_avg, new_avg)[source]

Welford’s updated variance.

S_n = S_{n-1} + (x_n-mu_{n-1})(x_n-mu_n)

Parameters:
prev_M2: array_like

Vector of (count-1)th step M2 stats

new_value: array_like

New incoming values vector

prev_avg: array_like

Vector of (count-1)th step averages

count: int

Current count (count starts from 1)

Returns:
new_M2: array_like

Updated M2 stats