mindz 0.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mindz-0.0.2/LICENSE +24 -0
- mindz-0.0.2/PKG-INFO +195 -0
- mindz-0.0.2/README.md +170 -0
- mindz-0.0.2/pyproject.toml +44 -0
- mindz-0.0.2/setup.cfg +4 -0
- mindz-0.0.2/src/mindz/__init__.py +1 -0
- mindz-0.0.2/src/mindz/__main__.py +3 -0
- mindz-0.0.2/src/mindz/assets/__init__.py +0 -0
- mindz-0.0.2/src/mindz/assets/fonts/Inter-Medium.ttf +0 -0
- mindz-0.0.2/src/mindz/assets/fonts/Inter-OFL.txt +92 -0
- mindz-0.0.2/src/mindz/assets/fonts/Inter-Regular.ttf +0 -0
- mindz-0.0.2/src/mindz/assets/fonts/Inter-SemiBold.ttf +0 -0
- mindz-0.0.2/src/mindz/assets/fonts/InterDisplay-SemiBold.ttf +0 -0
- mindz-0.0.2/src/mindz/assets/fonts/JetBrainsMono-Medium.ttf +0 -0
- mindz-0.0.2/src/mindz/assets/fonts/JetBrainsMono-OFL.txt +93 -0
- mindz-0.0.2/src/mindz/assets/fonts/JetBrainsMono-Regular.ttf +0 -0
- mindz-0.0.2/src/mindz/assets/icon.png +0 -0
- mindz-0.0.2/src/mindz/cli.py +129 -0
- mindz-0.0.2/src/mindz/core/__init__.py +0 -0
- mindz-0.0.2/src/mindz/core/glossary.py +673 -0
- mindz-0.0.2/src/mindz/core/glossary_more.py +606 -0
- mindz-0.0.2/src/mindz/core/i18n.py +292 -0
- mindz-0.0.2/src/mindz/core/i18n_more.py +245 -0
- mindz-0.0.2/src/mindz/core/lessons.py +290 -0
- mindz-0.0.2/src/mindz/core/lexicon.py +189 -0
- mindz-0.0.2/src/mindz/core/locales/ar.json +248 -0
- mindz-0.0.2/src/mindz/core/locales/az.json +248 -0
- mindz-0.0.2/src/mindz/core/locales/de.json +248 -0
- mindz-0.0.2/src/mindz/core/locales/es.json +248 -0
- mindz-0.0.2/src/mindz/core/locales/fa.json +248 -0
- mindz-0.0.2/src/mindz/core/locales/fr.json +248 -0
- mindz-0.0.2/src/mindz/core/locales/ru.json +248 -0
- mindz-0.0.2/src/mindz/core/locales/zh.json +248 -0
- mindz-0.0.2/src/mindz/core/more_dl.py +213 -0
- mindz-0.0.2/src/mindz/core/more_gen.py +199 -0
- mindz-0.0.2/src/mindz/core/more_ml.py +342 -0
- mindz-0.0.2/src/mindz/core/more_tf.py +251 -0
- mindz-0.0.2/src/mindz/core/rng.py +25 -0
- mindz-0.0.2/src/mindz/core/topics.py +633 -0
- mindz-0.0.2/src/mindz/core/trace.py +89 -0
- mindz-0.0.2/src/mindz/gui/__init__.py +0 -0
- mindz-0.0.2/src/mindz/gui/app.py +29 -0
- mindz-0.0.2/src/mindz/gui/dialogs.py +158 -0
- mindz-0.0.2/src/mindz/gui/main_window.py +1003 -0
- mindz-0.0.2/src/mindz/gui/player.py +119 -0
- mindz-0.0.2/src/mindz/gui/theme.py +309 -0
- mindz-0.0.2/src/mindz/gui/views/__init__.py +0 -0
- mindz-0.0.2/src/mindz/gui/views/attention_view.py +216 -0
- mindz-0.0.2/src/mindz/gui/views/base.py +585 -0
- mindz-0.0.2/src/mindz/gui/views/kmeans_view.py +137 -0
- mindz-0.0.2/src/mindz/gui/views/linreg_view.py +231 -0
- mindz-0.0.2/src/mindz/gui/views/ml_views.py +540 -0
- mindz-0.0.2/src/mindz/gui/views/mlp_view.py +205 -0
- mindz-0.0.2/src/mindz/gui/views/more_views.py +652 -0
- mindz-0.0.2/src/mindz/gui/views/sampling_view.py +213 -0
- mindz-0.0.2/src/mindz/gui/views/tokens_view.py +133 -0
- mindz-0.0.2/src/mindz/gui/widgets.py +456 -0
- mindz-0.0.2/src/mindz/settings.py +67 -0
- mindz-0.0.2/src/mindz.egg-info/PKG-INFO +195 -0
- mindz-0.0.2/src/mindz.egg-info/SOURCES.txt +65 -0
- mindz-0.0.2/src/mindz.egg-info/dependency_links.txt +1 -0
- mindz-0.0.2/src/mindz.egg-info/entry_points.txt +3 -0
- mindz-0.0.2/src/mindz.egg-info/requires.txt +5 -0
- mindz-0.0.2/src/mindz.egg-info/top_level.txt +1 -0
- mindz-0.0.2/tests/test_cli_gui.py +64 -0
- mindz-0.0.2/tests/test_core.py +210 -0
- mindz-0.0.2/tests/test_ports.py +30 -0
mindz-0.0.2/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bayram Kotan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
The bundled fonts in src/neurz/assets/fonts (Inter, JetBrains Mono) are
|
|
24
|
+
distributed under the SIL Open Font License 1.1; see the OFL files there.
|
mindz-0.0.2/PKG-INFO
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mindz
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: Learn AI by watching it think: 17 step-by-step lessons from linear regression to Transformers, Q-learning and diffusion, with play, pause and scrub, in ten languages.
|
|
5
|
+
Author: Bayram Kotan
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/bayramkotan/mindz
|
|
8
|
+
Project-URL: Issues, https://github.com/bayramkotan/mindz/issues
|
|
9
|
+
Keywords: machine learning,deep learning,artificial intelligence,nlp,transformer,attention,education,visualization,pyside6
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Intended Audience :: Education
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Classifier: Topic :: Education
|
|
16
|
+
Classifier: Environment :: X11 Applications :: Qt
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: PySide6>=6.6
|
|
21
|
+
Requires-Dist: numpy>=1.24
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# mindz
|
|
27
|
+
|
|
28
|
+
**Learn AI by watching it think: machine learning, neural networks, tokenization, attention and language models, one operation at a time.**
|
|
29
|
+
|
|
30
|
+
mindz is an educational desktop app. Every lesson runs a real algorithm with real arithmetic,
|
|
31
|
+
records every step and lets you play, pause, step and scrub through it like a video. Every
|
|
32
|
+
number on screen is a number the algorithm actually computed; every point, line, neuron,
|
|
33
|
+
token and matrix can be clicked for an explanation in plain language, in detail or as a formula.
|
|
34
|
+
|
|
35
|
+
It belongs with [qubitz](https://github.com/bayramkotan/qubitz) (quantum computing) and
|
|
36
|
+
[neurz](https://github.com/bayramkotan/neurz) (RNN, LSTM, GRU and CNN up close).
|
|
37
|
+
|
|
38
|
+
## What you can watch
|
|
39
|
+
|
|
40
|
+
Seventeen lessons in six chapters. Each runs a real algorithm and records every step.
|
|
41
|
+
|
|
42
|
+
| Chapter | Lesson | What is animated |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| **Machine learning** | **Linear regression** | the line, the errors and their squares, the loss, the gradient on the loss surface, every gradient-descent step; a learning rate that is too large diverges |
|
|
45
|
+
| | **Logistic regression** | one neuron: its line and the weight vector w, every point placed on the sigmoid by its z, cross-entropy, the line settling into the gap |
|
|
46
|
+
| | **Overfitting** | polynomials of degree 1 to 12 against training and validation data, the U-shaped validation error, ridge regularisation λ |
|
|
47
|
+
| | **k nearest neighbours** | distances from a new point, the k nearest inside a circle, the vote, the whole decision map, leave-one-out accuracy |
|
|
48
|
+
| | **Decision tree** | the Gini scan over every threshold, split after split, the regions and the tree drawn as it grows |
|
|
49
|
+
| | **K-means** | random centres, assignment and update rounds, the regions of the centres, J falling until nothing changes |
|
|
50
|
+
| **Deep learning** | **Neural network** | one sample forward and backward, then hundreds of epochs bending the boundary; the straight line of every hidden neuron |
|
|
51
|
+
| | **Convolution** | a 3×3 filter sliding over a picture, the feature map filling cell by cell, ReLU and 2×2 max pooling |
|
|
52
|
+
| **Language (NLP)** | **Tokenization (BPE)** | characters, pair counts, merge after merge, the vocabulary and the token ids |
|
|
53
|
+
| | **Word vectors** | context windows, co-occurrence counts, PPMI, SVD down to a word map, nearest words by cosine |
|
|
54
|
+
| **Transformer · LLM** | **Self-attention** | readable embeddings with positions, Q, K, V, scores, softmax and the weighted sum row by row, causal mask |
|
|
55
|
+
| | **Transformer block** | three heads side by side, concat and W_O, residual, layer norm, feed-forward, residual, layer norm |
|
|
56
|
+
| | **Attention learns** | a head that starts random and learns W_Q and W_K by gradient descent; the query–key table grows its diagonal |
|
|
57
|
+
| | **Next word** | logits, temperature, softmax, top-k, top-p, the dice on the cumulative bar, or greedy argmax |
|
|
58
|
+
| | **Beam search** | the search tree expanding and pruning, beam against greedy with their log probabilities |
|
|
59
|
+
| **Reinforcement learning** | **Q-learning** | an agent on a grid: ε-greedy moves, the update rule with its numbers, values spreading back from the goal, the policy |
|
|
60
|
+
| **Generative models** | **Diffusion** | noise added step by step, then removed from fresh noise with DDIM and the ideal denoiser, for 2-D points or tiny pictures |
|
|
61
|
+
|
|
62
|
+

|
|
63
|
+
|
|
64
|
+
- **Playback:** play / pause, step forward and back, jump to start or end, loop, speed 0.25×–8×, a timeline grouped by step that you can click or drag.
|
|
65
|
+
- **Click to learn:** every element opens a short bubble; the right panel explains it at three levels (Simple · Detailed · Math) with links to related concepts; hovering shows the exact numbers.
|
|
66
|
+
- **Lessons:** a guided lesson per topic, each step jumping to the moment it talks about, with a question at the end.
|
|
67
|
+
- **Change everything:** learning rates, steps, noise, k, datasets, depth, hidden neurons, filters and pictures, your own text and sentences, temperature, top-k, top-p, beam width, exploration ε, seeds. The run is recomputed at once.
|
|
68
|
+
- **Ten languages:** Türkçe, English, Azərbaycanca, Deutsch, Français, Español, Русский, العربية, فارسی, 中文 (right-to-left for Arabic and Persian). Interface and step narration are translated everywhere; the long concept texts are in Turkish and English, other languages show translated titles and the English text.
|
|
69
|
+
- **9 themes**, your own interface and number fonts and text sizes.
|
|
70
|
+
|
|
71
|
+

|
|
72
|
+
|
|
73
|
+

|
|
74
|
+
|
|
75
|
+

|
|
76
|
+
|
|
77
|
+

|
|
78
|
+
|
|
79
|
+

|
|
80
|
+
|
|
81
|
+

|
|
82
|
+
|
|
83
|
+
## Download (portable, nothing to install)
|
|
84
|
+
|
|
85
|
+
Every release on the [Releases page](https://github.com/bayramkotan/mindz/releases) carries ready-to-run builds:
|
|
86
|
+
|
|
87
|
+
| System | File | How to start |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| Windows 10/11 | `mindz-<version>-windows-x64.exe` | double-click (SmartScreen: *More info → Run anyway*) |
|
|
90
|
+
| Linux x86-64 | `mindz-<version>-linux-x86_64.AppImage` | `chmod +x mindz-*.AppImage && ./mindz-*.AppImage` |
|
|
91
|
+
| macOS (Apple silicon) | `mindz-<version>-macos-arm64.zip` | unzip, then right-click `mindz.app` → *Open* (the app is not notarised) |
|
|
92
|
+
|
|
93
|
+
## Install
|
|
94
|
+
|
|
95
|
+
The desktop app (Python, PyPI):
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
pip install mindz
|
|
99
|
+
mindz # or: mz
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Python 3.10+ with PySide6 and NumPy; runs on Windows, Linux and macOS.
|
|
103
|
+
|
|
104
|
+
Gradient descent and the BPE tokenizer also run in the terminal or in your own code, without the window:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
npm install -g mindz # JavaScript (npm)
|
|
108
|
+
mindz run linreg --lr 0.18
|
|
109
|
+
|
|
110
|
+
cargo install mindz # Rust (crates.io)
|
|
111
|
+
mindz run tokens --text "low lower lowest newer newest" --merges 5
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```js
|
|
115
|
+
import { linreg, bpe } from "mindz";
|
|
116
|
+
const r = linreg({ lr: 0.08, steps: 40 }); // r.steps: [{ k, loss, w, b, dw, db }]
|
|
117
|
+
const t = bpe("low lower lowest", 4); // t.merges, t.vocab, t.tokens, t.ids
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
```rust
|
|
121
|
+
let r = mindz::linreg(0.08, 40, 0.8, 3); // r.steps, r.diverged
|
|
122
|
+
let t = mindz::bpe("low lower lowest", 4, "en"); // t.merges, t.vocab, t.tokens, t.ids
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
All three packages are called `mindz`. The data come from the same small random generator,
|
|
126
|
+
so the JavaScript and Rust results match the Python app number for number (the test suites
|
|
127
|
+
check this against `tests/golden.json`). `mindz gui` in the npm and Rust versions opens the
|
|
128
|
+
Python desktop app if it is installed.
|
|
129
|
+
|
|
130
|
+
## Command line
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
mz topics # the seventeen lessons
|
|
134
|
+
mz run linreg --lr 0.3 # every step with its numbers (this one diverges)
|
|
135
|
+
mz run kmeans --k 4 --seed 9
|
|
136
|
+
mz run mlp --dataset spiral --hidden 8 --lr 3
|
|
137
|
+
mz run tokens --text "evler evlerde kitaplar kitaplarda" --lang tr
|
|
138
|
+
mz run attention --sentence "the small dog brought the big ball" --causal true
|
|
139
|
+
mz run sampling --temperature 1.5 --top-k 5 --top-p 0.9
|
|
140
|
+
mz run sampling --method greedy
|
|
141
|
+
mz run beam --start teacher --width 3
|
|
142
|
+
mz run tree --depth 4 --dataset xor
|
|
143
|
+
mz run qlearn --epsilon 0.2
|
|
144
|
+
mz run diffusion --shape images
|
|
145
|
+
mz concepts # every concept key
|
|
146
|
+
mz explain temperature --level math # simple | detail | math
|
|
147
|
+
mz update # upgrade with this Python's pip
|
|
148
|
+
mz -v
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`--lang tr` or `--lang en` may stand anywhere on the line; without it the system language is used.
|
|
152
|
+
|
|
153
|
+
## Keyboard
|
|
154
|
+
|
|
155
|
+
| Key | Action |
|
|
156
|
+
|---|---|
|
|
157
|
+
| Space | play / pause |
|
|
158
|
+
| ← / → | step back / forward |
|
|
159
|
+
| Home / End | start / end |
|
|
160
|
+
| + / − | faster / slower |
|
|
161
|
+
| L | loop |
|
|
162
|
+
| 1 … 9 | the first nine topics |
|
|
163
|
+
| F1 / F2 / F3 | Simple / Detailed / Math explanations |
|
|
164
|
+
| Ctrl+B / Ctrl+E | left / right panel |
|
|
165
|
+
| Ctrl+L | lesson |
|
|
166
|
+
| Ctrl+, | settings |
|
|
167
|
+
|
|
168
|
+
## How it works
|
|
169
|
+
|
|
170
|
+
`src/mindz/core/topics.py` runs each algorithm once and records every operation as a frame
|
|
171
|
+
(phase, values, the formula with its own numbers, the concept it explains). The window only
|
|
172
|
+
moves through these frames, so pausing, stepping back and scrubbing never recompute anything.
|
|
173
|
+
The attention lesson uses a hand-made embedding whose six dimensions have a meaning (noun,
|
|
174
|
+
living, verb, pronoun, adjective, function word) plus two for position, and hand-written
|
|
175
|
+
W_Q, W_K, W_V, so the attention pattern can be explained; real Transformers learn all of these.
|
|
176
|
+
The next-word and beam-search lessons use a bigram model counted from a small built-in text.
|
|
177
|
+
The diffusion lesson uses the exact ("ideal") denoiser of its training set instead of a trained
|
|
178
|
+
network, so it shows the mechanics of the reverse process honestly, including that a perfect
|
|
179
|
+
denoiser can only give the training examples back.
|
|
180
|
+
|
|
181
|
+
## Development
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
git clone https://github.com/bayramkotan/mindz && cd mindz
|
|
185
|
+
pip install -e .[dev]
|
|
186
|
+
pytest -q # Python
|
|
187
|
+
npm test # JavaScript
|
|
188
|
+
cargo test # Rust
|
|
189
|
+
python tools/make_golden.py # after changing the shared runs
|
|
190
|
+
python packaging/build.py # portable build for this system
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
MIT © 2026 Bayram Kotan. Bundled fonts: Inter and JetBrains Mono (SIL Open Font License).
|
mindz-0.0.2/README.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# mindz
|
|
2
|
+
|
|
3
|
+
**Learn AI by watching it think: machine learning, neural networks, tokenization, attention and language models, one operation at a time.**
|
|
4
|
+
|
|
5
|
+
mindz is an educational desktop app. Every lesson runs a real algorithm with real arithmetic,
|
|
6
|
+
records every step and lets you play, pause, step and scrub through it like a video. Every
|
|
7
|
+
number on screen is a number the algorithm actually computed; every point, line, neuron,
|
|
8
|
+
token and matrix can be clicked for an explanation in plain language, in detail or as a formula.
|
|
9
|
+
|
|
10
|
+
It belongs with [qubitz](https://github.com/bayramkotan/qubitz) (quantum computing) and
|
|
11
|
+
[neurz](https://github.com/bayramkotan/neurz) (RNN, LSTM, GRU and CNN up close).
|
|
12
|
+
|
|
13
|
+
## What you can watch
|
|
14
|
+
|
|
15
|
+
Seventeen lessons in six chapters. Each runs a real algorithm and records every step.
|
|
16
|
+
|
|
17
|
+
| Chapter | Lesson | What is animated |
|
|
18
|
+
|---|---|---|
|
|
19
|
+
| **Machine learning** | **Linear regression** | the line, the errors and their squares, the loss, the gradient on the loss surface, every gradient-descent step; a learning rate that is too large diverges |
|
|
20
|
+
| | **Logistic regression** | one neuron: its line and the weight vector w, every point placed on the sigmoid by its z, cross-entropy, the line settling into the gap |
|
|
21
|
+
| | **Overfitting** | polynomials of degree 1 to 12 against training and validation data, the U-shaped validation error, ridge regularisation λ |
|
|
22
|
+
| | **k nearest neighbours** | distances from a new point, the k nearest inside a circle, the vote, the whole decision map, leave-one-out accuracy |
|
|
23
|
+
| | **Decision tree** | the Gini scan over every threshold, split after split, the regions and the tree drawn as it grows |
|
|
24
|
+
| | **K-means** | random centres, assignment and update rounds, the regions of the centres, J falling until nothing changes |
|
|
25
|
+
| **Deep learning** | **Neural network** | one sample forward and backward, then hundreds of epochs bending the boundary; the straight line of every hidden neuron |
|
|
26
|
+
| | **Convolution** | a 3×3 filter sliding over a picture, the feature map filling cell by cell, ReLU and 2×2 max pooling |
|
|
27
|
+
| **Language (NLP)** | **Tokenization (BPE)** | characters, pair counts, merge after merge, the vocabulary and the token ids |
|
|
28
|
+
| | **Word vectors** | context windows, co-occurrence counts, PPMI, SVD down to a word map, nearest words by cosine |
|
|
29
|
+
| **Transformer · LLM** | **Self-attention** | readable embeddings with positions, Q, K, V, scores, softmax and the weighted sum row by row, causal mask |
|
|
30
|
+
| | **Transformer block** | three heads side by side, concat and W_O, residual, layer norm, feed-forward, residual, layer norm |
|
|
31
|
+
| | **Attention learns** | a head that starts random and learns W_Q and W_K by gradient descent; the query–key table grows its diagonal |
|
|
32
|
+
| | **Next word** | logits, temperature, softmax, top-k, top-p, the dice on the cumulative bar, or greedy argmax |
|
|
33
|
+
| | **Beam search** | the search tree expanding and pruning, beam against greedy with their log probabilities |
|
|
34
|
+
| **Reinforcement learning** | **Q-learning** | an agent on a grid: ε-greedy moves, the update rule with its numbers, values spreading back from the goal, the policy |
|
|
35
|
+
| **Generative models** | **Diffusion** | noise added step by step, then removed from fresh noise with DDIM and the ideal denoiser, for 2-D points or tiny pictures |
|
|
36
|
+
|
|
37
|
+

|
|
38
|
+
|
|
39
|
+
- **Playback:** play / pause, step forward and back, jump to start or end, loop, speed 0.25×–8×, a timeline grouped by step that you can click or drag.
|
|
40
|
+
- **Click to learn:** every element opens a short bubble; the right panel explains it at three levels (Simple · Detailed · Math) with links to related concepts; hovering shows the exact numbers.
|
|
41
|
+
- **Lessons:** a guided lesson per topic, each step jumping to the moment it talks about, with a question at the end.
|
|
42
|
+
- **Change everything:** learning rates, steps, noise, k, datasets, depth, hidden neurons, filters and pictures, your own text and sentences, temperature, top-k, top-p, beam width, exploration ε, seeds. The run is recomputed at once.
|
|
43
|
+
- **Ten languages:** Türkçe, English, Azərbaycanca, Deutsch, Français, Español, Русский, العربية, فارسی, 中文 (right-to-left for Arabic and Persian). Interface and step narration are translated everywhere; the long concept texts are in Turkish and English, other languages show translated titles and the English text.
|
|
44
|
+
- **9 themes**, your own interface and number fonts and text sizes.
|
|
45
|
+
|
|
46
|
+

|
|
47
|
+
|
|
48
|
+

|
|
49
|
+
|
|
50
|
+

|
|
51
|
+
|
|
52
|
+

|
|
53
|
+
|
|
54
|
+

|
|
55
|
+
|
|
56
|
+

|
|
57
|
+
|
|
58
|
+
## Download (portable, nothing to install)
|
|
59
|
+
|
|
60
|
+
Every release on the [Releases page](https://github.com/bayramkotan/mindz/releases) carries ready-to-run builds:
|
|
61
|
+
|
|
62
|
+
| System | File | How to start |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| Windows 10/11 | `mindz-<version>-windows-x64.exe` | double-click (SmartScreen: *More info → Run anyway*) |
|
|
65
|
+
| Linux x86-64 | `mindz-<version>-linux-x86_64.AppImage` | `chmod +x mindz-*.AppImage && ./mindz-*.AppImage` |
|
|
66
|
+
| macOS (Apple silicon) | `mindz-<version>-macos-arm64.zip` | unzip, then right-click `mindz.app` → *Open* (the app is not notarised) |
|
|
67
|
+
|
|
68
|
+
## Install
|
|
69
|
+
|
|
70
|
+
The desktop app (Python, PyPI):
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install mindz
|
|
74
|
+
mindz # or: mz
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Python 3.10+ with PySide6 and NumPy; runs on Windows, Linux and macOS.
|
|
78
|
+
|
|
79
|
+
Gradient descent and the BPE tokenizer also run in the terminal or in your own code, without the window:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npm install -g mindz # JavaScript (npm)
|
|
83
|
+
mindz run linreg --lr 0.18
|
|
84
|
+
|
|
85
|
+
cargo install mindz # Rust (crates.io)
|
|
86
|
+
mindz run tokens --text "low lower lowest newer newest" --merges 5
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
import { linreg, bpe } from "mindz";
|
|
91
|
+
const r = linreg({ lr: 0.08, steps: 40 }); // r.steps: [{ k, loss, w, b, dw, db }]
|
|
92
|
+
const t = bpe("low lower lowest", 4); // t.merges, t.vocab, t.tokens, t.ids
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
```rust
|
|
96
|
+
let r = mindz::linreg(0.08, 40, 0.8, 3); // r.steps, r.diverged
|
|
97
|
+
let t = mindz::bpe("low lower lowest", 4, "en"); // t.merges, t.vocab, t.tokens, t.ids
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
All three packages are called `mindz`. The data come from the same small random generator,
|
|
101
|
+
so the JavaScript and Rust results match the Python app number for number (the test suites
|
|
102
|
+
check this against `tests/golden.json`). `mindz gui` in the npm and Rust versions opens the
|
|
103
|
+
Python desktop app if it is installed.
|
|
104
|
+
|
|
105
|
+
## Command line
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
mz topics # the seventeen lessons
|
|
109
|
+
mz run linreg --lr 0.3 # every step with its numbers (this one diverges)
|
|
110
|
+
mz run kmeans --k 4 --seed 9
|
|
111
|
+
mz run mlp --dataset spiral --hidden 8 --lr 3
|
|
112
|
+
mz run tokens --text "evler evlerde kitaplar kitaplarda" --lang tr
|
|
113
|
+
mz run attention --sentence "the small dog brought the big ball" --causal true
|
|
114
|
+
mz run sampling --temperature 1.5 --top-k 5 --top-p 0.9
|
|
115
|
+
mz run sampling --method greedy
|
|
116
|
+
mz run beam --start teacher --width 3
|
|
117
|
+
mz run tree --depth 4 --dataset xor
|
|
118
|
+
mz run qlearn --epsilon 0.2
|
|
119
|
+
mz run diffusion --shape images
|
|
120
|
+
mz concepts # every concept key
|
|
121
|
+
mz explain temperature --level math # simple | detail | math
|
|
122
|
+
mz update # upgrade with this Python's pip
|
|
123
|
+
mz -v
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
`--lang tr` or `--lang en` may stand anywhere on the line; without it the system language is used.
|
|
127
|
+
|
|
128
|
+
## Keyboard
|
|
129
|
+
|
|
130
|
+
| Key | Action |
|
|
131
|
+
|---|---|
|
|
132
|
+
| Space | play / pause |
|
|
133
|
+
| ← / → | step back / forward |
|
|
134
|
+
| Home / End | start / end |
|
|
135
|
+
| + / − | faster / slower |
|
|
136
|
+
| L | loop |
|
|
137
|
+
| 1 … 9 | the first nine topics |
|
|
138
|
+
| F1 / F2 / F3 | Simple / Detailed / Math explanations |
|
|
139
|
+
| Ctrl+B / Ctrl+E | left / right panel |
|
|
140
|
+
| Ctrl+L | lesson |
|
|
141
|
+
| Ctrl+, | settings |
|
|
142
|
+
|
|
143
|
+
## How it works
|
|
144
|
+
|
|
145
|
+
`src/mindz/core/topics.py` runs each algorithm once and records every operation as a frame
|
|
146
|
+
(phase, values, the formula with its own numbers, the concept it explains). The window only
|
|
147
|
+
moves through these frames, so pausing, stepping back and scrubbing never recompute anything.
|
|
148
|
+
The attention lesson uses a hand-made embedding whose six dimensions have a meaning (noun,
|
|
149
|
+
living, verb, pronoun, adjective, function word) plus two for position, and hand-written
|
|
150
|
+
W_Q, W_K, W_V, so the attention pattern can be explained; real Transformers learn all of these.
|
|
151
|
+
The next-word and beam-search lessons use a bigram model counted from a small built-in text.
|
|
152
|
+
The diffusion lesson uses the exact ("ideal") denoiser of its training set instead of a trained
|
|
153
|
+
network, so it shows the mechanics of the reverse process honestly, including that a perfect
|
|
154
|
+
denoiser can only give the training examples back.
|
|
155
|
+
|
|
156
|
+
## Development
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
git clone https://github.com/bayramkotan/mindz && cd mindz
|
|
160
|
+
pip install -e .[dev]
|
|
161
|
+
pytest -q # Python
|
|
162
|
+
npm test # JavaScript
|
|
163
|
+
cargo test # Rust
|
|
164
|
+
python tools/make_golden.py # after changing the shared runs
|
|
165
|
+
python packaging/build.py # portable build for this system
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
MIT © 2026 Bayram Kotan. Bundled fonts: Inter and JetBrains Mono (SIL Open Font License).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "mindz"
|
|
7
|
+
version = "0.0.2"
|
|
8
|
+
description = "Learn AI by watching it think: 17 step-by-step lessons from linear regression to Transformers, Q-learning and diffusion, with play, pause and scrub, in ten languages."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "Bayram Kotan" }]
|
|
13
|
+
keywords = ["machine learning", "deep learning", "artificial intelligence", "nlp", "transformer", "attention", "education", "visualization", "pyside6"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
"Intended Audience :: Education",
|
|
19
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
20
|
+
"Topic :: Education",
|
|
21
|
+
"Environment :: X11 Applications :: Qt",
|
|
22
|
+
]
|
|
23
|
+
dependencies = ["PySide6>=6.6", "numpy>=1.24"]
|
|
24
|
+
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
dev = ["pytest>=7"]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Homepage = "https://github.com/bayramkotan/mindz"
|
|
30
|
+
Issues = "https://github.com/bayramkotan/mindz/issues"
|
|
31
|
+
|
|
32
|
+
[project.scripts]
|
|
33
|
+
mindz = "mindz.cli:main"
|
|
34
|
+
mz = "mindz.cli:main"
|
|
35
|
+
|
|
36
|
+
[tool.setuptools.packages.find]
|
|
37
|
+
where = ["src"]
|
|
38
|
+
|
|
39
|
+
[tool.setuptools.package-data]
|
|
40
|
+
"mindz.core" = ["locales/*.json"]
|
|
41
|
+
"mindz.assets" = ["icon.png", "fonts/*.ttf", "fonts/*.txt"]
|
|
42
|
+
|
|
43
|
+
[tool.pytest.ini_options]
|
|
44
|
+
testpaths = ["tests"]
|
mindz-0.0.2/setup.cfg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.2"
|
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
-----------------------------------------------------------
|
|
8
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
9
|
+
-----------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
PREAMBLE
|
|
12
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
13
|
+
development of collaborative font projects, to support the font creation
|
|
14
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
15
|
+
open framework in which fonts may be shared and improved in partnership
|
|
16
|
+
with others.
|
|
17
|
+
|
|
18
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
19
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
20
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
21
|
+
redistributed and/or sold with any software provided that any reserved
|
|
22
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
23
|
+
however, cannot be released under any other type of license. The
|
|
24
|
+
requirement for fonts to remain under this license does not apply
|
|
25
|
+
to any document created using the fonts or their derivatives.
|
|
26
|
+
|
|
27
|
+
DEFINITIONS
|
|
28
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
29
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
30
|
+
include source files, build scripts and documentation.
|
|
31
|
+
|
|
32
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
33
|
+
copyright statement(s).
|
|
34
|
+
|
|
35
|
+
"Original Version" refers to the collection of Font Software components as
|
|
36
|
+
distributed by the Copyright Holder(s).
|
|
37
|
+
|
|
38
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
39
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
40
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
41
|
+
new environment.
|
|
42
|
+
|
|
43
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
44
|
+
writer or other person who contributed to the Font Software.
|
|
45
|
+
|
|
46
|
+
PERMISSION AND CONDITIONS
|
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
48
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
49
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
50
|
+
Software, subject to the following conditions:
|
|
51
|
+
|
|
52
|
+
1) Neither the Font Software nor any of its individual components,
|
|
53
|
+
in Original or Modified Versions, may be sold by itself.
|
|
54
|
+
|
|
55
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
56
|
+
redistributed and/or sold with any software, provided that each copy
|
|
57
|
+
contains the above copyright notice and this license. These can be
|
|
58
|
+
included either as stand-alone text files, human-readable headers or
|
|
59
|
+
in the appropriate machine-readable metadata fields within text or
|
|
60
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
61
|
+
|
|
62
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
63
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
64
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
65
|
+
presented to the users.
|
|
66
|
+
|
|
67
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
68
|
+
Software shall not be used to promote, endorse or advertise any
|
|
69
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
70
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
71
|
+
permission.
|
|
72
|
+
|
|
73
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
74
|
+
must be distributed entirely under this license, and must not be
|
|
75
|
+
distributed under any other license. The requirement for fonts to
|
|
76
|
+
remain under this license does not apply to any document created
|
|
77
|
+
using the Font Software.
|
|
78
|
+
|
|
79
|
+
TERMINATION
|
|
80
|
+
This license becomes null and void if any of the above conditions are
|
|
81
|
+
not met.
|
|
82
|
+
|
|
83
|
+
DISCLAIMER
|
|
84
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
85
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
86
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
87
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
88
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
89
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
90
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
91
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
92
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
https://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|