# akshitagaur-hub/machine-learning-project architecture

> Architecture diagram of the GitHub repository akshitagaur-hub/machine-learning-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akshitagaur-hub/machine-learning-project
- Repository: https://github.com/akshitagaur-hub/machine-learning-project

## Overview

This repository trains and compares image classifiers over a labeled image dataset. The main workflow reads class folders, preprocesses images and extracts HOG features, splits the data, trains six classifiers, evaluates their predictions, and writes comparison metrics and serialized models. The README also describes manual image collection and annotation. The training implementation is shown; the README’s collection workflow is documented rather than implemented in the sampled source. The separate dataset validator uses a hard-coded path, so its connection to this dataset is uncertain.

Main entry points: [`train_models.py`](https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py) (Model training), [`dataset`](https://github.com/akshitagaur-hub/machine-learning-project/tree/main/dataset) (Labeled images), [`validate_dataset.py`](https://github.com/akshitagaur-hub/machine-learning-project/blob/main/validate_dataset.py) (Dataset validator), [`results/model_comparison.csv`](https://github.com/akshitagaur-hub/machine-learning-project/blob/main/results/model_comparison.csv) (Model comparison)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Image data"]
  node_dataset[("Labeled images")]
  node_validator["Dataset validator"]
end

subgraph group_pipeline["Training pipeline"]
  node_loader["Image loading<br/>[train_models.py]"]
  node_features["HOG features<br/>[train_models.py]"]
  node_split["Train-test split<br/>[train_models.py]"]
  node_trainer["Model training<br/>[train_models.py]"]
end

subgraph group_models["Classifiers"]
  node_logreg["Logistic regression<br/>[train_models.py]"]
  node_tree["Decision tree<br/>[train_models.py]"]
  node_bayes["Naive Bayes<br/>[train_models.py]"]
  node_forest["Random forest<br/>[train_models.py]"]
  node_knn["K-nearest neighbors<br/>[train_models.py]"]
  node_svc["Support vector classifier<br/>[train_models.py]"]
end

subgraph group_outputs["Evaluation outputs"]
  node_evaluation["Metrics and reports<br/>[train_models.py]"]
  node_confusion["Confusion matrices<br/>[train_models.py]"]
  node_comparison["Model comparison"]
  node_savedmodels[("Saved classifiers")]
end

node_collector(("Image collection"))

node_collector -.->|"collects and labels"| node_dataset
node_dataset -->|"provides images"| node_loader
node_dataset -.->|"scans images"| node_validator
node_loader -->|"extracts HOG"| node_features
node_features -->|"splits features"| node_split
node_split -->|"supplies train and test"| node_trainer
node_trainer -->|"fits and predicts"| node_logreg
node_trainer -->|"fits and predicts"| node_tree
node_trainer -->|"fits and predicts"| node_bayes
node_trainer -->|"fits and predicts"| node_forest
node_trainer -->|"fits and predicts"| node_knn
node_trainer -->|"fits and predicts"| node_svc
node_trainer -->|"evaluates predictions"| node_evaluation
node_evaluation -->|"renders matrices"| node_confusion
node_evaluation -->|"writes metrics"| node_comparison
node_trainer -->|"serializes classifiers"| node_savedmodels

click node_dataset "https://github.com/akshitagaur-hub/machine-learning-project/tree/main/dataset"
click node_validator "https://github.com/akshitagaur-hub/machine-learning-project/blob/main/validate_dataset.py"
click node_loader "https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py"
click node_features "https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py"
click node_split "https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py"
click node_trainer "https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py"
click node_logreg "https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py"
click node_tree "https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py"
click node_bayes "https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py"
click node_forest "https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py"
click node_knn "https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py"
click node_svc "https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py"
click node_evaluation "https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py"
click node_confusion "https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py"
click node_comparison "https://github.com/akshitagaur-hub/machine-learning-project/blob/main/results/model_comparison.csv"
click node_savedmodels "https://github.com/akshitagaur-hub/machine-learning-project/tree/main/results/models"

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_dataset,node_validator toneBlue
class node_loader,node_features,node_split,node_trainer toneAmber
class node_logreg,node_tree,node_bayes,node_forest,node_knn,node_svc toneMint
class node_evaluation,node_confusion,node_comparison,node_savedmodels toneRose
class node_collector toneIndigo
```

## Components

### Image data

- [Labeled images](https://github.com/akshitagaur-hub/machine-learning-project/tree/main/dataset): `dataset`
- [Dataset validator](https://github.com/akshitagaur-hub/machine-learning-project/blob/main/validate_dataset.py): `validate_dataset.py`

### Training pipeline

- [Image loading](https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py): `train_models.py`
- [HOG features](https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py): `train_models.py`
- [Train-test split](https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py): `train_models.py`
- [Model training](https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py): `train_models.py`

### Classifiers

- [Logistic regression](https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py): `train_models.py`
- [Decision tree](https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py): `train_models.py`
- [Naive Bayes](https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py): `train_models.py`
- [Random forest](https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py): `train_models.py`
- [K-nearest neighbors](https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py): `train_models.py`
- [Support vector classifier](https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py): `train_models.py`

### Evaluation outputs

- [Metrics and reports](https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py): `train_models.py`
- [Confusion matrices](https://github.com/akshitagaur-hub/machine-learning-project/blob/main/train_models.py): `train_models.py`
- [Model comparison](https://github.com/akshitagaur-hub/machine-learning-project/blob/main/results/model_comparison.csv): `results/model_comparison.csv`
- [Saved classifiers](https://github.com/akshitagaur-hub/machine-learning-project/tree/main/results/models): `results/models`

### Other components

- **Image collection**

## Connections

- Image collection → Labeled images: collects and labels (evidence: `README.md`)
- Labeled images → Image loading: provides images (evidence: `train_models.py`)
- Labeled images → Dataset validator: scans images
- Image loading → HOG features: extracts HOG (evidence: `train_models.py`)
- HOG features → Train-test split: splits features (evidence: `train_models.py`)
- Train-test split → Model training: supplies train and test (evidence: `train_models.py`)
- Model training → Logistic regression: fits and predicts (evidence: `train_models.py`)
- Model training → Decision tree: fits and predicts (evidence: `train_models.py`)
- Model training → Naive Bayes: fits and predicts (evidence: `train_models.py`)
- Model training → Random forest: fits and predicts (evidence: `train_models.py`)
- Model training → K-nearest neighbors: fits and predicts (evidence: `train_models.py`)
- Model training → Support vector classifier: fits and predicts (evidence: `train_models.py`)
- Model training → Metrics and reports: evaluates predictions (evidence: `train_models.py`)
- Metrics and reports → Confusion matrices: renders matrices (evidence: `train_models.py`)
- Metrics and reports → Model comparison: writes metrics (evidence: `train_models.py`)
- Model training → Saved classifiers: serializes classifiers (evidence: `train_models.py`)
