class_docstr: A mutable class that allows us to aggregate values and report mean/stddev.
class_docstr_tok: ["A","mutable","class","that","allows","us","to","aggregate","values","and","report","mean\/stddev","."]
code: def add(self, x) -> "Stat":
      # Skip Nones for statistic aggregation.
      if x is None:
          return self
      if isinstance(x, bool):
          x = 1 if x is True else 0
      self.sum += x
      self.sum_squared += x * x
      self.min = min(self.min, x) if self.min is not None else x
      self.max = max(self.max, x) if self.max is not None else x
      self.count += 1
      self._update_mean_variance_stddev()
      return self
  
file_path: H2O/h2o_hf/helm/src/helm/benchmark/metrics/statistic.py
imports: from dataclasses import dataclass, replace
  import math
  from typing import Dict, Optional
  from .metric_name import MetricName
label_desc: Use image node_id 1 for calling the Stat obj's underlying member method code with example usage: obj.add(x) and returns: self, self