code: def RMSE(params, *args):
      Y = args[0]
      type = args[1]
      rmse = 0
  
      if type == "linear":
          alpha, beta = params
          a = [Y[0]]
          b = [Y[1] - Y[0]]
          y = [a[0] + b[0]]
  
          for i in range(len(Y)):
              a.append(alpha * Y[i] + (1 - alpha) * (a[i] + b[i]))
              b.append(beta * (a[i + 1] - a[i]) + (1 - beta) * b[i])
              y.append(a[i + 1] + b[i + 1])
  
      else:
          alpha, beta, gamma = params
          m = args[2]
          a = [sum(Y[0:m]) / float(m)]
          b = [(sum(Y[m : 2 * m]) - sum(Y[0:m])) / m**2]
  
          if type == "additive":
              s = [Y[i] - a[0] for i in range(m)]
              y = [a[0] + b[0] + s[0]]
  
              for i in range(len(Y)):
                  a.append(
                      alpha * (Y[i] - s[i])
                      + (1 - alpha) * (a[i] + b[i])
                  )
                  b.append(beta * (a[i + 1] - a[i]) + (1 - beta) * b[i])
                  s.append(
                      gamma * (Y[i] - a[i] - b[i]) + (1 - gamma) * s[i]
                  )
                  y.append(a[i + 1] + b[i + 1] + s[i + 1])
  
          elif type == "multiplicative":
              s = [Y[i] / a[0] for i in range(m)]
              y = [(a[0] + b[0]) * s[0]]
  
              for i in range(len(Y)):
                  a.append(
                      alpha * (Y[i] / s[i])
                      + (1 - alpha) * (a[i] + b[i])
                  )
                  b.append(beta * (a[i + 1] - a[i]) + (1 - beta) * b[i])
                  s.append(
                      gamma * (Y[i] / (a[i] + b[i]))
                      + (1 - gamma) * s[i]
                  )
                  y.append((a[i + 1] + b[i + 1]) * s[i + 1])
  
          else:
              exit(
                  "Type must be either linear, additive or multiplicative"
              )
  
      rmse = sqrt(
          sum([(m - n) ** 2 for m, n in zip(Y, y[:-1])]) / len(Y)
      )
  
      return rmse
  
file_path: lore/lore/estimators/holt_winters/holtwinters.py
imports: from __future__ import division
  from sys import exit
  from math import sqrt
  from numpy import array
  from scipy.optimize import fmin_l_bfgs_b
label_desc: Use image node_id 1 for calling a global function with example usage: RMSE(params) and returns: rmse