aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 6807e1ee15538db1d2bc970a922bdde4451fce34 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

# multilayer-perceptron

A simple multilayer perceptron implementation in NumPy.

## Requirements

- Python >=3.10 (pinned to 3.14 via `.python-version`)
- [uv](https://docs.astral.sh/uv/)

## Getting started

```bash
# install dependencies (creates .venv, respects uv.lock)
uv sync --all-groups

# quick sanity check (no data files needed)
uv run python -c "from MultiLayerPerceptron.main import MultiLayerPerceptron; import numpy as np; mlp = MultiLayerPerceptron([2,4,1]); print(mlp.frontprop(np.array([0,1])) )"

# download MNIST and prepare files (one-time, ~60k train / 10k test)
uv run mlp-download
#  creates data/train.npy, data/test.npy, mnist.npy (initial weights for [784,32,16,10])

# run the MNIST demo (requires data/train.npy, data/test.npy, mnist.npy)
uv run python -m MultiLayerPerceptron.main
```

Manual data tooling (MNIST `idx` → `npy` via `idx2numpy`):

```bash
uv run python -m MultiLayerPerceptron.download --help
uv run python -m MultiLayerPerceptron.data  # legacy, expects idx files in cwd
```

Development:

```bash
uv run ruff check .
uv run ruff format .
uv run ty check
uv run pytest
```

## How to use

1. Download data and save them in `.npy` format. See `MultiLayerPerceptron/data.py` for details.
2. Write a run file for processing data. See script in `MultiLayerPerceptron/main.py` for details.

## TODO

- [ ] Print stages
- [ ] Learning samples method
- [ ] Save mlp
- [ ] Choose error
- [ ] Choose function
- [ ] CLI
- [ ] Multithread / Multiprocess