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 withtrain_data.ps: model parameters.st: model states.
Keyword arguments
objective: what to fit. DefaultRidgeRegression.solver: how to solve when needed. For ridge,nothingusesQRFactorization()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 forFloat32andFloat64; other element types needreg > 0in that case.washout: initial time steps to drop from features and targets. Default0.return_states: iftrue, 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)ifreturn_states=true.
Throws
ArgumentError: ifwashoutis negative or not smaller than the number of time steps.
train(objective, states, target_data; solver=nothing, kwargs...)ReservoirComputing.train! — Function
train!(rc, train_data, target_data, ps, st,
train_method=RidgeRegression(0.0);
washout=0, return_states=false, kwargs...)Use train instead. The positional train_method argument maps to the objective keyword of train.
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 unregularizedRidgeRegression.
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 assolver.
Returns
(parameters, states)by default.((parameters, states), features)whenreturn_states = true.
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.
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$. Default0.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).
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.