whylogs.core.statistics.datatypes.variancetracker
¶
Module Contents¶
Classes¶
Class that implements variance estimates for streaming data and for |
-
class
whylogs.core.statistics.datatypes.variancetracker.
VarianceTracker
(count=0, sum=0.0, mean=0.0)¶ 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
(self, 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
(self)¶ Return an estimate of the sample standard deviation
-
variance
(self)¶ Return an estimate of the sample variance
-
merge
(self, 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 – A new variance tracker from the merged statistics
- Return type
-
copy
(self)¶ Return a copy of this tracker
-
to_protobuf
(self)¶ Return the object serialized as a protobuf message
- Returns
message
- Return type
VarianceMessage
-
static
from_protobuf
(message)¶ Load from a protobuf message
- Returns
variance_tracker
- Return type