Skip to content

This project demonstrates how to build a Long Short-Term Memory (LSTM) model using Keras to predict Tesla's stock closing prices based on historical data. Import libraries pandas, NumPy, to load and preprocess Titanic data, scale features, and prepare for machine learning or visualization.

Notifications You must be signed in to change notification settings

dev618/StockLSTM-Deep-Learning-for-Tesla-Price-Forecasting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ˆ StockLSTM – Deep Learning for Tesla Price Forecasting

This project demonstrates how to build a Long Short-Term Memory (LSTM) model using Keras to predict Tesla's stock closing prices based on historical data.


Python TensorFlow Keras NumPy Pandas Matplotlib Yahoo Finance


Tags: deep-learning lstm stock-prediction time-series-analysis tensorflow keras tesla tsla yahoo-finance machine-learning python numpy pandas matplotlib minmaxscaler price-forecasting sequential-mod

🧠 Project Objective

The main objective is to:

  • Load historical Tesla stock price data
  • Preprocess and normalize the data
  • Create time-series sequences for the LSTM model
  • Train the LSTM neural network
  • Predict and visualize future stock prices

πŸ“‚ Dataset

  • Dataset used: TSLA.csv
  • Source: Yahoo Finance
  • Important feature: Close price of the stock
  • The Date column is set as the index for time series analysis

πŸ§ͺ Model Architecture

  • Model: Sequential
  • Layers:
    • LSTM layer with 50 units
    • Dense layer with 1 output
  • Loss function: Mean Squared Error (MSE)
  • Optimizer: Adam
  • Epochs: 100
  • Batch size: 32

πŸ” Data Preprocessing Steps

  1. Load and parse the Date column
  2. Extract only the Close prices
  3. Apply MinMaxScaler to scale the data between 0 and 1
  4. Create sequences of 60 days to predict the 61st day price
  5. Split the dataset into 80% training and 20% testing

πŸ“Š Results

Training Accuracy: Achieved low loss values indicating good learning

Predictions: Accurately predicted trends and closing prices

Visualization: Plotted predicted vs actual prices for clear comparison

About

This project demonstrates how to build a Long Short-Term Memory (LSTM) model using Keras to predict Tesla's stock closing prices based on historical data. Import libraries pandas, NumPy, to load and preprocess Titanic data, scale features, and prepare for machine learning or visualization.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published