Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Adaptive Hybrid Forecasting for Stock Price Prediction

Overview

This project implements an Adaptive Hybrid Forecasting Model for stock price prediction by combining multiple statistical, machine learning, and deep learning models with advanced ensemble techniques.

The core idea:

Instead of relying on a single model, dynamically combine multiple models based on their recent performance.


Hybrid Intelligence

  • Statistical Models → ARIMA
  • Machine Learning → Random Forest, Gradient Boosting
  • Linear Models → Ridge, Lasso
  • Deep Learning → LSTM

And combines them using:

  • Adaptive Ensemble (dynamic weighting)
  • Stacking (meta-learning)
  • Combined Ensemble (Adaptive + Stacking)

Architecture

Adaptive Ensemble Model Architecture

Pipeline Flow

  1. Data Collection (Yahoo Finance)
  2. Feature Engineering (technical indicators)
  3. Base Model Training
  4. Adaptive Ensemble (dynamic weights)
  5. Context-Aware Ensembles (Regime & Volatility)
  6. Stacking (Meta-Learner)
  7. Final Combined Model
  8. Evaluation & Forecasting

Dataset & Features

  • Dataset Shape: (1036, 21)
  • Source: Yahoo Finance (yfinance)
  • Target Variable: Close Price

Engineered Features

Category Features
Returns returns, log_returns
Moving Averages MA(5,10,20,50,200)
Volatility STD(5,10,20)
Trend EMA(5,10)
Momentum RSI, Momentum, ROC
Bands Bollinger Bands (Upper, Lower, Width)
Context Market Regime, Volatility Category

Base Models

Model Description
ARIMA Classical time series model
Random Forest Bagging-based ensemble
Gradient Boosting Sequential boosting
Ridge L2-regularized regression
Lasso L1-regularized regression
LSTM Deep learning sequence model

Adaptive Ensemble

  • Uses rolling window performance
  • Applies exponential decay weighting
  • Prioritizes recent model accuracy

Context-Aware Adaptive Models

  • Market Regime Adaptive (Bullish / Bearish / Sideways)
  • Volatility Adaptive (Low / Medium / High)

Stacking Model

  • Meta-learner: Ridge Regression
  • Validation: TimeSeriesSplit
  • Combines predictions from base models

Combined Ensemble

  • Combined = 0.3 * Adaptive + 0.7 * Stacking

Performance Metrics

Model RMSE MAE MAPE
ARIMA 426.49 353.60 12.43 -2.17
RF 78.47 35.32 1.33 0.89
GB 70.45 28.61 1.10 0.91
Ridge 11.43 8.38 0.28 0.997
Lasso 10.69 8.14 0.27 0.998
LSTM 90.58 59.65 2.14 0.85
Adaptive 20.21 13.57 0.48 0.99
Adaptive (Regime) 20.14 13.55 0.48 0.99
Adaptive (Volatility) 19.87 13.44 0.47 0.99
Stacking 26.75 15.44 0.57 0.98
Combined 23.76 14.62 0.53 0.98

About

This project implements an adaptive hybrid forecasting model that combines multiple base models (ARIMA, Random Forest, Gradient Boosting, Ridge, Lasso,LSTM) with ensemble techniques (adaptive weighting and stacking) to improve stock price prediction accuracy.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages