The programmable model
Bring your own reward.
The public JavaScript module exposes the same model used in the paper. Your task supplies an observation with 314 values. The model chooses one of two actions, then receives a scalar reward. The reward is supplied after the choice.
import { Model, RNG, defaults } from './core.mjs';
const circuit = await fetch('./data/circuit.json').then(r => r.json());
const model = new Model(circuit, 'anatomical', 301, defaults);
const random = new RNG(301);
// Implement your task. Do not pass its correct answer into predict().
for (let episode = 0; episode < 1600; episode++) {
const observation = environment.observe(); // Float64Array(314)
const prediction = model.predict(observation);
const action = random.next() < prediction.p1 ? 1 : 0;
const reward = environment.reward(action); // number from 0 to 1
model.learn(prediction, action, reward);
}
const learnedGains = model.snapshot();
// Later, on the identical circuit, arm, seed and configuration:
model.restore(learnedGains);This example is an interface sketch. You must implement the environment. Use the Experiment class when you also want its task definitions, random streams and complete portable checkpoints. Model.snapshot alone does not save the environment or its random state.
Make a comparison that answers your question.
Use the same input encoding, reward definition and training budget for each condition. Replace anatomical with frozen to disable updates, rewired to preserve both endpoint degrees while changing partners, or random to preserve each cell's input degree while replacing partners. The linear condition reads the same observations directly.
Keep evaluation examples separate. A good score on data used to adjust the parameters is not an estimate of performance on unseen observations. The supplied digit experiment uses the published training and test partitions unchanged.
Inspect and reuse the released experiment.
The model source and selected circuit data are available directly. The synthetic task results and handwriting results summarize the 540 runs in these two original studies. The reproduction ZIP contains the complete run records, frozen protocols, runnable examples and software checks.
Cite the research paper when you reuse its software, protocol or results. Keep the dataset attribution included in the bundle.
Download BibTeX Download RIS Download CFF
What the interface does not promise
The model has two actions and no recurrent memory. It is an engineered rate circuit. It does not reproduce the biophysics of an intact fly, and changing the reward does not supply missing sensory information or guarantee that a task is learnable.
Download runnable examples and the experiment source · Read the paper