mrdbourke / tensorflow-deep-learning

All course materials for the Zero to Mastery Deep Learning with TensorFlow course.
https://dbourke.link/ZTMTFcourse
MIT License
5.05k stars 2.5k forks source link

Notebook 10: MASE result for naive not correct #584

Open talha-0 opened 10 months ago

talha-0 commented 10 months ago

The mase for naive is not 1.0 because we are triming it 2 times when passing the y_test to evaluate_preds

def mean_absolute_scaled_error(y_true,y_pred):
  """
  Implement MASE (assuming no seasonality of data)
  """
  mae = tf.reduce_mean(tf.abs(y_true-y_pred))
  mae_naive_no_season = tf.reduce_mean(tf.abs(y_true[1:]-y_true[:-1])) # second time

  return mae/mae_naive_no_season
mean_absolute_scaled_error(y_test[1:],naive_forecast).numpy() # first time