GithubHelp home page GithubHelp logo

stock-price-prediction-model's Introduction

Stock-Price-Prediction-Model

Stock Price Prediction using ARIMA and Lstm

Introduction

Stock price prediction is a critical task in finance, involving the use of historical stock price data to forecast future values. This project focuses on stock price prediction using implementation of ARIMA(AutoRegressive Integrated Moving Average) and LSTM(Long Short Term Memory) models.

Dataset

The dataset consists of historical stock prices, including the date and closing prices of a particular stock. The Dataset in split intop training, validation and test sets.

Model Implementation

ARIMA

To implement ARIMA model, the time series must be stationary (having constant mean and variance over time) to apply the ARIMA model effectively. The Augmented Dickey-Fuller (ADF) test is used to check the stationarity of the series. The ADF test results include the test statistic, p-value, number of lags used, and critical values for different confidence levels. If the test statistic is less than the critical value, the null hypothesis of non-stationarity is rejected.

However, the time series is not stationary. So to make the series stationary, the first difference of the series is computed.

The ARIMA model is implemented using the training data with paramteters (1,1,1). Predictions are made for each point in the test set, and the true values are added to the history to update the model iteratively.

The performance of the model is evaluated using the Mean Absolute Error (MAE).

LSTM

Long Short-Term Memory (LSTM) networks, a type of recurrent neural network (RNN), are particularly suited for time series forecasting due to their ability to capture long-term dependencies.

To train the data on LSTM and to improve its performance, the data is normalized. Then a windowed dataset is created for training and validation. For this code, a 30 day window is implemented.

The LSTM model is implemented with two LSTM layers followed by a Dense layer. The model is trained on the dataset using early stopping and Nadam optimization.

After training the model is used to make predictions on the test set and unscale the forecasted values. The model is then evaluated using Mean Absolute Error.

Results

After training and evaluation the model give the following results-
ARIMA - MAE: 1.5146
LSTM - MAE: 27.7485

stock-price-prediction-model's People

Contributors

arcxeon avatar

Watchers

 avatar

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.