rescomp

Reservoir computer classes and training algorithms

https://github.com/djpasseyjr/rescomp

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.8%) to scientific vocabulary

Keywords

machine-learning time-series
Last synced: 10 months ago · JSON representation

Repository

Reservoir computer classes and training algorithms

Basic Info
  • Host: GitHub
  • Owner: djpasseyjr
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 44.2 MB
Statistics
  • Stars: 4
  • Watchers: 1
  • Forks: 4
  • Open Issues: 7
  • Releases: 4
Topics
machine-learning time-series
Created over 5 years ago · Last pushed over 2 years ago
Metadata Files
Readme License Citation

README.md

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. It additionally contains a module that implements hyperparameter optimization for reservoir computers via the sherpa package.

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.

Hyperparameter Optimization

The rescomp.optimizer package contains a class, ResCompOptimizer, that allows for easily performing hyperparameter optimization on a ResComp or DrivenResComp object: ``` from rescomp.optimizer import ResCompOptimizer

rcopt = ResCompOptimizer('thomas', 'relax', 'random', 'augmented') rcopt.runoptimization(50, 20) optimizedhyperparams = rcopt.getbestresult() `` Also of note are the methodsgenerateorbits()andruntests(). generateorbits()will generate a given number of orbits from the system as well as the reservoir computer's prediction, which is useful for visual comparisons. runtests()` will test the reservoir computer on continued and random predictions with the given hyperparameters, as well as calculate the derivative fit of its predictions and estimate the Lyapunov exponent of the reservoir dynamical system.

There are four built-in systems: the Lorenz, Thomas, and Rossler chaotic attractors, as described above; and a set of data from a soft robot dynamical system. Other systems can be created by extending the rescomp.optimizer.System class, and can be passed to the optimizer instead of the system string.

There is also a script module, rescomp.opt_then_test, that will run hyperparameter optimization on a ResComp on a given system, run various tests on the optimized hyperparameters, and save the results. The script can be run as follows: python3 -m rescomp.opt_then_test [args] For details on what parameters it accepts, run it as: python3 -m rescomp.opt_then_test -h

References

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

Owner

  • Name: DJ Passey
  • Login: djpasseyjr
  • Kind: user
  • Location: Chapel Hill, NC
  • Company: University of North Carolina at Chapel Hill

Applied Math PhD Student

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: over 3 years ago

All Time
  • Total Commits: 50
  • Total Committers: 2
  • Avg Commits per committer: 25.0
  • Development Distribution Score (DDS): 0.34
Top Committers
Name Email Commits
DJ Passey d****r@g****m 33
lostinnowhere314 q****n@g****m 17

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 8
  • Total pull requests: 12
  • Average time to close issues: 20 minutes
  • Average time to close pull requests: 9 days
  • Total issue authors: 2
  • Total pull request authors: 2
  • Average comments per issue: 0.38
  • Average comments per pull request: 0.17
  • Merged pull requests: 11
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • djpasseyjr (6)
  • lostinnowhere314 (2)
Pull Request Authors
  • lostinnowhere314 (11)
  • whitneyjand (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 14 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 5
  • Total maintainers: 1
pypi.org: rescomp

A reservoir computer and chaotic systems package

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 14 Last month
Rankings
Dependent packages count: 9.8%
Forks count: 15.4%
Dependent repos count: 21.8%
Average: 25.2%
Stargazers count: 27.9%
Downloads: 51.1%
Maintainers (1)
Last synced: 11 months ago

Dependencies

setup.py pypi
  • dill *
  • findiff *
  • ipyparallel *
  • matplotlib *
  • networkx *
  • numdifftools *
  • numpy *
  • parameter-sherpa *
  • scipy *