Skip to contentSkip to Content
DocsAPI ReferenceConfiguration

spires_reservoir_config

Struct that fully describes a reservoir before it is created. Passed by pointer to spires_reservoir_create.


Definition

typedef struct { size_t num_neurons; size_t num_inputs; size_t num_outputs; double spectral_radius; double ei_ratio; double input_strength; double connectivity; double dt; spires_connectivity_type connectivity_type; spires_neuron_type neuron_type; double *neuron_params; } spires_reservoir_config;

Fields

FieldTypeDescriptionTypical Values
num_neuronssize_tNumber of neurons in the reservoir. Determines the dimensionality of the internal state vector.100 — 5000
num_inputssize_tNumber of input channels. Each call to spires_step expects a vector of this length.1 — 128
num_outputssize_tNumber of output channels. Determines the width of the readout weight matrix W_out.1 — 64
spectral_radiusdoubleDesired spectral radius of the internal weight matrix. Controls the echo state property: values below 1.0 ensure fading memory, values near 1.0 maximize memory capacity.0.1 — 1.5 (commonly 0.9)
ei_ratiodoubleFraction of neurons designated as excitatory, in the range [0, 1]. The remainder are inhibitory. A value of 0.8 means 80% excitatory, 20% inhibitory.0.5 — 1.0 (commonly 0.8)
input_strengthdoubleScaling factor applied to the input weight matrix W_in. Larger values amplify the influence of external input relative to recurrent dynamics.0.01 — 5.0 (commonly 1.0)
connectivitydoubleControls how densely the reservoir is connected. For SPIRES_CONN_RANDOM, this is the probability that any two neurons are connected (range [0, 1]). For other topologies, its interpretation varies (see Enums).0.01 — 0.5 (commonly 0.1)
dtdoubleIntegration timestep in seconds. Used by biophysical and fractional neuron models. Ignored by SPIRES_NEURON_LIF_DISCRETE.0.0001 — 0.01
connectivity_typespires_connectivity_typeNetwork topology algorithm. See spires_connectivity_type.SPIRES_CONN_RANDOM
neuron_typespires_neuron_typeSpiking neuron model. See spires_neuron_type.SPIRES_NEURON_LIF_DISCRETE
neuron_paramsdouble *Pointer to a model-specific parameter array. May be NULL for models that require no extra parameters (e.g., LIF_DISCRETE). For fractional models, the first element is the fractional order alpha. The library reads from this pointer during creation but does not take ownership.See notes below

neuron_params Layout

The contents of the neuron_params array depend on neuron_type:

Neuron TypeRequired ElementsLayout
SPIRES_NEURON_LIF_DISCRETE0NULL or ignored.
SPIRES_NEURON_LIF_BIO4[tau_m, V_rest, V_thresh, V_reset] — membrane time constant (s), resting potential (V), threshold (V), reset potential (V).
SPIRES_NEURON_FLIF_CAPUTO1+[alpha, ...] — fractional order in (0, 1]. Additional elements are model-specific.
SPIRES_NEURON_FLIF_GL1+[alpha, ...] — fractional order in (0, 1].
SPIRES_NEURON_FLIF_DIFFUSIVE1+[alpha, ...] — fractional order in (0, 1].

Example

double frac_params[] = { 0.7 }; /* fractional order alpha = 0.7 */ spires_reservoir_config cfg = { .num_neurons = 500, .num_inputs = 3, .num_outputs = 1, .spectral_radius = 0.95, .ei_ratio = 0.8, .input_strength = 1.0, .connectivity = 0.1, .dt = 0.001, .connectivity_type = SPIRES_CONN_SMALL_WORLD, .neuron_type = SPIRES_NEURON_FLIF_GL, .neuron_params = frac_params };

Notes

  • The config struct is read-only from the library’s perspective. spires_reservoir_create copies all necessary data out of the struct and the neuron_params array. After creation, the caller may freely modify or deallocate the config and its neuron_params.
  • Zero-initializing the struct (e.g., memset(&cfg, 0, sizeof(cfg))) is not sufficient for a valid configuration because num_neurons, num_inputs, and num_outputs must all be non-zero.
  • The spectral_radius field may be set to 0 to skip spectral rescaling of the internal weight matrix. This is useful when providing a custom pre-scaled matrix through advanced APIs.

See Also

Last updated on