a guest Jul 4th, 2017 127 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import itertools
  3. # evaluate combinations of p, d and q values for an ARIMA model
  4. def evaluate_models(dataset, p_values, d_values, q_values):
  5.     dataset = dataset.astype('float32')
  6.     best_score, best_cfg = float("inf"), None
  7.     for order in itertools.product(p_values, d_values,q_values):
  8.         try:
  9.             mse = evaluate_arima_model(dataset, order)
  10.             if mse < best_score:
  11.                 best_score, best_cfg = mse, order            
  12.         except:
  13.             continue
  14.             mse = evaluate_arima_model(dataset, order)
  15.     print('Best ARIMA%s RMSE=%.3f' % (best_cfg, best_score))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand