Skip to content

Instantly share code, notes, and snippets.

@h3ik0th
Created May 15, 2022 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h3ik0th/dc2c1a5e536d322564901540d4fbe4a2 to your computer and use it in GitHub Desktop.
Save h3ik0th/dc2c1a5e536d322564901540d4fbe4a2 to your computer and use it in GitHub Desktop.
# retrieve forecast series for chosen quantiles,
# inverse-transform each series,
# insert them as columns in a new dataframe dfY
q50_RMSE = np.inf
q50_MAPE = np.inf
ts_q50 = None
pd.options.display.float_format = '{:,.2f}'.format
dfY = pd.DataFrame()
#dfY["Actual"] = TimeSeries.pd_series(ts_test)
# call helper function predQ, once for every quantile
_ = [predQ(ts_tpred, q) for q in QUANTILES]
# move Q50 column to the left, then insert Actual column
col = dfY.pop("Q50")
dfY.insert(0, col.name, col)
dfY.insert(0, "Actual", TimeSeries.pd_series(ts_test))
# show first and last 13 timestamps of forecast
dfY.iloc[np.r_[0:1, -13:0]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment