# p-jiten-2005/id3-c45-decision-trees architecture

> Architecture diagram of the GitHub repository p-jiten-2005/id3-c45-decision-trees, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/p-jiten-2005/id3-c45-decision-trees
- Repository: https://github.com/p-jiten-2005/id3-c45-decision-trees

## Overview

This is an interactive Streamlit decision-tree classification system. Users upload or select a CSV, inspect it and choose a target, configure preprocessing and a train/test split, then train and compare ID3 and C4.5 (optionally CART). They can inspect rendered trees and evaluation results, run cross-validation, and predict from a form or batch CSV. The graph preserves the documented capabilities; some links rely on README descriptions or the source index because the app and experiment excerpts are partial.

Main entry points: [`dtree/experiment.py`](https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/experiment.py) (Training and comparison), [`app.py`](https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/app.py) (Streamlit application), [`dtree/tree.py`](https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/tree.py) (Shared tree behavior), [`dtree/id3.py`](https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/id3.py) (ID3 classifier)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_app["Streamlit application<br/>[app.py]"]
end

subgraph group_data["Data preparation"]
  node_preprocess["Preprocessing and split<br/>[preprocessing.py]"]
end

subgraph group_models["Tree algorithms"]
  node_id3["ID3 classifier<br/>[id3.py]"]
  node_c45["C4.5 classifier<br/>[c45.py]"]
  node_cart["CART reference<br/>[experiment.py]"]
  node_tree["Shared tree behavior<br/>[tree.py]"]
  node_criteria["Split criteria and pruning<br/>[criteria.py]"]
end

subgraph group_analysis["Evaluation and display"]
  node_experiment["Training and comparison<br/>[experiment.py]"]
  node_metrics["Classification metrics<br/>[metrics.py]"]
  node_visualize["Tree and chart rendering<br/>[visualize.py]"]
end

node_user(("Analyst"))
node_csv["CSV datasets"]

node_user -->|"configures"| node_app
node_csv -->|"uploads or selects"| node_app
node_app -->|"prepares data"| node_preprocess
node_app -->|"trains models"| node_experiment
node_app -->|"displays results"| node_visualize
node_experiment -->|"transforms splits"| node_preprocess
node_experiment -->|"fits and predicts"| node_id3
node_experiment -->|"fits and predicts"| node_c45
node_experiment -.->|"optionally fits"| node_cart
node_experiment -->|"evaluates predictions"| node_metrics
node_id3 -->|"extends shared behavior"| node_tree
node_c45 -->|"extends shared behavior"| node_tree
node_id3 -->|"scores splits"| node_criteria
node_c45 -->|"scores and prunes"| node_criteria
node_preprocess -->|"infers feature types"| node_tree
node_visualize -->|"renders model nodes"| node_tree

click node_app "https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/app.py"
click node_preprocess "https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/preprocessing.py"
click node_experiment "https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/experiment.py"
click node_id3 "https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/id3.py"
click node_c45 "https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/c45.py"
click node_cart "https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/experiment.py"
click node_tree "https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/tree.py"
click node_criteria "https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/criteria.py"
click node_metrics "https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/metrics.py"
click node_visualize "https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/visualize.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_app toneBlue
class node_preprocess toneAmber
class node_id3,node_c45,node_cart,node_tree,node_criteria toneMint
class node_experiment,node_metrics,node_visualize toneRose
class node_user,node_csv toneIndigo
```

## Components

### User interface

- [Streamlit application](https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/app.py): `app.py`

### Data preparation

- [Preprocessing and split](https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/preprocessing.py): `dtree/preprocessing.py`

### Tree algorithms

- [ID3 classifier](https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/id3.py): `dtree/id3.py`
- [C4.5 classifier](https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/c45.py): `dtree/c45.py`
- [CART reference](https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/experiment.py): `dtree/experiment.py`
- [Shared tree behavior](https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/tree.py): `dtree/tree.py`
- [Split criteria and pruning](https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/criteria.py): `dtree/criteria.py`

### Evaluation and display

- [Training and comparison](https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/experiment.py): `dtree/experiment.py`
- [Classification metrics](https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/metrics.py): `dtree/metrics.py`
- [Tree and chart rendering](https://github.com/p-jiten-2005/id3-c45-decision-trees/blob/main/dtree/visualize.py): `dtree/visualize.py`

### Other components

- **Analyst**
- **CSV datasets**

## Connections

- Analyst → Streamlit application: configures (evidence: `README.md`)
- CSV datasets → Streamlit application: uploads or selects (evidence: `README.md`)
- Streamlit application → Preprocessing and split: prepares data (evidence: `app.py`)
- Streamlit application → Training and comparison: trains models (evidence: `README.md`)
- Streamlit application → Tree and chart rendering: displays results (evidence: `app.py`)
- Training and comparison → Preprocessing and split: transforms splits (evidence: `dtree/experiment.py`)
- Training and comparison → ID3 classifier: fits and predicts (evidence: `dtree/experiment.py`)
- Training and comparison → C4.5 classifier: fits and predicts (evidence: `dtree/experiment.py`)
- Training and comparison → CART reference: optionally fits (evidence: `dtree/experiment.py`)
- Training and comparison → Classification metrics: evaluates predictions (evidence: `dtree/experiment.py`)
- ID3 classifier → Shared tree behavior: extends shared behavior (evidence: `dtree/id3.py`)
- C4.5 classifier → Shared tree behavior: extends shared behavior (evidence: `dtree/c45.py`)
- ID3 classifier → Split criteria and pruning: scores splits (evidence: `dtree/id3.py`)
- C4.5 classifier → Split criteria and pruning: scores and prunes (evidence: `dtree/c45.py`)
- Preprocessing and split → Shared tree behavior: infers feature types (evidence: `dtree/preprocessing.py`)
- Tree and chart rendering → Shared tree behavior: renders model nodes (evidence: `dtree/visualize.py`)
