Train

ReservoirComputing.train — Function
train(rc, train_data, target_data, ps, st;
      objective=RidgeRegression(0.0), solver=nothing,
      washout=0, return_states=false)

Train the readout of a reservoir computer.

Builds features from train_data, fits them to target_data with objective, and returns new parameters and states (inputs ps / st are not mutated).

Arguments

  • rc: model with a trainable readout (e.g. ESN, ReservoirChain).
  • train_data: inputs; columns are time steps.
  • target_data: targets aligned with train_data.
  • ps: model parameters.
  • st: model states.

Keyword arguments

  • objective: what to fit. Default RidgeRegression.
  • solver: how to solve when needed. For ridge, nothing uses QRFactorization() from LinearSolve.jl, which ReservoirComputing reexports. If that factorization fails because the features are rank deficient, a pivoted QR returns the minimum-norm solution instead for Float32 and Float64; other element types need reg > 0 in that case.
  • washout: initial time steps to drop from features and targets. Default 0.
  • return_states: if true, also return the feature matrix used for the fit.
  • kwargs...: passed to the objective's backend when applicable.

Returns

  • (ps, st), or ((ps, st), states) if return_states=true.

Throws

  • ArgumentError: if washout is negative or not smaller than the number of time steps.
source
train(objective, states, target_data; solver=nothing, kwargs...)
Deprecated

The objective-level entry point is deprecated. Use the model-level train(rc, train_data, target_data, ps, st; objective=..., solver=...) API instead.

source
ReservoirComputing.train! — Function
train!(rc, train_data, target_data, ps, st,
       train_method=RidgeRegression(0.0);
       washout=0, return_states=false, kwargs...)
Deprecated

Use train instead. The positional train_method argument maps to the objective keyword of train.

source
train!(rng, concept::Conceptor, named_signals, named_targets, ps, st,
       train_method=RidgeRegression(0.0);
       washout=0, return_states=false, init_carry=nothing) -> (ps, st)

Train a single readout on conceptor-filtered reservoir features. For each name => signal the states are collected through the conceptor named name (stored beforehand via store_conceptors), the first washout columns are dropped, and features and the matching named_targets are pooled across patterns before the readout is fit with train_method. With return_states=true the pooled feature matrix is also returned.

Arguments

  • named_signals: Iterable of named input sequences. A vector is read as a single input channel.
  • named_targets: Iterable containing one target sequence for every signal name.
  • train_method: Readout fitting method; defaults to unregularized RidgeRegression.

Keywords

  • washout::Int = 0: Initial columns removed from every feature and target. Must be non-negative.
  • return_states::Bool = false: Return pooled conceptor-filtered features.
  • init_carry = nothing: Initial carry passed when resetting each sequence.
  • kwargs...: Additional options for the readout fit, such as solver.

Returns

  • (parameters, states) by default.
  • ((parameters, states), features) when return_states = true.
source
ReservoirComputing.QRSolver — Type
QRSolver()

Legacy built-in QR solver for RidgeRegression.

Solves the ridge system with a column-pivoted QR factorization, so rank-deficient Float32 or Float64 features (for example with reg = 0) give the minimum-norm least-squares solution; other element types need reg > 0 in that case. Prefer QRFactorization() (LinearSolve's QR algorithm, available from using ReservoirComputing) unless you need this path explicitly.

source
ReservoirComputing.RidgeRegression — Type
RidgeRegression([Type], [reg])

Ridge regression objective for readout training.

Fits weights $\mathbf{W}$ so that $\mathbf{Y} \approx \mathbf{W}\mathbf{X}$ with Tikhonov regularization $\lambda$:

\[\mathbf{W}^{\top} = (\mathbf{X}\mathbf{X}^{\top} + \lambda \mathbf{I})^{-1} \mathbf{X}\mathbf{Y}^{\top}\]

Arguments

  • Type: element type of $\lambda$ (optional).
  • reg: regularization $\lambda$. Default 0.0 (ordinary least squares).

Feature and target layouts are (n_features, T) and (n_outputs, T); the fitted weight matrix is (n_outputs, n_features).

source

Ridge solvers

For ridge regression, solver = nothing selects QRFactorization(), the QR algorithm of LinearSolve.jl. ReservoirComputing reexports it (see Reexported API), so it is available after using ReservoirComputing, and it is the same binding that LinearSolve exports. Other LinearSolve algorithms, such as SVDFactorization(), require using LinearSolve. QRSolver is the legacy built-in alternative.