# mastersabh/heart-disease-prediction-using-naive-bayes-classifier architecture

> Architecture diagram of the GitHub repository mastersabh/heart-disease-prediction-using-naive-bayes-classifier, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mastersabh/heart-disease-prediction-using-naive-bayes-classifier
- Repository: https://github.com/mastersabh/heart-disease-prediction-using-naive-bayes-classifier

## Overview

##### Project type and purpose
- This is a self-contained data-science/ML utility written in Python, focused on binary classification (heart-disease prediction) using Naive Bayes.
- It provides two model-training pipelines:
- NB_from_scratch.py – a custom implementation of Naive Bayes
- NB_Gaussian_Sklearn.py – a wrapper around sklearn’s GaussianNB
- It reads a flat CSV/text dataset, runs five random train/test splits, computes accuracy, and compares results.

##### File structure
- Top-level files only, no nested modules:
- NB_from_scratch.py
- NB_Gaussian_Sklearn.py
- README.md
- heartdisease.csv / heartdisease.txt (raw dataset)
- No web frontend, no database server – purely a command-line/data pipeline.
- No build or deployment scripts; Python is the only runtime environment.

##### README for additional insights
- Confirms use of UCI Heart Disease dataset with 14 features per patient.
- Describes the evaluation methodology (5 random partitions) and result aggregation.

##### Elements
- Clear labels for each block: “Data Ingestion,” “Partitioning,” “Custom NB Trainer,” “Sklearn NB Trainer,” “Evaluator,” “Reporter.”
- Compute components (model trainers, evaluator) in another (green)
- Reporting/Output in a third (orange)

- Path A → “NB_from_scratch.py (Custom Naive Bayes)”
- Path B → “NB_Gaussian_Sklearn.py (sklearn GaussianNB)”
- Both paths converge into “Model Evaluation (accuracy per split).”
- Loop around Partitioning→Training→Evaluation as “Repeat for 5 random splits.”

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Layer
    Dataset["Heart Disease Dataset\n(heartdisease.csv/.txt)"]:::data
    click Dataset "https://github.com/mastersabh/heart-disease-prediction-using-naive-bayes-classifier/blob/master/heartdisease.csv"
    README["README.md"]:::doc
    click README "https://github.com/mastersabh/heart-disease-prediction-using-naive-bayes-classifier/blob/master/README.md"

    %% Pipeline
    DataIngestion["Data Ingestion\n(parsing & preprocessing)"]:::data
    click DataIngestion "https://github.com/mastersabh/heart-disease-prediction-using-naive-bayes-classifier/blob/master/NB_from_scratch.py"
    Partition["Data Partitioning\n(×5 random splits)"]:::data
    click Partition "https://github.com/mastersabh/heart-disease-prediction-using-naive-bayes-classifier/blob/master/NB_from_scratch.py"

    Dataset --> DataIngestion --> Partition
    Dataset -.-> README

    subgraph "Pipeline Loop (×5 random splits)"
        direction TB
        Partition --> Custom["NB_from_scratch.py\n(Custom Naive Bayes)"]:::compute
        click Custom "https://github.com/mastersabh/heart-disease-prediction-using-naive-bayes-classifier/blob/master/NB_from_scratch.py"
        Partition --> Sklearn["NB_Gaussian_Sklearn.py\n(sklearn GaussianNB)"]:::compute
        click Sklearn "https://github.com/mastersabh/heart-disease-prediction-using-naive-bayes-classifier/blob/master/NB_Gaussian_Sklearn.py"

        Custom --> Eval1["Model Evaluation\n(Custom)"]:::compute
        click Eval1 "https://github.com/mastersabh/heart-disease-prediction-using-naive-bayes-classifier/blob/master/NB_from_scratch.py"
        Sklearn --> Eval2["Model Evaluation\n(Sklearn)"]:::compute
        click Eval2 "https://github.com/mastersabh/heart-disease-prediction-using-naive-bayes-classifier/blob/master/NB_Gaussian_Sklearn.py"
    end

    Eval1 --> Merge["Merge Evaluations"]:::report
    Eval2 --> Merge
    Merge --> Report["Results Aggregation & Reporting"]:::report
    click Report "https://github.com/mastersabh/heart-disease-prediction-using-naive-bayes-classifier/blob/master/NB_from_scratch.py"

    %% Styles
    classDef data fill:#AED6F1,stroke:#21618C,color:#1B2631
    classDef compute fill:#ABEBC6,stroke:#196F3D,color:#145A32
    classDef report fill:#FAD7A0,stroke:#B9770E,color:#7E5109
    classDef doc fill:#D7DBDD,stroke:#85929E,color:#2E4053
```
