# dev-luigi/neural-network-digits architecture

> Architecture diagram of the GitHub repository dev-luigi/neural-network-digits, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dev-luigi/neural-network-digits
- Repository: https://github.com/dev-luigi/neural-network-digits

## Overview

Neural Network from Scratch is an educational MNIST digit-recognition app with both a Tkinter interface and terminal commands. The principal workflow is to obtain and explore digit data, configure and train a NumPy network, evaluate it, then draw or inspect digits and experiment with the model. The GUI also offers a state-aware rules-and-search assistant, and the app supports English and Italian plus release updates. Edges rely on README statements or source-index references; unsampled implementations are represented cautiously.

Main entry points: [`nn_digits/gui/window.py`](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/window.py) (GUI window), [`nn_digits/cli.py`](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/cli.py) (Terminal commands), [`nn_digits/neural_net/data.py`](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/neural_net/data.py) (MNIST data handling), [`nn_digits/neural_net/network.py`](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/neural_net/network.py) (NumPy neural network)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry and interface"]
  node_cli["Terminal commands<br/>[cli.py]"]
  node_window["GUI window<br/>[window.py]"]
  node_ui_base["Shared UI components<br/>[base.py]"]
  node_data_tab["Data tab<br/>[tab_data.py]"]
  node_training_tab["Training tab<br/>[tab_training.py]"]
  node_evaluation_tab["Evaluation tab<br/>[tab_evaluation.py]"]
  node_draw_tab["Draw and edit tab<br/>[tab_draw.py]"]
  node_inside_tab["Network-inspection tab<br/>[tab_inside.py]"]
end

subgraph group_model["Data and learning"]
  node_data["MNIST data handling<br/>[data.py]"]
  node_network["NumPy neural network<br/>[network.py]"]
  node_training["Training engine<br/>[training.py]"]
end

subgraph group_experiments["Evaluation and exploration"]
  node_charts["Charts and projections<br/>[charts.py]"]
  node_drawing_board["Digit drawing board<br/>[drawing_board.py]"]
  node_lab["Model-editing lab<br/>[lab.py]"]
end

subgraph group_assistant["Assistant and language"]
  node_assistant_panel["Assistant panel<br/>[assistant.py]"]
  node_assistant_brain["Assistant reasoning<br/>[brain.py]"]
  node_knowledge["Concept knowledge<br/>[knowledge.py]"]
  node_rules["Diagnostic rules<br/>[rules.py]"]
  node_search["TF-IDF search<br/>[search.py]"]
  node_i18n["English and Italian<br/>[i18n.py]"]
end

subgraph group_state["Persistence and updates"]
  node_storage[("Local app data<br/>[storage.py]")]
  node_updater["Release updater<br/>[updater.py]"]
end

node_user(("User"))
node_mnist_service(("MNIST download source"))
node_release_service(("Release services"))

node_user -->|"runs commands"| node_cli
node_user -->|"uses app"| node_window
node_cli -->|"downloads and loads"| node_data
node_cli -->|"runs training"| node_training
node_cli -->|"uses model"| node_network
node_cli -->|"creates charts"| node_charts
node_cli -->|"saves outputs"| node_storage
node_cli -->|"checks updates"| node_updater
node_window -->|"creates tab"| node_data_tab
node_window -->|"creates tab"| node_training_tab
node_window -->|"creates tab"| node_evaluation_tab
node_window -->|"creates tab"| node_draw_tab
node_window -->|"creates tab"| node_inside_tab
node_window -->|"opens panel"| node_assistant_panel
node_data_tab -->|"downloads and explores"| node_data
node_data_tab -->|"reads and writes"| node_storage
node_training_tab -->|"runs epochs"| node_training
node_training_tab -->|"builds and inspects"| node_network
node_training_tab -->|"loads photos"| node_data
node_training_tab -->|"plots progress"| node_charts
node_evaluation_tab -->|"predicts digits"| node_network
node_evaluation_tab -->|"loads test photos"| node_data
node_evaluation_tab -->|"uses evaluation helpers"| node_training
node_evaluation_tab -->|"plots results"| node_charts
node_draw_tab -->|"embeds board"| node_drawing_board
node_draw_tab -->|"embeds lab"| node_lab
node_draw_tab -->|"uses model"| node_network
node_draw_tab -->|"loads and saves model"| node_storage
node_inside_tab -->|"computes layer values"| node_network
node_inside_tab -->|"draws layer view"| node_charts
node_inside_tab -->|"loads test photos"| node_data
node_training -->|"updates weights"| node_network
node_training -->|"uses prepared data"| node_data
node_data -->|"downloads dataset"| node_mnist_service
node_assistant_panel -->|"asks questions"| node_assistant_brain
node_assistant_brain -->|"uses concepts"| node_knowledge
node_assistant_brain -->|"checks conditions"| node_rules
node_assistant_brain -->|"searches answers"| node_search
node_assistant_panel -->|"reads preferences"| node_storage
node_i18n -->|"loads language setting"| node_storage
node_window -->|"checks for updates"| node_updater
node_updater -->|"checks releases"| node_release_service

