Echo State Network reservoirpy.ESN#

class reservoirpy.ESN(
reservoir: Reservoir | None = None,
readout: Ridge | None = None,
feedback=False,
input_to_readout=False,
**kwargs,
)[source]#

Simple Echo State Network.

This class is provided as a wrapper for a simple reservoir connected to a readout.

Parameters:
  • units (int, optional) – Number of reservoir units. If None, the number of units will be inferred from the W matrix shape.

  • reservoir (Node, optional) – A Node instance to use as a reservoir, such as a Reservoir node.

  • readout (Node, optional) – A Node instance to use as a readout, such as a Ridge node (only this one is supported).

  • feedback (bool, defaults to False) – If True, the readout is connected to the reservoir through a feedback connection.

  • input_to_readout (bool, defaults to False) – If True, the input is directly fed to the readout. See Input-to-readout connections.

  • **kwargs – Arguments passed to the reservoir and readout.

See also

Reservoir, Ridge

Example

>>> from reservoirpy import ESN
>>>
>>> model = ESN(units=100, sr=0.9, ridge=1e-6)
>>>

Methods

initialize(x[, y])

Initializes a Model instance at runtime, using samples of data to infer all Node dimensions.

step([x])

run([x, iters, workers])

predict([x, iters])

fit(x[, y, warmup, workers])

partial_fit(x[, y])

Attributes

reservoir

A Reservoir or a NVAR instance.

readout

A Ridge instance.

feedback

Is readout connected to reservoir through feedback (False by default).

input_to_readout

Does the readout directly receives the input (False by default).

input_node

Input node, if input_to_readout is set to True

nodes

edges

inputs

outputs

named_nodes

trainable_nodes

execution_order

parents

children

is_trainable

is_multi_input

is_multi_output

is_parallel

initialized

feedback: bool#

Is readout connected to reservoir through feedback (False by default).

initialize(
x: array(t, d) | array(s, t, d) | ~typing.Sequence[array(t, d)] | dict[str, array(t, d) | array(s, t, d) | ~typing.Sequence[array(t, d)]] | array(d) | dict[str, array(d)],
y: array(t, d) | array(s, t, d) | ~typing.Sequence[array(t, d)] | dict[str, array(t, d) | array(s, t, d) | ~typing.Sequence[array(t, d)]] | array(d) | dict[str, array(d)] | None = None,
)[source]#

Initializes a Model instance at runtime, using samples of data to infer all Node dimensions.

Parameters:
  • x (numpy.ndarray or dict of numpy.ndarray) – A vector of shape (1, ndim) corresponding to a timestep of data, or a dictionary mapping node names to vector of shapes (1, ndim of corresponding node).

  • y (numpy.ndarray or dict of numpy.ndarray, optional) – A vector of shape (1, ndim) corresponding to a timestep of target data, or a dictionary mapping node names to vector of shapes (1, ndim of corresponding node).

input_node: Input | None = None#

Input node, if input_to_readout is set to True

input_to_readout: bool#

Does the readout directly receives the input (False by default).

readout: TrainableNode#

A Ridge instance.

reservoir: Node#

A Reservoir or a NVAR instance.