# chingisooinar/knn-python-implementation architecture

> Architecture diagram of the GitHub repository chingisooinar/knn-python-implementation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chingisooinar/knn-python-implementation
- Repository: https://github.com/chingisooinar/knn-python-implementation

## Overview

This is an educational notebook demonstrating k-nearest-neighbours classification on a customer-purchase example. The documented workflow implements and fits a kNN model, compares it with scikit-learn, and reports accuracy with a test-set visualization. The README does not identify the CSV as the notebook’s input, so no data-flow edge to it is asserted; notebook internals are not excerpted.

Main entry points: [`k_nearest_neighbors_from_scratch.ipynb`](https://github.com/chingisooinar/knn-python-implementation/blob/main/k_nearest_neighbors_from_scratch.ipynb) (kNN notebook)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_demo["kNN demonstration"]
  node_notebook["kNN notebook"]
  node_dataset["Customer dataset"]
  node_results["Accuracy and plots"]
end

node_learner(("Learner"))
node_sklearn["scikit-learn"]

node_learner -->|"runs demo"| node_notebook
node_notebook -->|"compares models"| node_sklearn
node_notebook -->|"reports results"| node_results

click node_notebook "https://github.com/chingisooinar/knn-python-implementation/blob/main/k_nearest_neighbors_from_scratch.ipynb"
click node_dataset "https://github.com/chingisooinar/knn-python-implementation/blob/main/Social_Network_Ads.csv"
click node_results "https://github.com/chingisooinar/knn-python-implementation/blob/main/k_nearest_neighbors_from_scratch.ipynb"

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_notebook,node_dataset,node_results toneBlue
class node_learner,node_sklearn toneIndigo
```

## Components

### kNN demonstration

- [kNN notebook](https://github.com/chingisooinar/knn-python-implementation/blob/main/k_nearest_neighbors_from_scratch.ipynb): `k_nearest_neighbors_from_scratch.ipynb`
- [Customer dataset](https://github.com/chingisooinar/knn-python-implementation/blob/main/Social_Network_Ads.csv): `Social_Network_Ads.csv`
- [Accuracy and plots](https://github.com/chingisooinar/knn-python-implementation/blob/main/k_nearest_neighbors_from_scratch.ipynb): `k_nearest_neighbors_from_scratch.ipynb`

### Other components

- **Learner**
- **scikit-learn**

## Connections

- Learner → kNN notebook: runs demo (evidence: `README.md`)
- kNN notebook → scikit-learn: compares models (evidence: `README.md`)
- kNN notebook → Accuracy and plots: reports results (evidence: `README.md`)
