All projects
Study Project2025-03-25

Explainable Google Stock Forecasting

A dashboard comparing four Google stock forecasting models; Transformer achieved the lowest RMSE and MAE with per-forecast explanations.

PythonStreamlitTransformerLSTMSHAPLIME
Explainable Google Stock Forecasting

Overview

This study forecasts Google (GOOGL) closing prices using historical data from 2020 to 2025. The team built a Streamlit dashboard to explore the data, compare ARIMA, SARIMA, LSTM, and Transformer models, and explain how each model arrived at its forecasts.

Problem

Time-series models can help analysts follow market trends, but sharp volatility and unusual events make stock prices difficult to forecast. Deep learning introduces another barrier: higher accuracy is not enough when users cannot see which observations influenced a prediction.

The project therefore addressed two questions: which model performs best on the same dataset, and how complex model outputs can be explained in a way that users can inspect.

Role

I worked as a team member responsible for methodology research and paper writing. My scope covered reviewing time-series forecasting approaches, researching Explainable AI techniques, and documenting the study's methods, findings, and limitations.

Solution

  • Explored open, close, high, low, and volume data, including moving averages, volatility, seasonal decomposition, and correlations.
  • Trained and compared statistical models (ARIMA and SARIMA) with deep learning models (LSTM and Transformer).
  • Evaluated forecasts with RMSE and MAE on a test period running from mid-2024 to March 2025.
  • Applied SHAP, LIME, attention analysis, ICFTS, and DAVOTS-style visualizations to examine the influence of input time steps.
  • Built a Streamlit dashboard for selecting a model, adjusting the input window, and viewing actual values alongside forecasts and explanations.

Technical decisions

ARIMA(1,1,1) was selected to model the trend after first-order differencing. SARIMA added a five-trading-day period to test for weekly effects. The seasonal component provided only a marginal benefit, matching the observation that weekly seasonality was weak.

Both LSTM and Transformer used a 60-session window to balance recent signals with medium-term trends. LSTM was suited to sequential dependencies, while the Transformer's self-attention supported longer-range relationships and provided an additional explanation layer through attention weights. The trade-off was higher resource use and lower inherent interpretability than the statistical models.

The project combined multiple XAI methods rather than relying on one explanation: SHAP and LIME described individual forecasts, attention exposed which sessions the Transformer emphasized, and counterfactual analysis tested how forecasts changed when inputs were adjusted.

Results

Transformer achieved the lowest RMSE and MAE among the four models on the test set. The paper does not provide the numeric metric values in its text, so this case study reports the verified ranking without adding unsubstantiated figures.

The explanations showed that the models relied primarily on recent price movements and became more sensitive around unusual sessions. The dashboard brought historical analysis, model selection, forecast charts, and explanations into one interactive interface.

Lessons learned

  • Accuracy and interpretability should be evaluated together in financial forecasting.
  • Attention and feature attribution show which signals a model used, but do not establish market causality.
  • Comparing multiple explanation methods exposes outlier sensitivity and model limitations more clearly than a single aggregate metric.

Keep exploring

Vicobi AI