Created
May 9, 2023 15:00
-
-
Save SaremS/283e26aab0bc9d688b57793a1e33be98 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
full_sample = [] | |
np.random.seed(123) | |
for i in range(10000): | |
draw = np.random.choice(diffed_s,len(test)) | |
result = list(diffed.iloc[-12:].values) | |
for t in range(len(test)): | |
result.append(result[t]+draw[t]) | |
full_sample.append(np.array(((rooted.iloc[-1])+np.cumsum(result[12:]))**2).reshape(-1,1)) | |
reshaped = np.concatenate(full_sample,1) | |
result_mean = np.mean(reshaped,1) | |
lower = np.quantile(reshaped,0.05,1) | |
upper = np.quantile(reshaped,0.95,1) | |
plt.figure(figsize = (14,8)) | |
plt.plot(train, label = "Train",color="blue") | |
plt.plot(test, label = "Test",color="red") | |
plt.grid(alpha = 0.5) | |
plt.plot(test.index, result_mean,label = "Simple model forecast",color="green") | |
plt.legend() | |
plt.fill_between(test.index,lower,upper,alpha=0.3,color="green") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment