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
| Field | Type | Description | Typical Values |
|---|---|---|---|
num_neurons | size_t | Number of neurons in the reservoir. Determines the dimensionality of the internal state vector. | 100 — 5000 |
num_inputs | size_t | Number of input channels. Each call to spires_step expects a vector of this length. | 1 — 128 |
num_outputs | size_t | Number of output channels. Determines the width of the readout weight matrix W_out. | 1 — 64 |
spectral_radius | double | Desired 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_ratio | double | Fraction 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_strength | double | Scaling 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) |
connectivity | double | Controls 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) |
dt | double | Integration timestep in seconds. Used by biophysical and fractional neuron models. Ignored by SPIRES_NEURON_LIF_DISCRETE. | 0.0001 — 0.01 |
connectivity_type | spires_connectivity_type | Network topology algorithm. See spires_connectivity_type. | SPIRES_CONN_RANDOM |
neuron_type | spires_neuron_type | Spiking neuron model. See spires_neuron_type. | SPIRES_NEURON_LIF_DISCRETE |
neuron_params | double * | 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 Type | Required Elements | Layout |
|---|---|---|
SPIRES_NEURON_LIF_DISCRETE | 0 | NULL or ignored. |
SPIRES_NEURON_LIF_BIO | 4 | [tau_m, V_rest, V_thresh, V_reset] — membrane time constant (s), resting potential (V), threshold (V), reset potential (V). |
SPIRES_NEURON_FLIF_CAPUTO | 1+ | [alpha, ...] — fractional order in (0, 1]. Additional elements are model-specific. |
SPIRES_NEURON_FLIF_GL | 1+ | [alpha, ...] — fractional order in (0, 1]. |
SPIRES_NEURON_FLIF_DIFFUSIVE | 1+ | [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_createcopies all necessary data out of the struct and theneuron_paramsarray. After creation, the caller may freely modify or deallocate the config and itsneuron_params. - Zero-initializing the struct (e.g.,
memset(&cfg, 0, sizeof(cfg))) is not sufficient for a valid configuration becausenum_neurons,num_inputs, andnum_outputsmust all be non-zero. - The
spectral_radiusfield 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
- spires_reservoir_create — consumes this struct.
- Enums —
spires_connectivity_typeandspires_neuron_type. - Status Codes — error codes returned when validation fails.
Last updated on