reservoirpy.compat.regression_models.RidgeRegression#

class reservoirpy.compat.regression_models.RidgeRegression(ridge=0.0, workers=-1, dtype=<class 'numpy.float64'>)[source]#

Ridge regression model for reservoir output weights learning.

\[W_{out} = YX^{T} \cdot (XX^{T} + \mathrm{_ridge} \times \mathrm{Id}_{_dim_in})\]

where \(W_out\) is the readout matrix learnt through this regression, \(X\) are the internal states, \(Y\) are the targets vectors, and \(_dim_in\) is the internal state dimension (number of units in the reservoir).

By default, ridge coefficient is set to \(0\), which is equivalent to a simple analytic resolution using pseudo-inverse.

Partial fit method allows to concurrently pre-compute \(XX^{T]\) and \(YX^{T}\) when several independent state sequences are provided, for performance, as suggested by [1].

Methods

__init__([ridge, workers, dtype])

clean()

Clean all internal parameters of the model.

fit([X, Y])

Fit states X to targets values Y following the model learning rule.

initialize([dim_in, dim_out])

Initialize the model internal parameters.

partial_fit(X, Y)

Partially fit the states X to the targets values Y.

Attributes

dim_in

Input dimension of the model (i.e. internal states dimension).

dim_out

Output dimension of the model.

initialized

A boolean indicating wether the internal parameters of the model are initialized or not.

ridge

Regularization coefficient of the model.

Wout

clean()[source]#

Clean all internal parameters of the model.

property dim_in#

Input dimension of the model (i.e. internal states dimension).

property dim_out#

Output dimension of the model.

fit(X=None, Y=None)[source]#

Fit states X to targets values Y following the model learning rule.

Parameters:
Returns:

A readout matrix of shape (targets dimension, states dimension + bias (=1)).

Return type:

numpy.ndarray

initialize(dim_in=None, dim_out=None)[source]#

Initialize the model internal parameters.

Parameters:
  • dim_in (int) – States dimension.

  • dim_out (int) – Targets dimension.

property initialized#

A boolean indicating wether the internal parameters of the model are initialized or not.

partial_fit(X, Y)[source]#

Partially fit the states X to the targets values Y. This method can be used to pre-compute some steps of the final fitting method.

Parameters:
property ridge#

Regularization coefficient of the model.