Computer Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

Recursive networks and echo state networks

Recursive networks (general recurrent networks viewed as graph-structured recursion) and Echo State Networks (ESNs, a reservoir computing method) provide efficient ways to model temporal sequences; ESNs separate a fixed high-dimensional recurrent reservoir from a trainable linear readout, yielding f

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Recursive networks and Echo State Networks (ESNs) are used when an engineer needs models that remember past inputs (temporal dependencies) but wants fast, stable training. ESNs are particularly useful in signal processing, control systems, time-series forecasting and embedded applications because only the readout is trained (usually linear), giving low training cost and simple deployment.

Key ideas

Start from first principles. We study two related concepts: recursive networks as a general view of recurrent computation on graphs, and Echo State Networks as a practical reservoir-computing architecture.

  • Recursive network (general) — a model in which the same function (with shared parameters) is applied repeatedly over a structure (sequence, tree or graph) so that the value at each node depends on values at neighbours or children. Assumption: the underlying graph and application order are well-defined so recursion terminates or reaches a stationary state.

  • Recurrent state — at time t, the network maintains a vector called the hidden state (or reservoir state in ESN) denoted x(t). The hidden state summarizes past inputs relevant for future outputs.

  • State update equation — the hidden state is updated by a function of previous state and input. In many models this is affine followed by a nonlinearity. For ESNs: the reservoir update is typically a leaky integrator with fixed internal weights.

  • Echo State Property (ESP) — an exact, standard definition used in ESN theory: a dynamical system (the reservoir) has the Echo State Property if, for any bounded input sequence, the reservoir state asymptotically depends only on the input history and not on the initial state. Assumption: inputs are bounded; reservoir is driven (no unbounded self-excitation).

  • Spectral radius condition (sufficient but not necessary) — for a reservoir with update x(t+1)=f(W x(t)+W_in u(t+1)), a common sufficient condition for ESP is that the spectral radius (largest absolute eigenvalue) of the reservoir weight matrix W is strictly less than 1 when f is the identity and no leaky integration. For nonlinear f this condition is conservative but widely used in practice. Universities often ask derivations showing contraction under operator norm assumptions. With leaky integration and linear f, a sufficient linear stability condition is ρ((1 - α)I + α W) < 1.

  • Reservoir computing idea — fix a large, randomly connected recurrent network (the reservoir). Only train a simple readout (often linear) from reservoir states to outputs. Assumption: random reservoir projects input history into a high-dimensional space where linear readout can solve the task.

  • Readout training — typically solved as a regularised linear regression (ridge regression). With collected reservoir states X (each column or row a state) and target outputs Y, the readout weights W_out are found by minimizing square error plus L2 penalty. This has a closed-form solution.

  • Stability and memory — reservoir size N, spectral radius ρ(W), input scaling, sparsity and leaking rate control the short-term memory and nonlinearity balance. Larger ρ close to 1 tends to increase memory but can approach instability; input scaling controls how strongly current input drives state versus past.

  • Diagram to draw (for exam): draw three parts left-to-right: inputs u(t) -> reservoir (draw N small circles arranged in a random graph; label internal weights W on edges and input weights W_in from inputs to nodes) -> readout (linear combiner) producing y(t). Label reservoir state vector x(t), show arrows from u to reservoir and reservoir to readout. Also draw a small box showing training: collect X and Y, compute W_out via ridge regression.

Derivation universities often ask for: show closed-form ridge solution and show why an induced operator norm condition ||W|| < 1 yields a contraction for the linear reservoir; note that ρ(W) < 1 is sufficient for ESP/asymptotic stability but does not imply per-step contraction in a fixed norm. Steps:

  1. For linear reservoir x(t+1)=W x(t)+W_in u(t+1). Consider two states x and x'. Subtract, get x(t+1)-x'(t+1)=W(x(t)-x'(t)). If operator norm ||W||<1 then difference shrinks each step -> contraction -> unique asymptotic dependence on input sequence.
  2. For readout training: minimize ||Y - W_out X||_F^2 + λ||W_out||_F^2. Set gradient to zero and solve to obtain closed form (details in Worked examples).

Assumptions to state when using these results: inputs are bounded sequences; reservoir is time-invariant; reservoir matrix has properties assumed (spectral radius or norm); readout is linear and targets are compatible dimensionally. In practice, discard an initial washout period before collecting states X and targets Y to eliminate dependence on the unknown initial state x(0).

Formulas

x(t+1) = (1 - α)x(t) + α f(W x(t) + W_in u(t+1) + b) — state update for a leaky ESN; x(t) ∈ R^N, dimensionless; applies when using leaky integrator neurons; α ∈ (0,1] is leaking rate (dimensionless); f is elementwise nonlinearity; W_in ∈ R^{N×K} and b ∈ R^N.

y(t) = W_out [x(t); u(t); 1] — output equation with optional direct input and bias; y(t) ∈ R^M, dimensionless; W_out ∈ R^{M×(N+K+1)} where K=input dim.

ρ(W) = max_i |λ_i(W)| — spectral radius; dimensionless; applies to square reservoir matrix W.

W_out = Y X^T (X X^T + λ I)^{-1} — ridge regression closed-form (assuming state matrix X with states as columns); W_out dimensionality and λ ≥ 0 (regularisation parameter), units dimensionless; applies when minimizing ||Y - W_out X||_F^2 + λ||W_out||_F^2. Here I ∈ R^{N×N}.

MSE = (1/T) ∑_{t=1}^T ||y(t) - y_target(t)||^2 — mean squared error over T time steps; units are squared units of target.

x(t+1)-x'(t+1) = W (x(t)-x'(t)) — difference equation used to show contraction for linear reservoir.

