class_docstr: Helper class for computing moving average and sliding window
class_docstr_tok: ["Helper","class","for","computing","moving","average","and","sliding","window"]
docstr: new instance of MovingAverage, so method .next() can be used
  @param windowSize - length of sliding window
  @param existingHistoricalValues - construct the object with already
      some values in it.
docstr_tok: ["new","instance","of","MovingAverage",",","so","method",".next","(",")","can","be","used","@","param","windowSize","-","length","of","sliding","window","@","param","existingHistoricalValues","-","construct","the","object","with","already","some","values","in","it","."]
code: def __init__(self, windowSize, existingHistoricalValues=None):
      """
      new instance of MovingAverage, so method .next() can be used
      @param windowSize - length of sliding window
      @param existingHistoricalValues - construct the object with already
          some values in it.
      """
      if not isinstance(windowSize, numbers.Integral):
          raise TypeError(
              "MovingAverage - windowSize must be integer type"
          )
      if windowSize <= 0:
          raise ValueError("MovingAverage - windowSize must be >0")
  
      self.windowSize = windowSize
      if existingHistoricalValues is not None:
          self.slidingWindow = existingHistoricalValues[
              len(existingHistoricalValues) - windowSize :
          ]
      else:
          self.slidingWindow = []
      self.total = float(sum(self.slidingWindow))
  
file_path: nupic-legacy/src/nupic/utils.py
imports: import numbers
  from nupic.serializable import Serializable
label_desc: Use image node_id 1 to create a new MovingAverage object from inherited base classes: Serializable with example: obj = MovingAverage(windowSize, existingHistoricalValues)