When using the 'mean_absolute_scaled_error' function, I was getting an error about being unable to subtract lists. I had to modify it to turn the y_true and naive_forecast into np.array in order for the error to go away and get the same result as the video. Unsure if it'll throw an error down the road, but I changed the function as follows:
def mean_absolute_scaled_error(y_true, y_pred):
"""
Implement MASE (assuming no seasonality of data).
"""
mae = tf.reduce_mean(tf.abs(np.array(y_true) - np.array(y_pred)))
Find MAE of naive forecast (no seasonality)
mae_naive_no_season = tf.reduce_mean(tf.abs(np.array(y_true[1:]) - np.array(y_true[:-1]))) # our seasonality is 1 day (hence the shifting of 1 day)
Hi friends,
When using the 'mean_absolute_scaled_error' function, I was getting an error about being unable to subtract lists. I had to modify it to turn the y_true and naive_forecast into np.array in order for the error to go away and get the same result as the video. Unsure if it'll throw an error down the road, but I changed the function as follows:
def mean_absolute_scaled_error(y_true, y_pred): """ Implement MASE (assuming no seasonality of data). """ mae = tf.reduce_mean(tf.abs(np.array(y_true) - np.array(y_pred)))
Find MAE of naive forecast (no seasonality)
mae_naive_no_season = tf.reduce_mean(tf.abs(np.array(y_true[1:]) - np.array(y_true[:-1]))) # our seasonality is 1 day (hence the shifting of 1 day)
return mae / mae_naive_no_season