class_docstr: Applies a lag transform to the input time series. Each x(i) gets mapped
  to x(i) - x(i-k). We include it as a moving average because we can consider
  the lag transform to be a k+1-step moving "average" with weights
  w = [-1, 0,..., 0, 1]. One may optionally left-pad the sequence with the
  first value in the time series.
class_docstr_tok: ["Applies","a","lag","transform","to","the","input","time","series",".","Each","x","(","i",")","gets","mapped","to","x","(","i",")","-","x","(","i-k",")",".","We","include","it","as","a","moving","average","because","we","can","consider","the","lag","transform","to","be","a","k+1-step","moving","``","average","''","with","weights","w","=","[","-1",",","0",",","...",",","0",",","1","]",".","One","may","optionally","left-pad","the","sequence","with","the","first","value","in","the","time","series","."]
code: def __call__(self, time_series: TimeSeries) -> TimeSeries:
      all_tk, all_xk = {}, {}
      new_vars = OrderedDict()
      for name, var in time_series.items():
          # Apply any x-padding or t-truncating necessary
          t, x = var.index, var.np_values
          all_xk[name] = x[: self.k]
          if self.pad:
              all_tk[name] = t[:0]
              x = np.concatenate((np.full(self.k, x[0]), x))
          else:
              all_tk[name] = t[: self.k]
              t = t[self.k :]
  
          if len(var) <= self.k and not self.pad:
              logger.warning(
                  f"Cannot apply a {self.k}-lag transform to a time series of length {len(var)} <= {self.k}"
              )
              new_vars[name] = UnivariateTimeSeries([], [])
          else:
              new_vars[name] = UnivariateTimeSeries(
                  t, x[self.k :] - x[: -self.k]
              )
  
      self.inversion_state = all_tk, all_xk
      return TimeSeries(new_vars)
  
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 3 for calling the LagTransform obj's underlying member method code with example usage: obj.__call__(time_series) and returns: TimeSeries