# madhug-nadig/machine-learning-algorithms-from-scratch architecture

> Architecture diagram of the GitHub repository madhug-nadig/machine-learning-algorithms-from-scratch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/madhug-nadig/machine-learning-algorithms-from-scratch
- Repository: https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch

## Overview

This repository is a set of independent, from-scratch machine-learning and search demonstrations, rather than one integrated application. The typical workflow is to run an individual script, prepare or load example data, execute an algorithm, then print, visualize, or use its result. Major branches include supervised learning, clustering, recommendation and pattern discovery, genetic optimization, and graph search. Sampled excerpts support several specific data/model and model/visualization links; other algorithm modules are included as standalone components because their internal workflows were not shown.

Main entry points: [`DBSCAN.py`](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/DBSCAN.py) (DBSCAN), [`data/chronic_kidney_disease.csv`](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/data/chronic_kidney_disease.csv) (Kidney dataset), [`data/concentric_circles.csv`](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/data/concentric_circles.csv) (Concentric circles), [`data/cron_jobs_schedule.csv`](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/data/cron_jobs_schedule.csv) (Cron schedule data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_supervised["Supervised Learning"]
  node_linear["Linear regression"]
  node_logistic["Logistic regression"]
  node_naive["Naive Bayes<br/>[Naive Bayes.py]"]
  node_trees["Decision trees<br/>[Decision Trees.py]"]
  node_knn["K nearest neighbors"]
  node_knn_parallel["Parallel KNN"]
  node_svm["Support vector machine"]
  node_forest["Random forest"]
end

subgraph group_unsupervised["Unsupervised Learning"]
  node_kmeans["K-means clustering"]
  node_dbscan["DBSCAN<br/>[DBSCAN.py]"]
  node_meanshift["Mean shift<br/>[Mean Shift.py]"]
end

subgraph group_recommendation["Recommendations"]
  node_collaborative["Collaborative filtering"]
  node_fpgrowth["FP growth<br/>[FP Growth.py]"]
end

subgraph group_search["Search and Optimization"]
  node_genetic["Genetic algorithm"]
  node_astar["A-star search<br/>[a-star.py]"]
end

node_user(("Script runner"))
node_kidney_data["Kidney dataset"]
node_circle_data["Concentric circles"]
node_cron_data["Cron schedule data"]
node_graph_data["Search graph input<br/>[graph.in]"]

node_kidney_data -->|"loads data"| node_knn
node_kidney_data -->|"loads data"| node_knn_parallel
node_circle_data -->|"loads data"| node_dbscan
node_dbscan -->|"visualizes clusters"| node_dbscan
node_cron_data -->|"loads schedule"| node_genetic
node_graph_data -->|"loads map"| node_astar

click node_linear "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/Linear%20Regression.py"
click node_logistic "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/Logistic%20Regression.py"
click node_naive "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/Naive%20Bayes.py"
click node_trees "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/Decision%20Trees.py"
click node_knn "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/K%20Nearest%20Neighbours.py"
click node_knn_parallel "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/K%20Nearest%20Neighbours%20-%20In%20Parallel.py"
click node_svm "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/Support%20Vector%20Machine.py"
click node_forest "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/random%20forest%20classifier.py"
click node_kmeans "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/K%20Means%20Clustering.py"
click node_dbscan "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/DBSCAN.py"
click node_meanshift "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/Mean%20Shift.py"
click node_collaborative "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/Collaborative%20Filtering.py"
click node_fpgrowth "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/FP%20Growth.py"
click node_genetic "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/Genetic%20Algorithm.py"
click node_astar "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/a-star.py"
click node_kidney_data "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/data/chronic_kidney_disease.csv"
click node_circle_data "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/data/concentric_circles.csv"
click node_cron_data "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/data/cron_jobs_schedule.csv"
click node_graph_data "https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/data/graph.in"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_linear,node_logistic,node_naive,node_trees,node_knn,node_knn_parallel,node_svm,node_forest toneBlue
class node_kmeans,node_dbscan,node_meanshift toneAmber
class node_collaborative,node_fpgrowth toneMint
class node_genetic,node_astar toneRose
class node_user toneIndigo
class node_kidney_data,node_circle_data,node_cron_data,node_graph_data toneTeal
```

## Components

### Supervised Learning

- [Linear regression](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/Linear%20Regression.py): `Linear Regression.py`
- [Logistic regression](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/Logistic%20Regression.py): `Logistic Regression.py`
- [Naive Bayes](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/Naive%20Bayes.py): `Naive Bayes.py`
- [Decision trees](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/Decision%20Trees.py): `Decision Trees.py`
- [K nearest neighbors](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/K%20Nearest%20Neighbours.py): `K Nearest Neighbours.py`
- [Parallel KNN](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/K%20Nearest%20Neighbours%20-%20In%20Parallel.py): `K Nearest Neighbours - In Parallel.py`
- [Support vector machine](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/Support%20Vector%20Machine.py): `Support Vector Machine.py`
- [Random forest](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/random%20forest%20classifier.py): `random forest classifier.py`

### Unsupervised Learning

- [K-means clustering](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/K%20Means%20Clustering.py): `K Means Clustering.py`
- [DBSCAN](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/DBSCAN.py): `DBSCAN.py`
- [Mean shift](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/Mean%20Shift.py): `Mean Shift.py`

### Recommendations

- [Collaborative filtering](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/Collaborative%20Filtering.py): `Collaborative Filtering.py`
- [FP growth](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/FP%20Growth.py): `FP Growth.py`

### Search and Optimization

- [Genetic algorithm](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/Genetic%20Algorithm.py): `Genetic Algorithm.py`
- [A-star search](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/a-star.py): `a-star.py`

### Other components

- **Script runner**
- [Kidney dataset](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/data/chronic_kidney_disease.csv): `data/chronic_kidney_disease.csv`
- [Concentric circles](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/data/concentric_circles.csv): `data/concentric_circles.csv`
- [Cron schedule data](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/data/cron_jobs_schedule.csv): `data/cron_jobs_schedule.csv`
- [Search graph input](https://github.com/madhug-nadig/machine-learning-algorithms-from-scratch/blob/master/data/graph.in): `data/graph.in`

## Connections

- Kidney dataset → K nearest neighbors: loads data (evidence: `K Nearest Neighbours.py`)
- Kidney dataset → Parallel KNN: loads data (evidence: `K Nearest Neighbours - In Parallel.py`)
- Concentric circles → DBSCAN: loads data (evidence: `DBSCAN.py`)
- DBSCAN → DBSCAN: visualizes clusters (evidence: `DBSCAN.py`)
- Cron schedule data → Genetic algorithm: loads schedule (evidence: `Genetic Algorithm.py`)
- Search graph input → A-star search: loads map (evidence: `a-star.py`)
