Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Set up the plot
- fig, ax = plt.subplots(1, 1)
- # Plot the actual values
- ax.plot(train['ds'], train['y'], 'ko-', linewidth = 1.4, alpha = 0.8, ms = 1.8, label = 'Observations')
- ax.plot(test['ds'], test['y'], 'ko-', linewidth = 1.4, alpha = 0.8, ms = 1.8, label = 'Observations')
- # Plot the predicted values
- ax.plot(future['ds'], future['yhat'], 'navy', linewidth = 2.4, label = 'Predicted');
- # Plot the uncertainty interval as ribbon
- ax.fill_between(future['ds'].dt.to_pydatetime(), future['yhat_upper'], future['yhat_lower'], alpha = 0.6,
- facecolor = 'gold', edgecolor = 'k', linewidth = 1.4, label = 'Confidence Interval')
- # Put a vertical line at the start of predictions
- plt.vlines(x=min(test['ds']).date(), ymin=min(future['yhat_lower']), ymax=max(future['yhat_upper']), colors = 'r',
- linestyles='dashed', label = 'Prediction Start')
- # Plot formatting
- plt.legend(loc = 2, prop={'size': 8}); plt.xlabel('Date'); plt.ylabel('Price $');
- plt.grid(linewidth=0.6, alpha = 0.6)
- plt.title('{} Model Evaluation from {} to {}.'.format(self.symbol,
- start_date.date(), end_date.date()));
- plt.show();
- ax.fill_between(future['ds'].dt.to_pydatetime(), future['yhat_upper'], future['yhat_lower'], alpha = 0.6,
Add Comment
Please, Sign In to add comment