Giter VIP home page Giter VIP logo

appl-stock-price-prediction-using-lstm-with-pytorch's Introduction

"# APPL-stock-price-prediction-using-LSTM-with-pytorch"

Overview

This project focuses on the development of a Long Short-Term Memory (LSTM) model using PyTorch to predict the closing price of Apple (APPL) stock. The dataset used spans from January 3, 2011, to December 30, 2022. Key Highlights

• Data preprocessing • LSTM model development • Training and evaluation • Results visualization

Data Preprocessing

  1. Data Source: Historical APPL stock price data is retrieved from Yahoo Finance using the yfinance library in Python.

  2. Data Attributes: • Open, high, low, close, and adjusted close prices • Volume traded for each day

  3. Data Split: • Segregation into training set (first 80% of rows) and test set (last 20% of rows)

  4. Target Variable: • Closing prices are selected as the target variable for prediction.

  5. Normalization: • Closing prices are normalized by dividing them by the opening price on the first day. LSTM Model

  6. Architecture: • An LSTM model is constructed using PyTorch. • 1 hidden layer with 50 units. • Dropout applied after the LSTM layer to prevent overfitting.

  7. Loss Function: • Mean Squared Error (MSE) is employed as the loss function.

  8. Optimization: • Adam optimizer is used for model optimization.

Training

  1. Epochs: • The model is trained for 100 epochs.

  2. Sequence Input: • Training data is provided in sequences of 60 days to capture trends.

  3. Batch Size: • A batch size of 1 is utilized.

  4. Model Checkpointing: • Implementation of model checkpointing to save the best model weights.

Evaluation

  1. Performance Metric: • Model performance is assessed on the test set using Root Mean Squared Error (RMSE) between predicted and actual closing prices.

  2. RMSE Score: • Achieved an RMSE of 0.06 on the test set.

Results

  1. Prediction Accuracy: • Model predictions closely align with actual movements in APPL stock prices on the test set.
  2. Potential Improvements: • Consider increasing the number of LSTM units and training for more epochs for potential performance enhancement.
  3. Project Impact: • Demonstrates the effectiveness of LSTMs in modeling stock price movements. • Provides a PyTorch codebase for developing similar financial forecasting models. Usage Include instructions on how to run the code and reproduce the results. License Specify the license under which your project is distributed. Acknowledgments Give credit to relevant sources or libraries used in the project.

appl-stock-price-prediction-using-lstm-with-pytorch's People

Contributors

segzee 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.