code: def rmse(target, prediction, relative=False, percent=False):
      
      relative = relative or percent
      prediction = pd.np.array(prediction)
      target = np.array(target)
      err = prediction - target
      if relative:
          denom = target
          # Avoid ZeroDivisionError: divide by prediction rather than target where target==0
          denom[denom == 0] = prediction[denom == 0]
          # If the prediction and target are both 0, then the error is 0 and should be included in the RMSE
          # Otherwise, the np.isinf() below would remove all these zero-error predictions from the array.
          denom[(denom == 0) & (target == 0)] = 1
          err = (err / denom)
          err = err[(~ np.isnan(err)) & (~ np.isinf(err))]
      return 100 * rms(err) if percent else rms(err)
docs: Root Mean Square Error
  
      This seems like a simple formula that you'd never need to create a function for.
      But my mistakes on coding challenges have convinced me that I do need it,
      as a reminder of important tweaks, if nothing else.
  
      >>> rmse([0, 1, 4, 3], [2, 1, 0, -1])
      3.0
      >>> rmse([0, 1, 4, 3], [2, 1, 0, -1], relative=True)  # doctest: +ELLIPSIS
      1.2247...
      >>> rmse([0, 1, 4, 3], [2, 1, 0, -1], percent=True)  # doctest: +ELLIPSIS
      122.47...