Sequences and prediction

Time Series

📙 Notebook: introduction to time series. + explaining video. → How to create synthetic time series data + plot them.

Train / Validation / Test

Metrics

For evaluating models:

errors = forecasts - actual

# Mean squared error (square to get rid of negative values)
# Eg. Used if large errors are potentially dangerous
mse = np.square(errors).mean()
# Get back to the same scale to error
rmse = np.sqrt(mse)

# Mean absolute error (his favorite)
# this doesn't penalize large errs as much as mse does,
# used if loss is proportional to the size of err
mae = np.abs(errors).mean()

# Mean abs percentage err
# idea of the size of err compared to the values
mape = np.abs(errors / x_valid).mean()
# MAE with TF
keras.metrics.mean_absolute_error(x_valid, naive_forecast).numpy()