# haroon423/fruad-detection-machine-learning architecture

> Architecture diagram of the GitHub repository haroon423/fruad-detection-machine-learning, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/haroon423/fruad-detection-machine-learning
- Repository: https://github.com/haroon423/fruad-detection-machine-learning

## Overview

##### File structure
Top‑level artifacts:
- .github/workflows/main.yml – CI/CD pipeline (runs tests)
- requirements.txt – Python dependencies
- test_fraud_detection.py – unit/integration tests for core functionality
- README.md – project overview
- Fruad-Detection-Using-Machine_learning/ – core notebooks, model outputs, dissertation

Inside “Fruad-Detection-Using-Machine_learning”:
- Algorithms.ipynb – model‑training code for traditional ML
- Data_Visualisation.ipynb – visualization code for performance and features
- Dissertation.pdf – thesis write‑up (contextual document)
- Models/Scaled/… – stored .h5 model files and loss logs for RNN and LSTM under “More Epochs” and “Suggestion” experiments

##### README for additional insights
- Sections on data preprocessing, feature engineering, model training, and evaluation
- Lists ML algorithms and performance metrics (precision, recall, F1, ROC‑AUC)
- Instructions for setup and running the pipeline locally

##### Detailed capture of architectural elements
- Under Training, sub‑blocks for “Random Forest”, “Gradient Boosting”, “SVM” and “RNN/LSTM”
- Under Models, illustrate directory structure:
Models → Scaled → More Epochs / Suggestion → {Model 1, Model 2}
- How test_fraud_detection.py fits into CI/CD before merging

## Diagram (Mermaid)

```mermaid
flowchart TD
    DataSource(["Raw Transaction Data"]):::data

    subgraph "Data Processing"
        Preprocess(["Data Preprocessing\n(Algorithms.ipynb)"]):::data
        FeatureEng(["Feature Engineering\n(Algorithms.ipynb)"]):::data
    end

    subgraph "Model Training"
        Traditional(["Traditional ML\n(RandomForest, GBM, SVM)\n(Algorithms.ipynb)"]):::compute
        Deep(["Deep Learning\n(SimpleRNN, LSTM)\n(Algorithms.ipynb)"]):::compute
    end

    subgraph "Model Repository"
        ModelsDir(["Models"]):::storage
        subgraph "Scaled"
            subgraph "More Epochs"
                M1RNN(["Model1 SimpleRNN.h5"]):::storage
                M1Loss(["loss.csv"]):::storage
                M2LSTM(["Model2 LSTM.h5"]):::storage
                M2Loss(["loss.csv"]):::storage
            end
            subgraph "Suggestion"
                S1RNN(["Model1 SimpleRNN.h5"]):::storage
                S1Loss(["loss_epochs_2.csv"]):::storage
                S2LSTM(["Model2 LSTM.h5"]):::storage
                S2Loss(["loss_epochs_2.csv"]):::storage
            end
        end
    end

    Eval(["Evaluation Module\n(test_fraud_detection.py)"]):::compute
    Visual(["Visualization Module\n(Data_Visualisation.ipynb)"]):::compute

    CI(["CI/CD Pipeline\n(.github/workflows/main.yml)"]):::ci

    README(["README.md"]):::doc
    Requirements(["requirements.txt"]):::doc
    Dissertation(["Dissertation.pdf"]):::doc

    DataSource -->|data→| Preprocess -->|cleaned data→| FeatureEng -->|features→| Traditional
    FeatureEng -->|features→| Deep
    Traditional -->|models→| ModelsDir
    Deep -->|models→| ModelsDir
    ModelsDir -->|models→| Eval -->|metrics→| Visual

    CI -->|runs tests on| Eval
    README -->|setup info| DataSource
    Requirements -->|dependencies| Preprocess

    click Preprocess "https://github.com/haroon423/fruad-detection-machine-learning/blob/master/Fruad-Detection-Using-Machine_learning/Algorithms.ipynb"
    click FeatureEng "https://github.com/haroon423/fruad-detection-machine-learning/blob/master/Fruad-Detection-Using-Machine_learning/Algorithms.ipynb"
    click Traditional "https://github.com/haroon423/fruad-detection-machine-learning/blob/master/Fruad-Detection-Using-Machine_learning/Algorithms.ipynb"
    click Visual "https://github.com/haroon423/fruad-detection-machine-learning/blob/master/Fruad-Detection-Using-Machine_learning/Data_Visualisation.ipynb"
    click ModelsDir "https://github.com/haroon423/fruad-detection-machine-learning/tree/master/Fruad-Detection-Using-Machine_learning/Models"
    click M1RNN "https://github.com/haroon423/fruad-detection-machine-learning/blob/master/Fruad-Detection-Using-Machine_learning/Models/Scaled/More Epochs/Model 1/RNN_epochs_20_batch_64_SimpleRNN.h5"
    click M1Loss "https://github.com/haroon423/fruad-detection-machine-learning/blob/master/Fruad-Detection-Using-Machine_learning/Models/Scaled/More Epochs/Model 1/loss.csv"
    click M2LSTM "https://github.com/haroon423/fruad-detection-machine-learning/blob/master/Fruad-Detection-Using-Machine_learning/Models/Scaled/More Epochs/Model 2/RNN_epochs_10_batch_64_LSTM.h5"
    click M2Loss "https://github.com/haroon423/fruad-detection-machine-learning/blob/master/Fruad-Detection-Using-Machine_learning/Models/Scaled/More Epochs/Model 2/loss.csv"
    click S1RNN "https://github.com/haroon423/fruad-detection-machine-learning/blob/master/Fruad-Detection-Using-Machine_learning/Models/Scaled/Suggestion/Model 1/RNN_epochs_2_batch_64_SimpleRNN.h5"
    click S1Loss "https://github.com/haroon423/fruad-detection-machine-learning/blob/master/Fruad-Detection-Using-Machine_learning/Models/Scaled/Suggestion/Model 1/loss_epochs_2.csv"
    click S2LSTM "https://github.com/haroon423/fruad-detection-machine-learning/blob/master/Fruad-Detection-Using-Machine_learning/Models/Scaled/Suggestion/Model 2/RNN_epochs_2_batch_64_LSTM.h5"
    click S2Loss "https://github.com/haroon423/fruad-detection-machine-learning/blob/master/Fruad-Detection-Using-Machine_learning/Models/Scaled/Suggestion/Model 2/loss_epochs_2.csv"
    click Eval "https://github.com/haroon423/fruad-detection-machine-learning/blob/master/test_fraud_detection.py"
    click CI "https://github.com/haroon423/fruad-detection-machine-learning/blob/master/.github/workflows/main.yml"
    click README "https://github.com/haroon423/fruad-detection-machine-learning/blob/master/README.md"
    click Requirements "https://github.com/haroon423/fruad-detection-machine-learning/blob/master/requirements.txt"
    click Dissertation "https://github.com/haroon423/fruad-detection-machine-learning/blob/master/Fruad-Detection-Using-Machine_learning/Dissertation.pdf"

    classDef data fill:#BBDEFB,stroke:#000,color:#000
    classDef compute fill:#C8E6C9,stroke:#000,color:#000
    classDef storage fill:#FFE0B2,stroke:#000,color:#000
    classDef ci fill:#E1BEE7,stroke:#000,color:#000
    classDef doc fill:#FFF9C4,stroke:#000,color:#000
```
