Skip to content

Getting Started

Raul Montoya Cardenas edited this page Aug 8, 2026 · 5 revisions

Getting Started

Wiki hero

Generated with Grok Build: Grok 4.5 · xAI Imagine (/imagine)

Install

Requires Rust 1.97.1+ (MSRV).

[dependencies]
neuromod = "0.5.1"
# optional: neuromod = { version = "0.5.1", features = ["sentry"] }
cargo test
cargo test --all-features
cargo run --example basic
cargo run --example rstdp_demo
cargo run --example basic_lif
cargo run --example hebbian_learning
# optional:
# SENTRY_DSN=... SENTRY_ENVIRONMENT=development cargo run --example sentry --features sentry

Default network

SpikingNetwork integrates LIF + Izhikevich only (default: 16 LIF, 5 Izh, 16 channels).

use neuromod::{NeuroModulators, SpikingNetwork};

let mut network = SpikingNetwork::new(); // 16 LIF, 5 Izhikevich, 16 channels
let stimuli = [0.5_f32; 16];
let modulators = NeuroModulators::default();
let spikes = network.step(&stimuli, &modulators).unwrap(); // indices that fired

Dynamic dimensions

use neuromod::{NeuroModulators, SpikingNetwork};

let mut network = SpikingNetwork::with_dimensions(518, 5, 518);
let stimuli = vec![0.25_f32; 518];
let spikes = network.step(&stimuli, &NeuroModulators::default()).unwrap();

Shape validation

step requires stimuli.len() == num_channels or returns StepError::InputLenMismatch { expected, got }.

Neuromodulators (0.5.0+ API)

use neuromod::{
    apply_neuromodulation, GenericReward, NeuroModulators, Observation, SignalProfile, UnitReward,
};

let profile = SignalProfile::default();
let mut mods = NeuroModulators::from_signals(&profile, 0.2, 0.1, 0.8, 0.9);
mods.add_reward(0.2);
mods.add_norepinephrine(0.1); // renamed from add_stress in 0.5.0
mods.boost_focus(0.3);
mods.add_serotonin(0.4);
mods.decay();

let reward = UnitReward;
let obs = Observation::from_slice(&[0.5, 0.7]);
mods.apply_reward(&reward, &obs);

let mut weights = vec![1.0, 0.8];
let mut thresholds = vec![0.20, 0.25];
apply_neuromodulation(&mods, &mut weights, &mut thresholds);

For legacy hardware-calibrated signal mapping: SignalProfile::hardware_calibrated().

Breaking changes from 0.4

See Release Notes — field removals (cortisol / tempo / aux_dopamine), from_signals + SignalProfile, add_stressadd_norepinephrine.

Next


Last updated: August 8, 2026 Updated by: Grok Build: Grok 4.5 (high) Package tip reference: e59faf1 (main @ 0.5.1 + #91; tag v0.5.1 = 37b0625) Cubic: page-intro Devin DeepWiki: neuromod @ e59faf1

Clone this wiki locally