Cadence
Website · Examples · Paper · PyPI · Documentation
Build Deep Recursive Settlement Networks: processing populations and their observers, learning and settling together.
Cadence explores a simple idea: a brain can be a persistent system of local relations that repairs its state as experience arrives. An observer reads what other patches are doing and influences them while remaining part of the same equilibrium. Another observer can read that enlarged system in turn.
Cadence implements this population architecture in pure Python, using only the standard library. Every processing and observer patch uses one local prediction relation. The compiled brain supports joint settlement, supervised witness learning, diagnostics and continuation.
Install
Python 3.11 or later; no runtime dependencies:
python -m pip install cadence-net
Declare the brain
from cadence import Cortex
cortex = Cortex(seed=7)
eyes = cortex.input("eyes", shape=(8, 8))
ears = cortex.input("ears", shape=(2, 16))
body = cortex.input("sensory_nerves", shape=(8,))
senses = (eyes, ears, body)
c1 = cortex.column("perception", patches=256, inputs=senses)
c2 = cortex.observer(
"integration", patches=256, inputs=senses, observes=(c1,),
)
c3 = cortex.observer(
"reflection", patches=256, inputs=senses, observes=(c1, c2),
)
cortex.output("motor_nerves", shape=(8,), reads=c3)
brain = cortex.build()
assert brain.inspect()["patches"] == 768
assert brain.inspect()["sensor_coverage"] == 104
inputs supplies sensory or represented data. observes adds readback of
live patch states and exact current prediction errors. Observer constraints
feed back into the observed states through the same energy and repair process.
They are not a separate decision made after the lower system finishes.
Population size counts processing patches. Sensor shape counts input samples; a larger camera shape does not supply trained visual understanding. The eight outputs expose eight settled patch values, without a separate policy network. The guide also shows parallel sensory branches and inspection of actual wiring.
Learn a small relation
This inexpensive example teaches a small brain a signed input/output relation. It uses the same population primitive, with fewer patches for a quick run.
teacher_layout = Cortex(seed=2, settle_budget=1200, tolerance=1e-5)
signal = teacher_layout.input("signal", shape=(1,))
base = teacher_layout.column("base", patches=4, inputs=signal)
reflection = teacher_layout.observer(
"reflection", patches=2, inputs=signal, observes=base,
)
teacher_layout.output("answer", shape=(1,), reads=reflection)
learner = teacher_layout.build()
for event_id in range(40):
value = (-0.8, 0.8)[event_id % 2]
update = learner.observe(
{"signal": [value]}, {"answer": [value]}, event_id=event_id,
)
assert update["accepted"]
# Fresh amplitudes, with no output targets supplied to the brain.
assert learner.predict({"signal": [-0.4]})["answer"][0] < -0.2
assert learner.predict({"signal": [0.4]})["answer"][0] > 0.2
Actual witnesses clamp the supplied outputs and allow joint repair of live state and retained relation parameters. Only qualified proposals are committed. Queries hold learned parameters fixed; hypothetical clamps never become experience. Learning is evaluated on later unclamped predictions, as above. This example establishes a small acquired relation, not a benefit from depth.
Scope
The reference engine repairs a nonlinear residual energy using analytic derivatives and a bounded descent procedure. Every participating population is included in the final constrained-stationarity check. Prediction errors can remain nonzero at a qualified compromise; different starting states can reach different stationary points. A solver can refuse when its budget is exhausted.
Performance evaluations and comparisons remain ongoing. Tests cover layouts, derivatives through recursive error readback, reciprocal interventions, actual acquisition, refusal and checkpoint custody. The goal is a reusable learner across perception, memory, reasoning and embodied action. Reward-driven temporal credit, broader capability and advantages from recursive depth require further controlled experiments. Follow the DRSN completion epic.
| Documentation | Scope |
|---|---|
| DRSN guide | Population layouts, equations, learning, all configuration, diagnostics and checkpoints |
| Quickstart | Inputs, settlement, learning and saved continuation |
| API reference | Every public class, method and configuration parameter |
| Mathematical specification | Guarantees, qualification and evidence boundaries |
MIT license.
Metadata
Release files for cadence-net 0.43.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cadence_net-0.43.0.tar.gz | 1.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cadence_net-0.43.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.2 MB
Release files / cadence_net-0.43.0.tar.gz
| Download URL | cadence_net-0.43.0.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60ba444de8bdd28c69d54351e3de66aa27b34e74acaac9e57392327d0a7993ee
|
|
BLAKE2b-256 checksum How to use checksums |
8a0c8f8cc82a23e1bb88e3fa2146ac1bc29d49b18ed1b4e1fb364ce9d18f965f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.0
|
Release files / cadence_net-0.43.0-py3-none-any.whl
| Download URL | cadence_net-0.43.0-py3-none-any.whl |
|---|---|
| Size | 19.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8394ee822d0cff9d754f964307f54ed4f7fdd33cf239fd90a9822844dbab88a6
|
|
BLAKE2b-256 checksum How to use checksums |
c56b3e7446193071210ccdade34e99214b805b0182a3ae1f45933380ed04f471
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.0
|