LaysNet: a graph-theoretic Markov memory network prototype.
Project description
LaysNet
LaysNet is a research prototype for a graph-based, Markov-memory classifier. It is intentionally not a conventional neural network: it does not use backpropagation, dense layers, convolution kernels, or brain-inspired neurons. It stores learned evidence in graph nodes and directed edges, then predicts by routing an encoded input through the graph.
Core idea
Each input is converted into a sequence of numerical symbols. LaysNet stores those symbols as graph nodes and stores observed transitions as weighted directed edges. During prediction, the model walks the graph, uses a semaphore-like router to pick the exact or nearest known node at each step, and scores each class with:
- class prior probability,
- node-label memory probability,
- Markov transition probability,
- optional route regularity diagnostics inspired by Eulerian graph balance.
This makes the model closer to a stochastic graph memory machine than to a standard neural network.
Install
python3 -m venv .venv
. .venv/bin/activate
pip install -e .
For dataset examples:
pip install -e ".[datasets]"
Smoke test:
python3 -m laysnet
Quick CPU Test
python3 examples/train_toy.py
The toy example uses a deterministic local dataset so the model can be tested without GPU or internet.
Real Small Dataset Comparison
The repo bundles the classic UCI Iris dataset inside laysnet/data/iris.csv and keeps a copy at datasets/iris.csv for easy inspection. Run:
python3 examples/compare_iris.py
Current measured local result on the default split:
| model | accuracy |
|---|---:|
| GaussianNB | 1.0000 |
| LaysNet | 1.0000 |
| LaysNetEnsemble | 0.9778 |
| kNN-k3 | 0.9778 |
| Majority | 0.3333 |
Full generated report: reports/iris_comparison.md.
Image/Dataset Pipeline
For real image work, prepare a folder like:
data/animals/
train/
cat/
dog/
test/
cat/
dog/
Then run:
python3 examples/train_image_folder.py --data data/animals --image-size 16
You can download a Kaggle cats/dogs dataset manually with your Kaggle token, place it in this folder structure, and run the same script. The repo does not include Kaggle credentials or fabricated benchmark numbers.
Minimal API
from laysnet import LaysNetClassifier
model = LaysNetClassifier(steps=12, bins=17, seed=7)
model.fit(X_train, y_train)
print(model.score(X_test, y_test))
print(model.predict_one(X_test[0]))
Layer-Style API
import laysnet.nn as lnn
model = lnn.SequentialGraphNetwork(
lnn.GraphEncoder(steps=24, bins=11, seed=5),
lnn.SemaphoreRouter(),
lnn.MarkovMemory(smoothing=0.5, transition_weight=1.7),
)
model.fit(X_train, y_train)
print(model.forward(X_test[0]).label)
Inspect the graph route:
trace = model.trace_one(X_test[0])
print(trace.encoded)
print(trace.route)
print(trace.scores)
Research Artifacts
- Paper draft:
paper/laysnet_paper.md - Generated PDF:
paper/laysnet_paper.pdf - Architecture diagram:
docs/architecture.md - Graph math notes:
docs/math.md - Pipeline guide:
docs/pipeline.md - PyPI release guide:
docs/pypi_release.md - User guide:
docs/user_guide.md - Colab quickstart:
docs/colab_quickstart.md - Research concept:
docs/research_concept.md
Publish to PyPI
python3 -m pip install --upgrade build twine
rm -rf dist/
python3 -m build
python3 -m twine check dist/*
python3 -m twine upload --repository testpypi dist/*
Use docs/pypi_release.md for the full checklist and the safer Trusted Publisher path.
Honest Status
LaysNet is a new research prototype and implementation scaffold. It is suitable for experimentation, ablations, and small CPU tests. It should not be described as state of the art until it has been benchmarked against strong baselines on many public datasets.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file laysnet-0.2.0.tar.gz.
File metadata
- Download URL: laysnet-0.2.0.tar.gz
- Upload date:
- Size: 33.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb9fc92356ea6a0b40f4d0b12c656a41105d4da8aff16689438e5282e82a916a
|
|
| MD5 |
c0d2d96d780bd5c4c3f23aaaa93ebfc5
|
|
| BLAKE2b-256 |
ca374153b80d828f0e56951d731c1853b34c0014f6232bf0336eca2c9181f022
|
File details
Details for the file laysnet-0.2.0-py3-none-any.whl.
File metadata
- Download URL: laysnet-0.2.0-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e10d2d17f461b867baa95760c62e0c3105a7987a82c04a66720d4b00588a387
|
|
| MD5 |
91002f4524e4dc8ef6c5e0654cc56ecf
|
|
| BLAKE2b-256 |
288060f2d60e3490c5c9b35ee5241564179f35d58ec9faf1a9eaf1b3fe9f6e7e
|