# shaiknawazshareef/k-nearest-neighbors-knn-classification architecture

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

- Interactive diagram: https://gitdiagram.com/shaiknawazshareef/k-nearest-neighbors-knn-classification
- Repository: https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification

## Overview

This repository is a breast-cancer tumor classification script. Running it loads the local CSV when available, explores and visualizes the data, prepares and scales features, trains KNN classifiers, predicts diagnoses, and reports evaluation metrics—including accuracy comparisons across several neighbor counts. The principal workflow and its stages are implemented together in one Python file. The README describes these capabilities; the graph’s implementation links are supported by the excerpted script.

Main entry points: [`k_nearest_neighbors_knn.py`](https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/k_nearest_neighbors_knn.py) (KNN script), [`KNNAlgorithmDataset.csv`](https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/KNNAlgorithmDataset.csv) (Breast cancer CSV)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Data analysis"]
  node_csv["Breast cancer CSV"]
  node_eda["Exploration and plots"]
end

subgraph group_classification["Classification"]
  node_script["KNN script"]
  node_prepare["Feature preparation"]
  node_scale["Feature scaling"]
  node_knn["KNN training"]
  node_predict["Diagnosis prediction"]
end

subgraph group_evaluation["Model evaluation"]
  node_evaluate["Metrics and K comparison"]
  node_visuals["Evaluation plots"]
end

node_user(("Runner"))

node_user -->|"runs"| node_script
node_script -->|"reads"| node_csv
node_script -->|"explores data"| node_eda
node_script -->|"selects features"| node_prepare
node_script -->|"scales split data"| node_scale
node_script -->|"fits classifiers"| node_knn
node_script -->|"predicts labels"| node_predict
node_script -->|"computes metrics"| node_evaluate
node_script -->|"plots results"| node_visuals

click node_script "https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/k_nearest_neighbors_knn.py"
click node_csv "https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/KNNAlgorithmDataset.csv"
click node_eda "https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/k_nearest_neighbors_knn.py"
click node_prepare "https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/k_nearest_neighbors_knn.py"
click node_scale "https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/k_nearest_neighbors_knn.py"
click node_knn "https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/k_nearest_neighbors_knn.py"
click node_predict "https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/k_nearest_neighbors_knn.py"
click node_evaluate "https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/k_nearest_neighbors_knn.py"
click node_visuals "https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/k_nearest_neighbors_knn.py"

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_csv,node_eda toneBlue
class node_script,node_prepare,node_scale,node_knn,node_predict toneAmber
class node_evaluate,node_visuals toneMint
class node_user toneIndigo
```

## Components

### Data analysis

- [Breast cancer CSV](https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/KNNAlgorithmDataset.csv): `KNNAlgorithmDataset.csv`
- [Exploration and plots](https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/k_nearest_neighbors_knn.py): `k_nearest_neighbors_knn.py`

### Classification

- [KNN script](https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/k_nearest_neighbors_knn.py): `k_nearest_neighbors_knn.py`
- [Feature preparation](https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/k_nearest_neighbors_knn.py): `k_nearest_neighbors_knn.py`
- [Feature scaling](https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/k_nearest_neighbors_knn.py): `k_nearest_neighbors_knn.py`
- [KNN training](https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/k_nearest_neighbors_knn.py): `k_nearest_neighbors_knn.py`
- [Diagnosis prediction](https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/k_nearest_neighbors_knn.py): `k_nearest_neighbors_knn.py`

### Model evaluation

- [Metrics and K comparison](https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/k_nearest_neighbors_knn.py): `k_nearest_neighbors_knn.py`
- [Evaluation plots](https://github.com/shaiknawazshareef/k-nearest-neighbors-knn-classification/blob/main/k_nearest_neighbors_knn.py): `k_nearest_neighbors_knn.py`

### Other components

- **Runner**

## Connections

- Runner → KNN script: runs (evidence: `README.md`)
- KNN script → Breast cancer CSV: reads (evidence: `k_nearest_neighbors_knn.py`)
- KNN script → Exploration and plots: explores data (evidence: `k_nearest_neighbors_knn.py`)
- KNN script → Feature preparation: selects features (evidence: `k_nearest_neighbors_knn.py`)
- KNN script → Feature scaling: scales split data (evidence: `k_nearest_neighbors_knn.py`)
- KNN script → KNN training: fits classifiers (evidence: `k_nearest_neighbors_knn.py`)
- KNN script → Diagnosis prediction: predicts labels (evidence: `k_nearest_neighbors_knn.py`)
- KNN script → Metrics and K comparison: computes metrics (evidence: `k_nearest_neighbors_knn.py`)
- KNN script → Evaluation plots: plots results (evidence: `k_nearest_neighbors_knn.py`)
