Utilities

Various utility functions for RC and the ESN classes generally

Functions:

read_pickle(path[, compression])

Load pickled (esn) object from file.

train_and_predict_input_setup(data[, ...])

Splits ESN input data for consecutive training and prediction

rescomp.utilities.read_pickle(path, compression='infer')

Load pickled (esn) object from file.

Uses pandas functions internally.

Parameters
  • path (str) – File path where the pickled object will be loaded.

  • compression ({'infer', 'gzip', 'bz2', 'zip', 'xz', None}) – default ‘infer’ For on-the-fly decompression of on-disk data. If ‘infer’, then use gzip, bz2, xz or zip if path ends in ‘.gz’, ‘.bz2’, ‘.xz’, or ‘.zip’ respectively, and no decompression otherwise. Set to None for no decompression.

Returns

same type as object stored in file

Return type

unpickled

rescomp.utilities.train_and_predict_input_setup(data, disc_steps=0, train_sync_steps=0, train_steps=None, pred_sync_steps=0, pred_steps=None)

Splits ESN input data for consecutive training and prediction

This function is useful because there is an unintuitive overlap between x_train and x_pred of 1 time step which makes it easy to make mistakes

Parameters
  • data (np.ndarray) – data to be split/setup

  • disc_steps (int) – steps to discard completely before training begins

  • train_sync_steps (int) – steps to sync the reservoir with before training

  • train_steps (int) – steps to use for training and fitting w_in

  • pred_sync_steps (int) – steps to sync the reservoir with before prediction

  • pred_steps (int) – how many steps to predict the evolution for

Returns

2-element tuple containing:

  • x_train (np.ndarray): input data for the training

  • x_pred (np.ndarray): input data for the prediction

Return type

tuple