whylogs.core.statistics.datatypes.variancetracker

VarianceTracker Objects#

class VarianceTracker()

Class that implements variance estimates for streaming data and for batched data.

Parameters#

count Number tracked elements sum Sum of all numbers mean Current estimate of the mean

update#

| update(new_value)

Add a number to tracking estimates

Based on https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm

Parameters#

new_value : int, float

stddev#

| stddev()

Return an estimate of the sample standard deviation

variance#

| variance()

Return an estimate of the sample variance

merge#

| merge(other: "VarianceTracker")

Merge statistics from another VarianceTracker into this one

See: https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm

Parameters#

other : VarianceTracker Other variance tracker

Returns#

merged : VarianceTracker A new variance tracker from the merged statistics

copy#

| copy()

Return a copy of this tracker

to_protobuf#

| to_protobuf()

Return the object serialized as a protobuf message

Returns#

message : VarianceMessage

from_protobuf#

| @staticmethod
| from_protobuf(message)

Load from a protobuf message

Returns#

variance_tracker : VarianceTracker