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 _invert(self, time_series: TimeSeries) -> TimeSeries:
      all_tk, all_xk = self.inversion_state
      new_vars = OrderedDict()
      for name, var in time_series.items():
          tk, xk = all_tk[name], all_xk[name]
          t = tk.union(var.index)
          if len(t) == len(xk) + len(var):  # no padding
              y = np.concatenate((xk, var.np_values))
          elif len(t) == len(var):  # padding
              y = np.asarray(var.values)
              y[: len(xk)] = xk
          else:
              raise RuntimeError(
                  "Something went wrong: inversion state has unexpected size."
              )
  
          x = np.zeros(len(t))
          for i in range(self.k):
              x[i :: self.k] = np.cumsum(y[i :: self.k])
          new_vars[name] = UnivariateTimeSeries(t, x)
      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 4 for calling the LagTransform obj's underlying member method code with example usage: obj._invert(time_series) and returns: TimeSeries