Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phaniteja5789/real-time-stock-prediction-using-lstm-and-fastapi
https://github.com/phaniteja5789/real-time-stock-prediction-using-lstm-and-fastapi
deep-neural-networks fastapi lstm-neural-networks tensorflow2
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/phaniteja5789/real-time-stock-prediction-using-lstm-and-fastapi
- Owner: phaniteja5789
- Created: 2025-01-24T20:15:21.000Z (1 day ago)
- Default Branch: main
- Last Pushed: 2025-01-24T20:45:06.000Z (1 day ago)
- Last Synced: 2025-01-24T21:20:44.579Z (1 day ago)
- Topics: deep-neural-networks, fastapi, lstm-neural-networks, tensorflow2
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Real-Time-Stock-Prediction-using-LSTM-and-FastAPI
Project Overview
This repository demonstrates a workflow for predicting stock closing prices using Long Short-Term Memory (LSTM) neural networks.
It includes a FastAPI backend for model inference.
Key FeaturesAutomated Data Collection: Retrieves historical stock prices via yfinance.
Data Preprocessing & Scaling: Uses MinMaxScaler to transform price data.
LSTM Deep Learning Model: Captures time-series dependencies with sliding windows of 60 days.
FastAPI Inference Endpoint: Exposes a /predict route to get next-day price predictions.The model uses a 2-layer LSTM:
LSTM layer (50 units) with return_sequences=True
Dropout (20%)
LSTM layer (50 units)
Dropout (20%)
Dense output (7 unit for final prediction) ==> To predict 7 days prediction
Loss Function: Mean Squared Error (MSE)
Optimizer: AdamOutputs:
![image](https://github.com/user-attachments/assets/1b86a4f8-cd7d-46dc-9349-ebda781282f1)![image](https://github.com/user-attachments/assets/c1db5aaf-8770-4a24-ba0a-d9ae508ce4de)
Network metrics can be visualized in the Tensor Board with the help of callbacks of Tensor Flow
![image](https://github.com/user-attachments/assets/acbdb7e3-28ec-490d-b1a1-1c9c83d24490)