Coder Social home page Coder Social logo

nikhils10 / multivariate-analysis--oil-price-prediction-using-lstm-gru- Goto Github PK

View Code? Open in Web Editor NEW
42.0 2.0 16.0 27.45 MB

Comparing Long Term Short Memory (LSTM) & Gated Re-current Unit (GRU) during forecasting of oil price .Exploring multivariate relationships between West Texas Intermediate and S&P 500, Dow Jones Utility Avg, US Dollar Index Futures , US 10 Yr Treasury Bonds , Gold Futures.

Jupyter Notebook 100.00%
lstm-neural-networks multivariate-analysis time-series gated-recurrent-units mahalanobis-distance zscore

multivariate-analysis--oil-price-prediction-using-lstm-gru-'s Introduction

Multivariate Analysis-Oil Price Prediction Using LSTM & GRU

My Image My Image

Project Overview

We carry out Analysis between variables like West Texas intermediate(WTI),Gold Futures , US Dollar Index Futures, US 10 Year Bond Yield,Gold Futures, S&P 500,Dow Jones Utility Average. Experiment out different outliers techniques like (1)Zscore,(2)Removing Financial Crisis Period (2007-2009 recession period) and (3)Mahalanobis Distance . We then carry out comparision by observing forecasting differences across two models Long Term Short Memory(LSTM) and Gated Re-current Unit(GRU).

Motivation

Earlier I had worked on a time series prediction problem dealing with Apple Stock Price prediction using Seasonal-ARIMA & Prophet. I had an univariate series to deal with. Later when I dived into other methods for forecasting time series problems , I came across Deep Neural Network Techniques like LSTM and GRU. Also,came across using multiple explanatory variables to account for many effects to account for economic changes,etc. Oil seemed interesting to me after I came across it in my economic course . It was a interesting project to forecast oil price and observe relationship wrt to some economic variables like Gold Futures,Interest rates and Market Indices,etc.

Problem Type

Time Series Forecasting Problem-Solved Using LSTM and GRU.

Result Metrics

Mean Squared Error(MSE),Mean Absolute Error(MAE), R2 Score.

Actionable Insight

Understanding behaviour of Oil price and whether to invest it in or not.

Tools & Libraries Used

  • Python 3.6
  • Pandas
  • Matplotlib
  • Sklearn
  • Seaborn
  • Statsmodels
  • Scipy
  • Keras with Tensorflow Backend
  • Plotly

About the Data

Individual Data series was collected from Investing.com site (https://www.investing.com/) and Yahoo Finance (https://finance.yahoo.com/). Time period for data ranges between 4th Jan 2000 to 10th June 2019 with Daily frequency containing 4947 records in total and 7 series in total. The following series -(WTI ,Gold Futures , US Dollar Index Futures, US 10 Year Bond Yield,Gold Futures, S&P 500, )-Investing.com and (Dow Jones Utility Average)-Yahoo Finance.

Initial Preprocessing

To work on the dataset similar to the project, the following steps were carried out .

-> We collect individual time series within the same range for each feature.

-> Using VlookUp from Excel we merge the series into one dataset , we do so by the dates to align it according to the target variable WTI.

Note: We have put both individual time series and combined dataset in the data folder of this repo..

Credits/Resources

-https://www.investing.com/

-https://finance.yahoo.com/

-https://towardsdatascience.com/illustrated-guide-to-lstms-and-gru-s-a-step-by-step-explanation-44e9eb85bf21

-https://machinelearningmastery.com/multivariate-time-series-forecasting-lstms-keras/

-https://machinelearningmastery.com/how-to-develop-lstm-models-for-time-series-forecasting/

multivariate-analysis--oil-price-prediction-using-lstm-gru-'s People

Contributors

nikhils10 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

multivariate-analysis--oil-price-prediction-using-lstm-gru-'s Issues

error running code

hi
i got error when running this code
##Forecasting Using Z-Score Outlier Removal
sc3 = MinMaxScaler(feature_range=(0,1))
sc4 = MinMaxScaler(feature_range=(0,1))
gru_model(sc3,z_train,3)

TypeError: Inputs to a layer should be tensors. Got: MinMaxScaler()

contact

Good morning, I saw your multivariate analysis for WTI and would like to speak with you privately to discuss some possibile partnerships. Also I would like to note that removing the data from the financial crisis might not have been the best idea in my honest opinion. Feel free if interested to message me @ [email protected]

Regards and Consult

Good morning, Thanks for your contribution and share. Really a good job. Also I have read your paper about the prediction.
There is a place , I could not understand , Coud you give me some guidance about how to how to transform
Mahalanobis transformation is performed on WTI, and three features GOLD, USDINDEX, and US10B ?
Mahalanobis is 1D array, I am not sure how to transform for the target WTI .

Thank you very much. When you are Feel free , I am looking forward to your reply ,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.