-
Notifications
You must be signed in to change notification settings - Fork 0
Examples Gallery
Every example is a complete executable built from the repository's examples tree. Use this page to choose an experiment, open its source, and know what result to inspect.
Configure once, then build everything or one target:
cmake -S . -B build -DNUNN_ENABLE_OPENCL=OFF
cmake --build build --config Release
cmake --build build --config Release --target rnn_sinePaths depend on the generator:
single-config: build/examples/<name>/<name>
Visual Studio: build\examples\<name>\Release\<name>.exe
The source-tree build defines every example below. The current install target contains a smaller runtime subset, so use the build tree when a newer demo is not present in an installed bin directory.
| Order | Example | Why it comes next |
|---|---|---|
| 1 | and_test |
smallest trainable unit and linearly separable data |
| 2 | xor_test |
hidden layer and backpropagation |
| 3 | linear_regression_demo |
closed-form fit versus gradient descent |
| 4 | kmeans_demo |
unsupervised assignment and centroids |
| 5 | rnn_sine |
state, BPTT, and autoregressive evaluation |
| 6 | cnn_seq |
end-to-end local filters and pooling |
| 7 | maze |
state/action/reward loop |
| 8 | dqn_maze |
replay buffer and target network |
| 9 | mnist_test |
full dataset, test metrics, persistence, backend |
| Target | Model | Run | Look for |
|---|---|---|---|
and_test |
Perceptron |
and_test |
all four truth-table rows classified correctly |
xor_test |
MlpNN |
xor_test |
nonlinear separation after training |
counter_test |
MlpNN |
counter_test |
encoded counter-state mapping |
linear_regression_demo |
LinearRegression |
linear_regression_demo |
OLS and gradient-descent coefficients, MSE, R² |
titanic |
supervised classifier | titanic |
feature encoding on an embedded real-world table |
AND and XOR form the most useful pair: the data changes only from linearly separable to nonlinearly separable, so the need for a hidden layer is isolated.
| Target | Purpose | Run |
|---|---|---|
mnist_test |
train/test MlpNN or MlpMatrixNN on IDX data |
mnist_test -p /path/to/mnist |
ocr_test |
Windows drawing UI, model loading, and MNIST training | launch ocr_test.exe
|
nunn_topo |
render topology from JSON, legacy .net, or explicit sizes |
nunn_topo --topology 2,3,1 |
net2json |
convert legacy network streams to JSON | net2json <legacy.net> <model.json> |
Useful topology commands:
nunn_topo --topology 2,3,1 --save xor.dot
nunn_topo --load model.json --save model.svg
nunn_topo --load model.net --save model.pngDOT needs no external renderer. SVG, PNG, and PDF require Graphviz. Large networks are compacted by default; use --full only when every node and edge is genuinely useful.
See MNIST and OCR for dataset layout and the full option matrix.
| Target | Models | Defaults and useful variants |
|---|---|---|
rnn_sine |
Vanilla RNN, GRU, LSTM |
rnn_sine, rnn_sine --gru, rnn_sine --lstm
|
rnn_adding |
all three side by side | rnn_adding [sequence_length] [hidden] [epochs] [lr] |
rnn_char |
Vanilla RNN, GRU, LSTM | rnn_char --gru 1200 128 120 0.8 |
rnn_sine reports an autoregressive rollout, not only a one-step fit. rnn_adding is the better long-memory comparison because exactly two marked values must survive irrelevant steps. rnn_char shows how temperature changes sampling from softmax output.
Read Recurrent Networks before interpreting architecture differences.
| Target | Model | Run | Look for |
|---|---|---|---|
cnn_seq |
ConvNet |
cnn_seq [epochs] [lr] |
train/test accuracy on noisy one- versus two-cycle signals |
transformer_char |
MiniTransformer |
transformer_char [epochs] [lr] [generated_length] |
mean token loss and causal continuation |
These examples keep inputs deliberately small so the full forward and backward implementations in nu_conv.cc and nu_transformer.cc remain practical to inspect.
| Target | Model | Run | Primary metric or artifact |
|---|---|---|---|
kmeans_demo |
KMeans |
kmeans_demo [k] [samples_per_cluster] [seed] |
inertia, centroids, ASCII assignment map |
pca_demo |
Pca |
pca_demo [components] [samples] [seed] |
explained variance and reconstruction MSE |
hopfield_test |
HopfieldNN |
hopfield_test |
recall from a corrupted binary pattern |
ae_demo |
Autoencoder |
ae_demo [epochs] |
bottleneck codes and reconstruction |
rbf_demo |
Rbf |
rbf_demo [centers] [epochs] [lr] |
sine-regression train/test MSE |
rbm_demo |
Rbm |
rbm_demo |
reconstruction before/after CD-1 |
vae_demo |
Vae |
vae_demo |
reconstructions, latent means, generated samples |
som_demo |
Som |
som_demo |
quantization error and organized prototype grid |
Do not rank these models by one shared loss: each optimizes a different objective. Classical and Unsupervised Models explains the metrics and provides minimal API fragments.
| Target | Model | Run | Observe |
|---|---|---|---|
maze |
QLearn or Sarsa selected in source |
maze |
learned navigation policy |
path_finder |
graph Q-learning | path_finder |
route recovered from state values |
dqn_maze |
Dqn |
dqn_maze [episodes] [lr] |
rolling successes, learn steps, greedy trace |
tictactoe |
MlpNN |
tictactoe |
console game-state evaluation |
winttt |
MlpNN |
launch winttt.exe on Windows |
GUI inference and packaged resources |
For RL, record the reward definition and episode cap before comparing results. See Reinforcement Learning.
For any target:
- Run it unchanged and save the output.
- Read its
main()from construction through evaluation. - Open the linked public header and identify every method called.
- Follow one forward/update path in the implementation.
- Open the matching test from
tests. - Change one parameter, predict the effect, then rerun.
This turns the examples into controlled experiments rather than isolated demos.
Use Implementation Map for model-to-source-to-test cross-references and Training and Diagnostics for a repeatable experiment record.