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
For all data provided to ESN methods, time axis is last and it is named “time”
Non-global axes, i.e., axes which is chunked up or made up of patches, are first
Can handle multi-dimensional data, but only 2D chunking
Note
The difference between what is expected for
overlapandboundaryand 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}, foroverlapand similar forboundary.- 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", orvaluewherevalueis a value to be filled into the domain, which could benp.nanfor 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 forwardtikhonov_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()andpredict(), as well as on the readout weightsWoutafter training and on the prediction result after computations are complete inpredict()input_kwargs (dict, optional) – the options to specify
Win, use boolean option"is_sparse"to determine ifRandomMatrixorSparseRandomMatrixis used, then all other options are passed to either of those classes, see their description for available options noting thatn_rowsandn_colsare not necessary.adjacency_kwargs (dict, optional) – the options to specify
W, use boolean option"is_sparse"to determine ifRandomMatrixorSparseRandomMatrixis used, then all other options are passed to either of those classes, see their description for available options noting thatn_rowsandn_colsare not necessary.bias_kwargs (dict, optional) – the options to specifying
bias_vectorgeneration. Only"distribution","factor", and"random_seed"options are allowed.
Methods
Generate the random adjacency and input weight matrices with sparsity determined by
sparsityattribute, scaled byspectral_radiusandsigmaparameters, 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.
Return object as
xarray.DatasetLazyESN.train(y[, n_spinup, batch_size])Learn the readout matrix weights through ridge regression.
Attributes
LazyESN.esn_chunksLazyESN.overlapLazyESN.persistLazyESN.boundaryLazyESN.WLazyESN.WinLazyESN.WoutLazyESN.adjacency_factorLazyESN.adjacency_kwargsLazyESN.bias_factorLazyESN.bias_kwargsLazyESN.bias_vectorLazyESN.input_chunksLazyESN.input_factorLazyESN.input_kwargsLazyESN.leak_rateLazyESN.n_inputLazyESN.n_outputLazyESN.n_reservoirLazyESN.ndim_stateNum.
LazyESN.output_chunksLazyESN.tikhonov_parameter