click node_cli "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/cli.py"
click node_window "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/window.py"
click node_ui_base "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/base.py"
click node_data_tab "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/tab_data.py"
click node_training_tab "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/tab_training.py"
click node_evaluation_tab "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/tab_evaluation.py"
click node_draw_tab "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/tab_draw.py"
click node_inside_tab "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/tab_inside.py"
click node_data "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/neural_net/data.py"
click node_network "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/neural_net/network.py"
click node_training "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/neural_net/training.py"
click node_charts "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/neural_net/charts.py"
click node_drawing_board "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/drawing_board.py"
click node_lab "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/lab.py"
click node_assistant_panel "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/assistant.py"
click node_assistant_brain "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/assistant/brain.py"
click node_knowledge "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/assistant/knowledge.py"
click node_rules "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/assistant/rules.py"
click node_search "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/assistant/search.py"
click node_i18n "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/i18n.py"
click node_storage "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/neural_net/storage.py"
click node_updater "https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/updater.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_cli,node_window,node_ui_base,node_data_tab,node_training_tab,node_evaluation_tab,node_draw_tab,node_inside_tab,node_user toneBlue
class node_data,node_network,node_training toneAmber
class node_charts,node_drawing_board,node_lab toneMint
class node_assistant_panel,node_assistant_brain,node_knowledge,node_rules,node_search,node_i18n toneRose
class node_storage,node_updater,node_mnist_service,node_release_service toneIndigo
```

## Components

### App entry and interface

- [Terminal commands](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/cli.py): `nn_digits/cli.py`
- [GUI window](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/window.py): `nn_digits/gui/window.py`
- [Shared UI components](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/base.py): `nn_digits/gui/base.py`
- [Data tab](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/tab_data.py): `nn_digits/gui/tab_data.py`
- [Training tab](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/tab_training.py): `nn_digits/gui/tab_training.py`
- [Evaluation tab](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/tab_evaluation.py): `nn_digits/gui/tab_evaluation.py`
- [Draw and edit tab](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/tab_draw.py): `nn_digits/gui/tab_draw.py`
- [Network-inspection tab](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/tab_inside.py): `nn_digits/gui/tab_inside.py`

### Data and learning

- [MNIST data handling](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/neural_net/data.py): `nn_digits/neural_net/data.py`
- [NumPy neural network](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/neural_net/network.py): `nn_digits/neural_net/network.py`
- [Training engine](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/neural_net/training.py): `nn_digits/neural_net/training.py`

### Evaluation and exploration

- [Charts and projections](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/neural_net/charts.py): `nn_digits/neural_net/charts.py`
- [Digit drawing board](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/drawing_board.py): `nn_digits/gui/drawing_board.py`
- [Model-editing lab](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/lab.py): `nn_digits/gui/lab.py`

### Assistant and language

- [Assistant panel](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/gui/assistant.py): `nn_digits/gui/assistant.py`
- [Assistant reasoning](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/assistant/brain.py): `nn_digits/assistant/brain.py`
- [Concept knowledge](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/assistant/knowledge.py): `nn_digits/assistant/knowledge.py`
- [Diagnostic rules](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/assistant/rules.py): `nn_digits/assistant/rules.py`
- [TF-IDF search](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/assistant/search.py): `nn_digits/assistant/search.py`
- [English and Italian](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/i18n.py): `nn_digits/i18n.py`

### Persistence and updates

- [Local app data](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/neural_net/storage.py): `nn_digits/neural_net/storage.py`
- [Release updater](https://github.com/dev-luigi/neural-network-digits/blob/main/nn_digits/updater.py): `nn_digits/updater.py`

### Other components

- **User**
- **MNIST download source**
- **Release services**

## Connections

- User → Terminal commands: runs commands (evidence: `nn_digits/cli.py`)
- User → GUI window: uses app (evidence: `README.md`)
- Terminal commands → MNIST data handling: downloads and loads (evidence: `nn_digits/cli.py`)
- Terminal commands → Training engine: runs training (evidence: `nn_digits/cli.py`)
- Terminal commands → NumPy neural network: uses model (evidence: `nn_digits/cli.py`)
- Terminal commands → Charts and projections: creates charts (evidence: `nn_digits/cli.py`)
- Terminal commands → Local app data: saves outputs (evidence: `nn_digits/cli.py`)
- Terminal commands → Release updater: checks updates (evidence: `nn_digits/cli.py`)
- GUI window → Data tab: creates tab (evidence: `nn_digits/gui/window.py`)
- GUI window → Training tab: creates tab (evidence: `nn_digits/gui/window.py`)
- GUI window → Evaluation tab: creates tab (evidence: `nn_digits/gui/window.py`)
- GUI window → Draw and edit tab: creates tab (evidence: `nn_digits/gui/window.py`)
- GUI window → Network-inspection tab: creates tab (evidence: `nn_digits/gui/window.py`)
- GUI window → Assistant panel: opens panel (evidence: `nn_digits/gui/window.py`)
- Data tab → MNIST data handling: downloads and explores (evidence: `nn_digits/gui/tab_data.py`)
- Data tab → Local app data: reads and writes (evidence: `nn_digits/gui/tab_data.py`)
- Training tab → Training engine: runs epochs (evidence: `nn_digits/gui/tab_training.py`)
- Training tab → NumPy neural network: builds and inspects (evidence: `nn_digits/gui/tab_training.py`)
- Training tab → MNIST data handling: loads photos (evidence: `nn_digits/gui/tab_training.py`)
- Training tab → Charts and projections: plots progress (evidence: `nn_digits/gui/tab_training.py`)
- Evaluation tab → NumPy neural network: predicts digits (evidence: `nn_digits/gui/tab_evaluation.py`)
- Evaluation tab → MNIST data handling: loads test photos (evidence: `nn_digits/gui/tab_evaluation.py`)
- Evaluation tab → Training engine: uses evaluation helpers (evidence: `nn_digits/gui/tab_evaluation.py`)
- Evaluation tab → Charts and projections: plots results (evidence: `nn_digits/gui/tab_evaluation.py`)
- Draw and edit tab → Digit drawing board: embeds board (evidence: `nn_digits/gui/tab_draw.py`)
- Draw and edit tab → Model-editing lab: embeds lab (evidence: `nn_digits/gui/tab_draw.py`)
- Draw and edit tab → NumPy neural network: uses model (evidence: `nn_digits/gui/tab_draw.py`)
- Draw and edit tab → Local app data: loads and saves model (evidence: `nn_digits/gui/tab_draw.py`)
- Network-inspection tab → NumPy neural network: computes layer values (evidence: `nn_digits/gui/tab_inside.py`)
- Network-inspection tab → Charts and projections: draws layer view (evidence: `nn_digits/gui/tab_inside.py`)
- Network-inspection tab → MNIST data handling: loads test photos (evidence: `nn_digits/gui/tab_inside.py`)
- Training engine → NumPy neural network: updates weights (evidence: `nn_digits/neural_net/training.py`)
- Training engine → MNIST data handling: uses prepared data (evidence: `nn_digits/neural_net/training.py`)
- MNIST data handling → MNIST download source: downloads dataset (evidence: `nn_digits/neural_net/data.py`)
- Assistant panel → Assistant reasoning: asks questions (evidence: `nn_digits/gui/assistant.py`)
- Assistant reasoning → Concept knowledge: uses concepts (evidence: `nn_digits/assistant/brain.py`)
- Assistant reasoning → Diagnostic rules: checks conditions (evidence: `nn_digits/assistant/brain.py`)
- Assistant reasoning → TF-IDF search: searches answers (evidence: `nn_digits/assistant/brain.py`)
- Assistant panel → Local app data: reads preferences (evidence: `nn_digits/gui/assistant.py`)
- English and Italian → Local app data: loads language setting (evidence: `nn_digits/i18n.py`)
- GUI window → Release updater: checks for updates (evidence: `nn_digits/gui/window.py`)
- Release updater → Release services: checks releases (evidence: `nn_digits/updater.py`)