Worked examples

Example 1 — numerical one-step ESN state and output (universal exam-style small numeric matrix): Problem: N=3 reservoir, input dimension K=1. Let W = [[0,0.5,0],[0,0,0.4],[0.2,0,0]] (rows), W_in = [0.1, 0.2, 0.0]^T, bias b=0, f = tanh, α=1 (no leak). Given x(0) = [0,0,0]^T and u(1)=1. Compute x(1) and y(1) with readout W_out = [1, -1, 0.5] (row) and no direct input or bias. Step 1: compute linear argument a = W x(0) + W_in u(1) + b = W*[0;0;0] + [0.1;0.2;0]1 = [0.1;0.2;0]. Step 2: apply tanh elementwise (tanh small values ≈ value): x(1) = tanh(a) ≈ [0.0997; 0.1974; 0.0] (use tanh(0.1)=0.099667, tanh(0.2)=0.197375). Step 3: output y(1) = W_out · x(1) = [1, -1, 0.5] · [0.099667;0.197375;0] = 10.099667 -10.197375 +0.50 = -0.097708. Final answer: x(1) ≈ [0.099667, 0.197375, 0]^T, y(1) ≈ -0.097708. (Units: dimensionless.)

Example 2 — derivation/model answer (exam long question): Show closed-form solution for ridge readout and explain training steps. Model answer (step-by-step):

  1. Collect reservoir states while driving the ESN by training input sequence u(t) for t=1..T. Form matrix X = [x(1) x(2) ... x(T)] ∈ R^{N×T}. Collect target outputs Y = [y_target(1) ... y_target(T)] ∈ R^{M×T}.
  2. Define objective J(W_out) = ||Y - W_out X||_F^2 + λ ||W_out||_F^2 where ||·||_F is Frobenius norm and λ ≥ 0.
  3. Differentiate w.r.t. W_out and set gradient zero: -2 (Y - W_out X) X^T + 2 λ W_out = 0.
  4. Rearranged: W_out (X X^T + λ I) = Y X^T.
  5. Solve for W_out: W_out = Y X^T (X X^T + λ I)^{-1}.
  6. Implementation notes: if T >> N, computing (X X^T + λ I) ∈ R^{N×N} is efficient; if N large, prefer SVD or iterative solvers. Use regularisation λ chosen by cross-validation. This answer shows the complete derivation and practical considerations expected for full marks.

Common mistakes

  • Using the reservoir states matrix X with wrong orientation (rows vs columns) when applying the ridge formula; check shapes.
  • Not centring or normalising inputs when required; input scaling dramatically changes behaviour.
  • Thinking ESP is guaranteed by ρ(W) < 1 in all nonlinear reservoirs — this is only a conservative sufficient condition.

For your exam

Types of questions:

  • Definitions: define Echo State Property, reservoir, spectral radius, leaking rate.
  • Short notes: explain reservoir computing advantages and limitations; list hyperparameters of ESN and their roles.
  • Derivations: show contraction for linear reservoir under ||W||<1; derive ridge readout closed-form.
  • Numericals: compute one-step state and output for small matrices (like Example 1) or compute W_out from small X and Y.
  • Diagrams: draw architectural sketch of ESN and label W, W_in, W_out, x(t), u(t), y(t). What full-marks answers include:
  • Precise definitions with assumptions (bounded inputs, stationarity where needed).
  • Clear derivation steps (algebraic steps for ridge, contraction proof), correct matrix shapes and units, and concluding statement.
  • For numeric problems: intermediate arithmetic, units (dimensionless), and final answer in bold.

Quick check

  1. What is the Echo State Property in one sentence?
  2. Give the reservoir update equation for a leaky ESN.
  3. Write the ridge regression closed-form used to compute W_out from X and Y. Answers: 1) The reservoir asymptotically depends only on past inputs and not on initial state (for bounded inputs). 2) x(t+1) = (1-α)x(t) + α f(W x(t) + W_in u(t+1) + b). 3) W_out = Y X^T (X X^T + λ I)^{-1}.

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?