How abhishekrdj/stock-price-prediction-using-machine-learning works
Project Type and Purpose
• Type: Full-stack (single-page) predictive analytics web application
• Purpose: Load historical stock data, preprocess it, train or load a pre-trained ML model, and expose predictions via a Streamlit web interface.
Main Components
a. Data Source
• Local CSV file (stock_data.csv) containing historical price data.
b. Data Preprocessing Module (in model.py)
• Reads CSV, cleans data, transforms it into time-series windows.
c. Model Training / Inference Module (in model.py)
• Defines the TensorFlow model architecture, trains it on the preprocessed data, serializes the trained model to disk (if training occurs at runtime).
d. Streamlit Frontend (in main.py)
• Web server component that imports the trained model, accepts user inputs (company ticker, date range), triggers inference, and renders charts.
e. User Interface / Visualization
• Uses Matplotlib or Streamlit’s built-in charting to plot historical vs. predicted prices.
f. Python Environment & Dependencies
• Virtual environment, requirements.txt driving installation of Pandas, NumPy, Scikit-learn, TensorFlow, Streamlit, Matplotlib.
Relationships and Data Flow
1) Streamlit UI (main.py)
↓
2) Loads trained model artifact (from disk or in-memory object)
↓
3) On user action, requests inference from Model Module
↓
4) Model Module uses Preprocessing logic to prepare the incoming data slice
↓
5) Model Module runs inference and returns predicted output array
↓
6) Streamlit UI visualizes predictions alongside historical data
7) Under the hood, the raw CSV is used by Preprocessing when retraining or updating the model.
Architectural Patterns / Design Principles
• Single-responsibility: split data prep, model logic, and UI into separate Python modules.
• Layered (presentation vs. business vs. data).
• Reproducibility: pinned dependencies in requirements.txt.