Echo State Network reservoirpy.ESN#
- class reservoirpy.ESN(
- reservoir: Reservoir | None = None,
- readout: Ridge | None = None,
- feedback=False,
- input_to_readout=False,
- **kwargs,
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
Wmatrix shape.reservoir (Node, optional) – A Node instance to use as a reservoir, such as a
Reservoirnode.readout (Node, optional) – A Node instance to use as a readout, such as a
Ridgenode (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,RidgeExample
>>> from reservoirpy import ESN >>> >>> model = ESN(units=100, sr=0.9, ridge=1e-6) >>>
Methods
initialize(x[, y])Initializes a
Modelinstance at runtime, using samples of data to infer allNodedimensions.step([x])run([x, iters, workers])predict([x, iters])fit(x[, y, warmup, workers])partial_fit(x[, y])Attributes
A
Ridgeinstance.Is readout connected to reservoir through feedback (False by default).
Does the readout directly receives the input (False by default).
Input node, if
input_to_readoutis set to Truenodesedgesinputsoutputsnamed_nodestrainable_nodesexecution_orderparentschildrenis_trainableis_multi_inputis_multi_outputis_parallelinitialized- 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,
Initializes a
Modelinstance at runtime, using samples of data to infer allNodedimensions.- 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).
- readout: TrainableNode#
A
Ridgeinstance.