diff options
| author | Priyansh <[email protected]> | 2021-12-09 01:39:14 -0500 |
|---|---|---|
| committer | Priyansh <[email protected]> | 2021-12-09 01:39:14 -0500 |
| commit | 791226ab766ad2655cafaf47eea3544f09d03b2e (patch) | |
| tree | a94a633d53486a45656e38330adb21b29a898a92 | |
| parent | 74d6f019cc90214833c00ec45ed92ffc45c07dd7 (diff) | |
| download | temp_pred_arima-791226ab766ad2655cafaf47eea3544f09d03b2e.tar.xz temp_pred_arima-791226ab766ad2655cafaf47eea3544f09d03b2e.zip | |
Added Arima Predictor for Predicting and Generating the graph for a set of data - currently it is hard coded
| -rw-r--r-- | arima_predictor.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arima_predictor.py b/arima_predictor.py new file mode 100644 index 0000000..f6d574f --- /dev/null +++ b/arima_predictor.py @@ -0,0 +1,23 @@ +import pandas as pd +import matplotlib.pyplot as plt +import pickle + +with open('arima.pkl', 'rb') as pkl: + n_periods = 30 + fc, confint = pickle.load(pkl).predict( + n_periods=n_periods, return_conf_int=True) + n_years = ['1960-12-02', '1960-12-03', '1960-12-04', '1960-12-05', '1960-12-06', '1960-12-07', '1960-12-08', '1960-12-09', '1960-12-10', '1960-12-11', '1960-12-12', '1960-12-13', '1960-12-14', '1960-12-15', '1960-12-16', + '1960-12-17', '1960-12-18', '1960-12-19', '1960-12-20', '1960-12-21', '1960-12-22', '1960-12-23', '1960-12-24', '1960-12-25', '1960-12-26', '1960-12-27', '1960-12-28', '1960-12-29', '1960-12-30', '1960-12-31'] + city_ids = ["1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031", "1031"] + fc_ind = pd.Series(n_years, city_ids) + + fc_series = pd.Series(fc, index=fc_ind) + lower_series = pd.Series(confint[:, 0], index=fc_ind) + upper_series = pd.Series(confint[:, 1], index=fc_ind) + plt.figure(figsize=(12, 5)) + plt.plot(fc_series, color="darkred") + plt.fill_between(lower_series.index, + lower_series, + upper_series, + color="k", alpha=.35) + plt.show() |
