# dalzihn/ti_final architecture

> Architecture diagram of the GitHub repository dalzihn/ti_final, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dalzihn/ti_final
- Repository: https://github.com/dalzihn/ti_final

## Overview

##### Project Identification
- Type & Purpose: This is a machine learning project focused on time series forecasting. The primary goal is to predict stock prices using deep learning techniques (LSTM and transformer-based models).
- Key Elements from Files:
- The Code folder holds the core logic: building model architectures (architecture.py), setting up and processing data (data_setup.py / experiment.ipynb), and training/testing routines (engine.py).
- The Data folder is pre-split into training and testing subsets with CSV files for different stock codes.
- The README provides context on the project by explaining the models and data organization.

##### Analyzing the File Structure
- Top-Level Separation: There are two main directories: Code and Data.
- Code: Contains the scripts for defining model architectures, preparing data, and executing training/testing routines.
- Data: Divided into 'train' and 'test' which hold the respective CSV files.
- Supplementary Files: .gitattributes, .gitignore, requirements.txt, and experiment.ipynb support version control, dependency management, and interactive experimentation.

##### Identifying Main Components
Components horizontally (from left to right) to emphasize data flow and modular processing:
- Data Sources:
- Data/Train CSV Files (multiple stock codes)
- Data/Test CSV Files
- Data Preparation Module:
- Code/data_setup.py (functions managing data extraction, organization, and possibly preprocessing)
- Model Architecture Module:
- Code/architecture.py (defines the three model architectures: LSTM, Transformer-based LSTM, and Transformer-based GRU)
- Training & Testing Engine:
- Code/engine.py (contains routines to train the chosen model and test performance)
- Experimentation & Evaluation:
- Code/experiment.ipynb (used for interactive experiments, visualizing results, and potentially fine-tuning or validating models)

##### Architectural Patterns and Design Principles
- Modular Design: Clear separation of concerns is maintained among data handling, model creation, and training/testing logic.
- Pipeline Flow: The data flows sequentially from raw input through processing, modeling, and evaluation.

## Diagram (Mermaid)

```mermaid
flowchart LR
    subgraph "Data Sources"
        DS1["Train CSV Files"]:::data
        DS2["Test CSV Files"]:::data
    end

    DPrep["Data Preparation (data_setup.py)"]:::prep
    MArch["Model Architectures (architecture.py)"]:::model
    Eng["Training & Testing Engine (engine.py)"]:::engine
    Exp["Experiment/Visualization (experiment.ipynb)"]:::exp

    DS1 --> DPrep
    DS2 --> DPrep
    DPrep --> MArch
    MArch --> Eng
    Eng --> Exp

    click DS1 "https://github.com/dalzihn/ti_final/tree/main/Data/train"
    click DS2 "https://github.com/dalzihn/ti_final/tree/main/Data/test"
    click DPrep "https://github.com/dalzihn/ti_final/blob/main/Code/data_setup.py"
    click MArch "https://github.com/dalzihn/ti_final/blob/main/Code/architecture.py"
    click Eng "https://github.com/dalzihn/ti_final/blob/main/Code/engine.py"
    click Exp "https://github.com/dalzihn/ti_final/blob/main/Code/experiment.ipynb"

    classDef data fill:#AEDFF7,stroke:#333,stroke-width:2px;
    classDef prep fill:#FFF2CC,stroke:#333,stroke-width:2px;
    classDef model fill:#FFD2A7,stroke:#333,stroke-width:2px;
    classDef engine fill:#FFB3BA,stroke:#333,stroke-width:2px;
    classDef exp fill:#C7F9CC,stroke:#333,stroke-width:2px;
```
