Models (reservoirpy.Model)#

Note

See the following guides to:

Models are an extension of the Node API. They allow to combine nodes into complex computational graphs, to create complicated Reservoir Computing architecture like Deep Echo State Networks.

See From Nodes to Models to learn more about how to create and manipulate a Model.

class reservoirpy.model.Model(
nodes: Sequence[Node],
edges: Sequence[tuple[Node, int, Node]],
)[source]#

Model base class.

Parameters:
  • nodes (list of Node, optional) – Nodes to include in the Model.

  • edges (list of (Node, Node), optional) – Edges between Nodes in the graph. An edge between a Node A and a Node B is created as a tuple (A, B).

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

nodes

edges

inputs

outputs

named_nodes

trainable_nodes

execution_order

parents

children

is_trainable

is_multi_input

is_multi_output

is_parallel

initialized

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).