LazyESN

Contents

LazyESN#

class xesn.LazyESN(esn_chunks, overlap, boundary, n_reservoir, leak_rate, tikhonov_parameter, persist=False, input_kwargs=None, adjacency_kwargs=None, bias_kwargs=None)#

A distributed/parallelized ESN network based on the multi-dimensional generalization of the algorithm introduced by Pathak et al. [2018], as used in Smith et al. [2023].

Assumptions

  1. For all data provided to ESN methods, time axis is last and it is named “time”

  2. Non-global axes, i.e., axes which is chunked up or made up of patches, are first

  3. Can handle multi-dimensional data, but only 2D chunking

Note

The difference between what is expected for overlap and boundary and what is supplied to dask’s overlap function is that here the dimensions are labelled. This means we expect something like {"x": 1, "y":1, "time": 0} rather than {0: 1, 1:1, 2:0}, for overlap and similar for boundary.

Parameters:
  • esn_chunks (dict) – mapping the input data dimension names to its chunksize

  • overlap (dict) – mapping the input data dimension names to the number of neighboring points in each dimension to include in each local input vector

  • boundary (dict, str, or float) – indicate how to handle the domain boundaries during overlap. Available options are "periodic", "reflect", or value where value is a value to be filled into the domain, which could be np.nan for hard boundaries.

  • n_reservoir (int) – size of the reservoir or hidden state for each local network

  • leak_rate (float) – fraction of current hidden state to use during timestepping, (1-leak_rate) r(n-1) is propagated forward

  • tikhonov_parameter (float) – regularization parameter to prevent overfitting

  • persist (bool, optional) – if True, bring the data into memory using all available computational resources. This is called after calling overlap in train() and predict(), as well as on the readout weights Wout after training and on the prediction result after computations are complete in predict()

  • input_kwargs (dict, optional) – the options to specify Win, use boolean option "is_sparse" to determine if RandomMatrix or SparseRandomMatrix is used, then all other options are passed to either of those classes, see their description for available options noting that n_rows and n_cols are not necessary.

  • adjacency_kwargs (dict, optional) – the options to specify W, use boolean option "is_sparse" to determine if RandomMatrix or SparseRandomMatrix is used, then all other options are passed to either of those classes, see their description for available options noting that n_rows and n_cols are not necessary.

  • bias_kwargs (dict, optional) – the options to specifying bias_vector generation. Only "distribution", "factor", and "random_seed" options are allowed.

Methods

LazyESN.build()

Generate the random adjacency and input weight matrices with sparsity determined by sparsity attribute, scaled by spectral_radius and sigma parameters, respectively.

LazyESN.predict(y, n_steps, n_spinup)

Use the ESN to make a prediction

LazyESN.test(y, n_steps, n_spinup)

Make a prediction to be compared to a truth.

LazyESN.to_xds()

Return object as xarray.Dataset

LazyESN.train(y[, n_spinup, batch_size])

Learn the readout matrix weights through ridge regression.

Attributes

LazyESN.esn_chunks

LazyESN.overlap

LazyESN.persist

LazyESN.boundary

LazyESN.W

LazyESN.Win

LazyESN.Wout

LazyESN.adjacency_factor

LazyESN.adjacency_kwargs

LazyESN.bias_factor

LazyESN.bias_kwargs

LazyESN.bias_vector

LazyESN.input_chunks

LazyESN.input_factor

LazyESN.input_kwargs

LazyESN.leak_rate

LazyESN.n_input

LazyESN.n_output

LazyESN.n_reservoir

LazyESN.ndim_state

Num.

LazyESN.output_chunks

LazyESN.tikhonov_parameter