Skip to main content

A reservoir computer and chaotic systems package

Project description

Reservoir Computers and Chaotic Systems

This package contains an ode based reservoir computer for learning time series data. The package also includes functions for generating and plotting time series data for three chaotic systems.

Installation

The package is hosted on PyPi and can be installed with pip:

pip install rescomp

Alternatively, users can download the repository and add the location of the repo to their Python path.

Import the package with import rescomp as rc

Chaotic Systems

Currently, we support code to generate time series on three chaotic attractors. Time series can be generated with the orbit function and plotted in 3D with plot3d or in 2D with plot2d. (Plots are displayed in a random color so call the plot function again or supply color(s) to the keyword argument if it looks bad.)

  1. Thomas' cyclically symmetric attractor
t, U = rc.orbit("thomas", duration=1000, dt=0.1)
fig = rc.plot3d(U)

Thomas' cyclically symmetric attractor

  1. The Rossler attractor
t, U = rc.orbit("rossler", duration=100, dt=0.01)
fig = rc.plot3d(U)

Rossler attractor

  1. The Lorenz attractor
t, U = rc.orbit("lorenz", duration=100, dt=0.01)
fig = rc.plot3d(U)

Lorenz attractor

Reservoir Computer Class

The package contains two options for reservoir computers: ResComp and DrivenResComp. The driven reservoir computers are still in beta stage but can be used for designing control algorithms [1]. Here is an example of learning and predicting Thomas' cyclically symetric attractor:

Train and Test

The train_test_orbit function returns training and testing sequences on the attractor. The test sequence immidiately follows the training sequence.

tr, Utr, ts, Uts = rc.train_test_orbit("thomas", duration=1000, dt=0.1)

Initialize the default reservoir computer and train on the test data with:

rcomp_default = rc.ResComp()
rcomp_default.train(tr, Utr)

Take the final state of the reservoir nodes and allow it to continue to evolve to predict what happens next.

r0 = rcomp_default.r0
pre = rcomp_default.predict(ts, r0=r0)
fig = rc.plot3d(pre)

Prediction with default parameters. (Not so good)

This doesn't look much like Thomas' attractor, suggesting that these parameters are not optimal.

Reservoir Hyperparameters

Optimized hyper parameters for each system are included in the package. Initialize a reservoir with optimized hyper parameters as follows:

hyper_parameters = rc.SYSTEMS["thomas"]["rcomp_params"]
rcomp = rc.ResComp(**hyper_parameters)

Train and predict as before.

rcomp.train(tr, Utr)
r0 = rcomp.r0
pre = rcomp.predict(ts, r0=r0)
fig = rc.plot3d(pre)

Prediction with optimized parameters. (Good!)

This prediction looks much more like Thomas' attractor.

Conclusion

Most high level functions are well documented in the source code and should describe the variables clearly. Good luck!

[1] Griffith, A., Pomerance, A., Gauthier, D.. Forecasting Chaotic Systems with Very Low Connectivity Reservoir Computers (2019)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rescomp-0.1.1.tar.gz (322.1 kB view details)

Uploaded Source

Built Distribution

rescomp-0.1.1-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file rescomp-0.1.1.tar.gz.

File metadata

  • Download URL: rescomp-0.1.1.tar.gz
  • Upload date:
  • Size: 322.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.6.0.post20201009 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.4

File hashes

Hashes for rescomp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 007ddf8ab1e1e94a511e8e2d28672d4193e058da087bf339cf733d1cf93f2249
MD5 27383972207d11c5c68149796fb1fee6
BLAKE2b-256 595b2a94b16518b1919bb7cd68dbf72dbd86504a0069d6093f041e95e4ef0b4c

See more details on using hashes here.

File details

Details for the file rescomp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: rescomp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.6.0.post20201009 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.4

File hashes

Hashes for rescomp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6282f4cbc1c4054f5a96c5d48428c03647b6424502754e740e1df9e75471f37b
MD5 c4863882e7a6a7de3e919e03d1d1a0b2
BLAKE2b-256 149e1b9f59ebc257258aa2292874966df1762097830539172ef33114ae24ef97

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page