Skip to content

Hybrid model using XGBoost and LSTM to forecast natural gas spot prices

Notifications You must be signed in to change notification settings

padmavathi2905/Natural-Gas-Price-Prediction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Natural Gas Price Prediction

Hybrid model using XGBoost and LSTM to forecast natural gas spot prices.

This project applies a combination of machine learning and deep learning techniques to predict natural gas prices based on historical market data. It integrates ARIMA, XGBoost, and LSTM models to capture both linear and non-linear temporal dependencies in multivariate time series data.


Overview

Accurate forecasting of natural gas prices is crucial for energy market analysis, trading strategies, and risk management.
This project explores a hybrid approach that combines the strengths of different forecasting models:

  • ARIMA for linear time dependencies
  • XGBoost for capturing non-linear relationships
  • LSTM for learning long-term temporal dependencies

The ensemble model improves prediction accuracy and generalization across test datasets.


Objectives

  • Develop and fine-tune ARIMA, XGBoost, and LSTM models for multivariate time series forecasting.
  • Engineer lag-based temporal features to capture short- and long-term dependencies.
  • Apply walk-forward validation to ensure robust model evaluation.
  • Optimize hyperparameters to achieve low RMSE and MAE on the test set.

Technologies Used

Category Tools / Libraries
Language Python
Data Analysis Pandas, NumPy
Machine Learning XGBoost, Scikit-learn
Deep Learning TensorFlow / Keras (LSTM)
Time Series Modeling ARIMA (Statsmodels)
Visualization Matplotlib, Seaborn
Environment Jupyter Notebook

Dataset

  • File: gasprice.xls
  • Description: Historical natural gas price data including variables such as date, demand, supply, and spot price.
  • Preprocessing: Missing value handling, feature scaling, and lag feature generation were performed before model training.

Methodology

  1. Data Preprocessing

    • Cleaning and normalization of input features
    • Lag and rolling window feature engineering
  2. Exploratory Data Analysis (EDA)

    • Time series decomposition and correlation analysis
    • Visualization of seasonal and trend components
  3. Model Development

    • Train ARIMA for baseline forecasting
    • Implement XGBoost for feature-driven regression
    • Build LSTM networks for sequential data learning
  4. Hybrid Ensemble

    • Combine XGBoost and LSTM outputs for final prediction
    • Perform weighted averaging based on validation metrics
  5. Evaluation

    • Metrics: Root Mean Square Error (RMSE) and Mean Absolute Error (MAE)
    • Cross-validation using walk-forward approach

Results

  • The hybrid XGBoost + LSTM model achieved lower RMSE and MAE compared to individual models.
  • Incorporating lag-based features and walk-forward validation improved temporal generalization.
  • Demonstrated robust forecasting performance across multiple test periods.

About

Hybrid model using XGBoost and LSTM to forecast natural gas spot prices

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published