def NRMSE_sliding(data, pred, windowSize):
  """
  Computing NRMSE in a sliding window
  :param data:
  :param pred:
  :param windowSize:
  :return: (window_center, NRMSE)
  """

  halfWindowSize = int(round(float(windowSize)/2))
  window_center = range(halfWindowSize, len(data)-halfWindowSize, int(round(float(halfWindowSize)/5.0)))
  nrmse = []
  for wc in window_center:
    nrmse.append(NRMSE(data[wc-halfWindowSize:wc+halfWindowSize],
                       pred[wc-halfWindowSize:wc+halfWindowSize]))

  return (window_center, nrmse)
Computing NRMSE in a sliding window
  :param data:
  :param pred:
  :param windowSize:
  :return: (window_center, NRMSE)