class_docstr: This class replaces each missing value with the average of all the last
  window_size (default=10) values.
  
  (If the first values are missing, they are replaced by the closest non
  missing value.)
class_docstr_tok: ["This","class","replaces","each","missing","value","with","the","average","of","all","the","last","window_size","(","default=10",")","values",".","(","If","the","first","values","are","missing",",","they","are","replaced","by","the","closest","non","missing","value",".",")"]
code: def __call__(self, values: np.ndarray) -> np.ndarray:
      if len(values) == 1 or np.isnan(values).all():
          return DummyValueImputation()(values)
      mask = np.isnan(values)
  
      # we cannot compute the mean with this method if there are nans so we
      # do a temporary fix of the nan just for the mean computation using
      # this:
      last_value_imputation = LastValueImputation()
      value_no_nans = last_value_imputation(values)
  
      adjusted_values_to_causality = np.concatenate(
          (
              np.repeat(value_no_nans[0], self.window_size + 1),
              value_no_nans[:-1],
          )
      )
  
      cumsum = np.cumsum(adjusted_values_to_causality)
  
      ar_res = (
          cumsum[self.window_size :] - cumsum[: -self.window_size]
      ) / float(self.window_size)
  
      values[mask] = ar_res[mask]
  
      # make sure that we do not leave the potential nan in the first
      # position:
      values[0] = value_no_nans[0]
  
      return values
  
imports: from typing import List, Optional, Union, Type
  import numpy
  import pandas
  from gluonts.core.component import validated
  from gluonts.dataset.common import DataEntry
  from gluonts.dataset.field_names import FieldName
  from gluonts.time_feature import TimeFeature
  from ._base import MapTransformation, SimpleTransformation
label_desc: Use image node_id 2 for calling the RollingMeanValueImputation obj's underlying member method code with example usage: obj.__call__(values) and returns: values, DummyValueImputation