class_docstr: Computes the exponential moving average (normalized or un-normalized) of the
  time series, with smoothing factor alpha (lower alpha = more smoothing).
  alpha must be between 0 and 1.
  
  The unnormalized moving average ``y`` of ``x`` is computed as
  
  .. math::
      \begin{align*}
      y_0 & = x_0 \\
      y_i & = (1 - \alpha) \cdot y_{i-1} + \alpha \cdot x_i
      \end{align*}
  
  The normalized moving average ``y`` of ``x`` is computed as
  
  .. math::
  
      y_i = \frac{x_i + (1 - \alpha) x_{i-1} + \ldots + (1 - \alpha)^i x_0}
      {1 + (1 - \alpha) + \ldots + (1 - \alpha)^i}
  
  Upper and lower confidence bounds, ``l`` and ``u``, of the exponential moving
  average are computed using the exponential moving standard deviation, ``s``, and ``y`` as
  
  .. math::
      l_i = y_i + z_{\frac{1}{2} (1-p)} \times s_i \\
      u_i = u_o + z_{\frac{1}{2} (1+p)} \times s_i
  
  If condfidence bounds are included, the returned time series will contain
  the upper and lower bounds as additional univariates. For example if the 
  transform is applied to a time series with two univariates "x" and "y", 
  the resulting time series will contain univariates with the following names:
  "x", "x_lb", "x_ub", "y", "y_lb", "y_ub".
class_docstr_tok: ["Computes","the","exponential","moving","average","(","normalized","or","un-normalized",")","of","the","time","series",",","with","smoothing","factor","alpha","(","lower","alpha","=","more","smoothing",")",".","alpha","must","be","between","0","and","1",".","The","unnormalized","moving","average","``","y","``","of","``","x","``","is","computed","as","..","math",":",":","\\begin","{","align","*","}","y_0","&","=","x_0","\\\\","y_i","&","=","(","1","-","\\alpha",")","\\cdot","y_","{","i-1","}","+","\\alpha","\\cdot","x_i","\\end","{","align","*","}","The","normalized","moving","average","``","y","``","of","``","x","``","is","computed","as","..","math",":",":","y_i","=","\\frac","{","x_i","+","(","1","-","\\alpha",")","x_","{","i-1","}","+","\\ldots","+","(","1","-","\\alpha",")","^i","x_0","}","{","1","+","(","1","-","\\alpha",")","+","\\ldots","+","(","1","-","\\alpha",")","^i","}","Upper","and","lower","confidence","bounds",",","``","l","``","and","``","u","``",",","of","the","exponential","moving","average","are","computed","using","the","exponential","moving","standard","deviation",",","``","s","``",",","and","``","y","``","as","..","math",":",":","l_i","=","y_i","+","z_","{","\\frac","{","1","}","{","2","}","(","1-p",")","}","\\times","s_i","\\\\","u_i","=","u_o","+","z_","{","\\frac","{","1","}","{","2","}","(","1+p",")","}","\\times","s_i","If","condfidence","bounds","are","included",",","the","returned","time","series","will","contain","the","upper","and","lower","bounds","as","additional","univariates",".","For","example","if","the","transform","is","applied","to","a","time","series","with","two","univariates","``","x","''","and","``","y","''",",","the","resulting","time","series","will","contain","univariates","with","the","following","names",":","''","x","''",",","``","x_lb","''",",","``","x_ub","''",",","``","y","''",",","``","y_lb","''",",","``","y_ub","''","."]
docstr: :param alpha: smoothing factor to use for exponential weighting.
  :param normalize: If True, divide by the decaying adjustment in
      beginning periods.
  :param p: confidence level to use if returning the upper and lower
      bounds of the confidence interval.
  :param ci: If True, return the the upper and lower confidence bounds
      of the the exponential moving average as well.
docstr_tok: [":","param","alpha",":","smoothing","factor","to","use","for","exponential","weighting",".",":","param","normalize",":","If","True",",","divide","by","the","decaying","adjustment","in","beginning","periods",".",":","param","p",":","confidence","level","to","use","if","returning","the","upper","and","lower","bounds","of","the","confidence","interval",".",":","param","ci",":","If","True",",","return","the","the","upper","and","lower","confidence","bounds","of","the","the","exponential","moving","average","as","well","."]
code: def __init__(
      self,
      alpha: float,
      normalize: bool = True,
      p: float = 0.95,
      ci: bool = False,
  ):
      """
      :param alpha: smoothing factor to use for exponential weighting.
      :param normalize: If True, divide by the decaying adjustment in
          beginning periods.
      :param p: confidence level to use if returning the upper and lower
          bounds of the confidence interval.
      :param ci: If True, return the the upper and lower confidence bounds
          of the the exponential moving average as well.
      """
      super().__init__()
      self.alpha = alpha
      self.normalize = normalize
      self.p = p
      self.ci = ci
  
imports: from collections import OrderedDict
  import logging
  from typing import Sequence
  import numpy
  import scipy.signal
  from scipy.stats import norm
  from merlion.transform.base import TransformBase, InvertibleTransformBase
  from merlion.utils import UnivariateTimeSeries, TimeSeries
label_desc: Use image node_id 1 to create a new ExponentialMovingAverage object from inherited base classes: InvertibleTransformBase with example: obj = ExponentialMovingAverage(alpha, normalize, p, ci)