# mohamedyousuf1/machine-learning-comparision-on-classification-dataset architecture

> Architecture diagram of the GitHub repository mohamedyousuf1/machine-learning-comparision-on-classification-dataset, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mohamedyousuf1/machine-learning-comparision-on-classification-dataset
- Repository: https://github.com/mohamedyousuf1/machine-learning-comparision-on-classification-dataset

## Overview

Based on your project’s file structure and README, you are dealing with a data science/machine learning project focused on training and evaluating multiple classification models using the heart disease dataset. The project is structured in a straightforward script-centric manner, aiming for rapid experimentation with various ML models provided by scikit-learn, XGBoost, LightGBM, and Keras.

##### Main Components
- Data Acquisition & Input: Represent the heart disease dataset (from the UCI Machine Learning Repository) being fetched or loaded.
- Data Preprocessing: Include the preprocessing steps such as filling missing values and converting the target to binary.
- Model Training Component: A central module for training and evaluating different machine learning models. This is predominantly handled by ModelTrainer.py and includes sub-components for each model type:
- Logistic Regression
- Decision Tree
- Random Forest
- Support Vector Machine
- k-Nearest Neighbors
- Naive Bayes
- Gradient Boosting
- XGBoost
- LightGBM
- Neural Network (via Keras)
- Results Handling & Export: Indicate the parts where the evaluation metrics (accuracy, precision, recall, F1 score, and confusion matrix) are consolidated into:
- CSV report (model_comparison_results.csv)
- Graphical outputs and saved figures (via Figure_saver.py and saving images such as confusion matrices in the “confusion_matrices” directory).

##### Out the Relationships & Flow
- From Preprocessing, indicate data passing into the Model Training component.
- Model Training component to two output directions:

##### Architectural Patterns and Design
- Modularity; even though the project is not split into multiple layers like a full-stack application, it is built around clearly separated responsibilities (data ingestion, preprocessing, model training, results visualization/export).
- Mention that the design leverages standard Python libraries and ML frameworks, which are dependency-managed via requirements.txt.

##### Putting It All Together
- Follow the flow from data loading → preprocessing → model training (with all the different models) → result generation.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Main Controller (main.py)"]:::controller
    B["Data Acquisition & Preprocessing (heart disease dataset)"]:::data
    C["Model Training (ModelTrainer.py)\n(Logistic Regression, DecisionTree, RandomForest, SVM, KNN, NaiveBayes, GradientBoosting, XGBoost, LightGBM, NeuralNetwork (Keras))"]:::model
    D["CSV Report (model_comparison_results.csv)"]:::result
    E["Figure Saver (Figure_saver.py)"]:::visualization
    F["Confusion Matrices (confusion_matrices)"]:::visualization

    A -->|"starts"| B
    B -->|"prepares_data"| C
    C -->|"exports_results"| D
    C -->|"generates_visuals"| E
    E -->|"saves_images_to"| F

    click A "https://github.com/mohamedyousuf1/machine-learning-comparision-on-classification-dataset/blob/master/main.py"
    click B "https://github.com/mohamedyousuf1/machine-learning-comparision-on-classification-dataset/blob/master/main.py"
    click C "https://github.com/mohamedyousuf1/machine-learning-comparision-on-classification-dataset/blob/master/ModelTrainer.py"
    click D "https://github.com/mohamedyousuf1/machine-learning-comparision-on-classification-dataset/blob/master/model_comparison_results.csv"
    click E "https://github.com/mohamedyousuf1/machine-learning-comparision-on-classification-dataset/blob/master/Figure_saver.py"
    click F "https://github.com/mohamedyousuf1/machine-learning-comparision-on-classification-dataset/tree/master/confusion_matrices"

    classDef controller fill:#9fdf9f,stroke:#333,stroke-width:2px;
    classDef data fill:#ffdead,stroke:#333,stroke-width:2px;
    classDef model fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef result fill:#ffe4e1,stroke:#333,stroke-width:2px;
    classDef visualization fill:#d3d3d3,stroke:#333,stroke-width:2px;
```
