# ranakroychowdhury/multimodal-deep-learning-based-stock-price-prediction architecture

> Architecture diagram of the GitHub repository ranakroychowdhury/multimodal-deep-learning-based-stock-price-prediction, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ranakroychowdhury/multimodal-deep-learning-based-stock-price-prediction
- Repository: https://github.com/ranakroychowdhury/multimodal-deep-learning-based-stock-price-prediction

## Overview

##### Project type and purpose
- This is a data-science / machine-learning pipeline project that uses deep learning (LSTM) to predict stock prices from historical price data and news headlines.
- Core objectives:
- Ingest and preprocess two data sources (stock prices, news headlines)
- Train an LSTM neural network using Keras
- Tune hyperparameters

##### File structure
- Top-level scripts:
- data.py  Data loading & preprocessing
- train.py Training the LSTM model
- tune.py  Hyperparameter search
- test.py  Model evaluation & test runs
- script.bat, script.sh Command-line wrappers
- Directories & support files:
- Data/All_new.csv Combined stock + news dataset
- Lib/config.py Global configuration (paths, hyperparameter defaults)
- Report.docx, Results.docx Documentation & outputs
- No frontend or deployment code—this is an offline training pipeline

##### README for additional insights
- Data sources: Kaggle (news), Yahoo Finance (stock prices)
- Libraries & frameworks: Python, Keras for LSTM, likely pandas/numpy for preprocessing
- Outputs: performance plots, optimal parameters, predicted vs. actual price graphs

a. Main components:
1. Data Sources
– Kaggle headlines CSV
– Yahoo Finance historical prices
2. Data Ingestion & Preprocessing (data.py)
– Parsing CSVs, cleaning text, feature engineering (embeddings, scaling)
3. Configuration Module (Lib/config.py)
– Centralized hyperparameter and path settings
4. Model Training (train.py)
– Defines LSTM model in Keras
– Trains on preprocessed features
5. Hyperparameter Tuning (tune.py)
– Grid or random search over LSTM parameters
6. Evaluation & Testing (test.py)
– Computes metrics (MSE, MAE), holds out test set
7. Visualization & Reporting
– Plot predicted vs. actual, parameter performance curves
– Exports Results.docx, Report.docx
8. Execution Scripts (script.sh / script.bat)
– Orchestrate end-to-end runs

b. Relationships and data flow
– Scripts sit at the top, invoking each stage in sequence

c. Architectural patterns & design principles
– Pipeline pattern: distinct stages for ETL, training, tuning, evaluation
– Separation of concerns: config, data logic, model logic, reporting
– Modularity: each script focuses on one responsibility

d. Key technologies, frameworks, libraries
– Python ecosystem: pandas, numpy, scikit-learn (scaling, metrics)
– Deep learning: Keras (TensorFlow backend)
– Configuration: custom config.py
– Orchestration: shell/batch scripts

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Execution Scripts"
        Scripts["script.sh / script.bat"]:::code
    end
    click Scripts "https://github.com/ranakroychowdhury/multimodal-deep-learning-based-stock-price-prediction/blob/master/script.sh"
    click Scripts "https://github.com/ranakroychowdhury/multimodal-deep-learning-based-stock-price-prediction/blob/master/script.bat"

    subgraph "Data Sources"
        Kaggle["Kaggle Headlines"]:::external
        Yahoo["Yahoo Finance Prices"]:::external
        DataCSV["All_new.csv"]:::datastore
    end
    click DataCSV "https://github.com/ranakroychowdhury/multimodal-deep-learning-based-stock-price-prediction/blob/master/Data/All_new.csv"

    Scripts -->|"invoke data.py"| DataPre["Data Ingestion & Preprocessing\n(data.py)"]:::code
    click DataPre "https://github.com/ranakroychowdhury/multimodal-deep-learning-based-stock-price-prediction/blob/master/data.py"
    Scripts -->|"invoke train.py"| Train["Model Training\n(Keras LSTM Trainer)"]:::code
    click Train "https://github.com/ranakroychowdhury/multimodal-deep-learning-based-stock-price-prediction/blob/master/train.py"
    Scripts -->|"invoke tune.py"| Tune["Hyperparameter Tuning\n(tune.py)"]:::code
    click Tune "https://github.com/ranakroychowdhury/multimodal-deep-learning-based-stock-price-prediction/blob/master/tune.py"
    Scripts -->|"invoke test.py"| Test["Evaluation & Testing\n(test.py)"]:::code
    click Test "https://github.com/ranakroychowdhury/multimodal-deep-learning-based-stock-price-prediction/blob/master/test.py"

    Kaggle --> DataPre
    Yahoo --> DataPre

    DataPre -->|"features.csv"| Features["Preprocessed Data"]:::datastore

    Config["Config Module\n(Lib/config.py)"]:::code
    click Config "https://github.com/ranakroychowdhury/multimodal-deep-learning-based-stock-price-prediction/blob/master/Lib/config.py"
    Config --> Train
    Config --> Tune

    Features --> Train
    Train -->|"trained_model.h5"| Model["Trained Model"]:::datastore
    Model --> Test

    Features --> Tune
    Tune -->|"best_params.json"| Params["Best Hyperparameters"]:::datastore
    Params --> Test

    Test -->|"metrics.json"| Metrics["Evaluation Metrics"]:::datastore

    Metrics --> ReportComp["Visualization & Reporting"]:::output
    ReportComp --> Report["Report.docx"]:::output
    click Report "https://github.com/ranakroychowdhury/multimodal-deep-learning-based-stock-price-prediction/blob/master/Report.docx"
    ReportComp --> Results["Results.docx"]:::output
    click Results "https://github.com/ranakroychowdhury/multimodal-deep-learning-based-stock-price-prediction/blob/master/Results.docx"

    Readme["README.md"]:::code
    click Readme "https://github.com/ranakroychowdhury/multimodal-deep-learning-based-stock-price-prediction/blob/master/readme.md"
    Scripts --> Readme

    classDef code fill:#ADD8E6,stroke:#000;
    classDef datastore fill:#98FB98,stroke:#000;
    classDef external fill:#FFA500,stroke:#000;
    classDef output fill:#DDA0DD,stroke:#000;
```
