Skip to content

Instantly share code, notes, and snippets.

@jimwhite
Last active April 17, 2024 04:13
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 jimwhite/cdd47f46821d1b7fd4548804c4cbc997 to your computer and use it in GitHub Desktop.
Save jimwhite/cdd47f46821d1b7fd4548804c4cbc997 to your computer and use it in GitHub Desktop.
Plot all the models on one chart that just covers the predicted dates
plt.figure(figsize=(16, 8))
stock_data_subset = stock_data[stock_data['ds'].isin(rescaled_predictions_df['ds'])]
plt.plot(stock_data_subset['ds'], stock_data_subset['y'], label='Actual Price', linewidth=3, color='blue')
# ['iTransformer', 'TSMixer', 'NHITS', 'PatchTST']
plt.plot(rescaled_predictions_df['ds'], rescaled_predictions_df['iTransformer'],
label='iTransformer', linewidth=1, color='purple')
plt.plot(rescaled_predictions_df['ds'], rescaled_predictions_df['TSMixer'],
label='TSMixer', linewidth=1, color='green')
plt.plot(rescaled_predictions_df['ds'], rescaled_predictions_df['NHITS'],
label='NHITS', linewidth=1, color='red')
plt.plot(rescaled_predictions_df['ds'], rescaled_predictions_df['PatchTST'],
label='PatchTST', linewidth=1, color='brown')
plt.xlabel('Date', fontsize=14)
plt.ylabel('Price', fontsize=14)
plt.title(f'{ticker} Stock Price Predictions', fontsize=16)
plt.grid(axis='y')
plt.legend(fontsize=12)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment