# zubinch/ml-projects architecture

> Architecture diagram of the GitHub repository zubinch/ml-projects, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zubinch/ml-projects
- Repository: https://github.com/zubinch/ml-projects

## Overview

This repository contains C implementations of a multilayer neural-network trainer, standalone perceptron trainers, and a perceptron prediction program, supported by matrix and random-number utilities. The main neural-network workflow loads input and expected-output CSVs, performs forward and backward passes, then writes weights and biases. A separate perceptron workflow trains from CSV data and can save a model for later prediction. No README was provided; neural-network integration is shown through its training API, while command-line workflows are explicit in the perceptron programs.

Main entry points: [`perceptrons/presult.c`](https://github.com/zubinch/ml-projects/blob/main/perceptrons/presult.c) (Perceptron predictor), [`perceptrons/inputs`](https://github.com/zubinch/ml-projects/tree/main/perceptrons/inputs) (Training CSVs), [`neural-networks/backpropagation.c`](https://github.com/zubinch/ml-projects/blob/main/neural-networks/backpropagation.c) (Network trainer), [`perceptrons/ptrain2.c`](https://github.com/zubinch/ml-projects/blob/main/perceptrons/ptrain2.c) (Perceptron trainer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_nn["Neural-network training"]
  node_nntrain["Network trainer<br/>[backpropagation.c]"]
end

subgraph group_perceptrons["Perceptron tools"]
  node_ptrain1["Perceptron trainer<br/>[ptrain1.c]"]
  node_ptrain2["Perceptron trainer<br/>[ptrain2.c]"]
  node_presult["Perceptron predictor<br/>[presult.c]"]
  node_train_csv["Training CSVs"]
  node_model_csv["Perceptron model"]
  node_prediction_csv["Prediction output"]
end

subgraph group_math["Numerical utilities"]
  node_matrix["Matrix operations<br/>[matrices.c]"]
  node_random["Random sampling"]
end

node_user(("User"))

node_user -->|"requests training"| node_nntrain
node_nntrain -->|"uses matrices"| node_matrix
node_nntrain -->|"initializes weights"| node_random
node_user -->|"runs trainer"| node_ptrain1
node_user -->|"runs trainer"| node_ptrain2
node_train_csv -->|"provides rows"| node_ptrain1
node_train_csv -->|"provides rows"| node_ptrain2
node_ptrain2 -->|"saves model"| node_model_csv
node_user -->|"runs prediction"| node_presult
node_model_csv -->|"loads parameters"| node_presult
node_train_csv -->|"provides inputs"| node_presult
node_presult -->|"writes predictions"| node_prediction_csv

click node_nntrain "https://github.com/zubinch/ml-projects/blob/main/neural-networks/backpropagation.c"
click node_matrix "https://github.com/zubinch/ml-projects/blob/main/neural-networks/libraries/linear-algebra/matrices.c"
click node_random "https://github.com/zubinch/ml-projects/blob/main/neural-networks/libraries/random-numbers/normally-distributed-random-numbers.c"
click node_ptrain1 "https://github.com/zubinch/ml-projects/blob/main/perceptrons/ptrain1.c"
click node_ptrain2 "https://github.com/zubinch/ml-projects/blob/main/perceptrons/ptrain2.c"
click node_presult "https://github.com/zubinch/ml-projects/blob/main/perceptrons/presult.c"
click node_train_csv "https://github.com/zubinch/ml-projects/tree/main/perceptrons/inputs"
click node_model_csv "https://github.com/zubinch/ml-projects/tree/main/perceptrons/outputs"
click node_prediction_csv "https://github.com/zubinch/ml-projects/tree/main/perceptrons/outputs"

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_nntrain,node_user toneBlue
class node_ptrain1,node_ptrain2,node_presult,node_train_csv,node_model_csv,node_prediction_csv toneAmber
class node_matrix,node_random toneMint
```

## Components

### Neural-network training

- [Network trainer](https://github.com/zubinch/ml-projects/blob/main/neural-networks/backpropagation.c): `neural-networks/backpropagation.c`

### Perceptron tools

- [Perceptron trainer](https://github.com/zubinch/ml-projects/blob/main/perceptrons/ptrain1.c): `perceptrons/ptrain1.c`
- [Perceptron trainer](https://github.com/zubinch/ml-projects/blob/main/perceptrons/ptrain2.c): `perceptrons/ptrain2.c`
- [Perceptron predictor](https://github.com/zubinch/ml-projects/blob/main/perceptrons/presult.c): `perceptrons/presult.c`
- [Training CSVs](https://github.com/zubinch/ml-projects/tree/main/perceptrons/inputs): `perceptrons/inputs`
- [Perceptron model](https://github.com/zubinch/ml-projects/tree/main/perceptrons/outputs): `perceptrons/outputs`
- [Prediction output](https://github.com/zubinch/ml-projects/tree/main/perceptrons/outputs): `perceptrons/outputs`

### Numerical utilities

- [Matrix operations](https://github.com/zubinch/ml-projects/blob/main/neural-networks/libraries/linear-algebra/matrices.c): `neural-networks/libraries/linear-algebra/matrices.c`
- [Random sampling](https://github.com/zubinch/ml-projects/blob/main/neural-networks/libraries/random-numbers/normally-distributed-random-numbers.c): `neural-networks/libraries/random-numbers/normally-distributed-random-numbers.c`

### Other components

- **User**

## Connections

- User → Network trainer: requests training
- Network trainer → Matrix operations: uses matrices (evidence: `neural-networks/backpropagation.c`)
- Network trainer → Random sampling: initializes weights (evidence: `neural-networks/backpropagation.c`)
- User → Perceptron trainer: runs trainer (evidence: `perceptrons/ptrain1.c`)
- User → Perceptron trainer: runs trainer (evidence: `perceptrons/ptrain2.c`)
- Training CSVs → Perceptron trainer: provides rows (evidence: `perceptrons/ptrain1.c`)
- Training CSVs → Perceptron trainer: provides rows (evidence: `perceptrons/ptrain2.c`)
- Perceptron trainer → Perceptron model: saves model (evidence: `perceptrons/ptrain2.c`)
- User → Perceptron predictor: runs prediction (evidence: `perceptrons/presult.c`)
- Perceptron model → Perceptron predictor: loads parameters (evidence: `perceptrons/presult.c`)
- Training CSVs → Perceptron predictor: provides inputs (evidence: `perceptrons/presult.c`)
- Perceptron predictor → Prediction output: writes predictions (evidence: `perceptrons/presult.c`)
