{"id":20426327,"url":"https://github.com/nizil/esnpy","last_synced_at":"2026-03-10T11:33:27.927Z","repository":{"id":53809258,"uuid":"73179608","full_name":"NiziL/esnpy","owner":"NiziL","description":"Out-of-the-box framework for Echo State Networks","archived":false,"fork":false,"pushed_at":"2023-06-07T09:56:29.000Z","size":184,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-17T06:47:11.534Z","etag":null,"topics":["echo-state-networks","machine-learning","recurrent-neural-networks","reservoir-computing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NiziL.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-08T11:29:18.000Z","updated_at":"2025-07-16T05:58:48.000Z","dependencies_parsed_at":"2024-11-15T09:19:05.815Z","dependency_job_id":null,"html_url":"https://github.com/NiziL/esnpy","commit_stats":{"total_commits":69,"total_committers":3,"mean_commits":23.0,"dds":0.4057971014492754,"last_synced_commit":"7a20895e8841c8e8f4414a1d7cd5bd754dfb0a4a"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/NiziL/esnpy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NiziL%2Fesnpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NiziL%2Fesnpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NiziL%2Fesnpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NiziL%2Fesnpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NiziL","download_url":"https://codeload.github.com/NiziL/esnpy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NiziL%2Fesnpy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30332332,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T05:25:20.737Z","status":"ssl_error","status_checked_at":"2026-03-10T05:25:17.430Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["echo-state-networks","machine-learning","recurrent-neural-networks","reservoir-computing"],"created_at":"2024-11-15T07:16:14.582Z","updated_at":"2026-03-10T11:33:22.914Z","avatar_url":"https://github.com/NiziL.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# esnpy\n\n`esnpy` is an out-of-the-box framework to experiment around ESN and DeepESN.  \nModels have been implemented in pure NumPy/SciPy, so there is no need for a powerful GPU, or any esoteric requirements. \n\nRight now, the focus is on batch training, and feedback loops have not been taken into account.  \nBut feel free to open a ticket a discuss about anything you need, features you want, or even help !\n\nThe documentation for the latest release is available on [the github page](https://nizil.github.io/esnpy).\n\nNote from the author: *`esnpy` is a small projet I initiated during my master intership, and have recently cleaned up. I might keep working on it for fun, but If you want/need a more robust framework, [ReservoirPy](https://github.com/reservoirpy/reservoirpy) might be the one you're searching for ;)*\n\n## Getting Started\n\n### Installation\n\n**From PyPI**\n```bash\npip install esnpy\n```\n\n**From source**\n```bash\npip install git+https://github.com/NiziL/esnpy#egg=esnpy\n```\nUse `github.com/NiziL/esnpy@\u003ctag or branch\u003e#egg=esnpy` to install from a specific branch or tag instead of main.\n\n### Quickstart\n\n```python\nimport esnpy\n\nreservoir_builder = createBuilder()\ntrainer = createTrainer()\nwarmup, data, target = loadData()\n\n# create the echo state network\nesn = esnpy.ESN(reservoir_builder.build(), trainer)\n# train it\nesn.fit(warmup, data, target)\n# test it\npredictions = esnpy.transform(data)\nprint(f\"error: {compute_err(target, predictions)}\")\n```\n\n#### `ESN` and `DeepESN`\n\nYou can create your ESN with `esnpy.ESN`. \nThe constructor needs a `esnpy.Reservoir` and an implementation of `esnpy.train.Trainer`. \n\n`esnpy.DeepESN` doesn't differ a lot, it just expect a list of `Reservoir` and have an optional parameters `mask` to specify from which reservoirs the `Trainer` should learn. The size of `mask` and `reservoirs` must be the same. \n\nThen, simply call `fit` function by passing some warm up and training data with the related targets.  \nOnce trained, run predictions using `transform`.\n\n#### `Reservoir` and `ReservoirBuilder`\n\nA `Reservoir` can easily be initialized using the `ReservoirBuilder` dataclass.  \nFor convenience, the configuration class is also a builder, exposing a `build()` method.\nThis method has an optional `seed` parameter used to make deterministic initialization, and so to ease the comparaison of two identical reservoirs.\n\n| Parameters    | Type                     | Description                                  | Default   |\n|---------------|--------------------------|----------------------------------------------|-----------|\n| input_size    | `int`                    | Size of input vectors                        |           |\n| size          | `int`                    | Number of units in the reservoir             |           |\n| leaky         | `float`                  | Leaky parameter of the reservoir             |           |\n| fn            | `Callable`               | Activation function of the reservoir         | `np.tanh` |\n| input_bias    | `bool`                   | Enable the usage of a bias in the input      | `True`    |\n| input_init    | `esnpy.init.Initializer` | Define how to initialize the input weights   |           |\n| input_tuners  | `list[esnpy.tune.Tuner]` | Define how to tune the input weights         | `[]`      |\n| intern_init   | `esnpy.init.Initializer` | Define how to intialize the internal weights |           |\n| intern_tuners | `list[esnpy.init.Tuner]` | Define how to tune the internal weights      | `[]`      |\n\n#### `Initializer` and `Tuner` \n\n`esnpy.init.Initializer` and `esnpy.tune.Tuner` are the abstract base classes used to setup the input and internal weights of a reservoir.\n\n`Initializer` is defined by a `init() -\u003e Matrix` function. \n`esnpy` provides implementations of initializer for both uniform and gaussian distribution of weights, and for both dense and sparse matrix.\n\n`Tuner` is defined by a `init(matrix : Matrix) -\u003e Matrix` function, which can be used to modify the weights after initialization.\nFor example, `esnpy` provides a `SpectralRadiusTuner` to change the spectral radius of a weights matrix.\n\n#### `Trainer` and `Reader`\n\n`esnpy.train.Trainer` is responsible to create the output weights matrix from the training data and targets.  \nIt is defined by a `train(inputs: Matrix, data: Matrix, target: Matrix) -\u003e Reader` function.\n\nThe `Reader` is then responsible for computing the final result from the reservoir activations through `__call__`.\n\n`esnpy` provides a `RidgeTrainer` to compute the output weights using a ridge regression, and a `SklearnTrainer` (more on this one later). \nThis trainer has three parameters : one float, the regularization parameter's weight `alpha`, and two optionals boolean (default to true) `use_bias` and `use_input` to control if we should use a bias and the input to compute the readout weights.\n\n`SklearnTrainer` is an adapter wrapping scikit-learn model, relying on methods `fit` and `predict`. The feature is still experimental, chaos might ensure. \n\n## Code Examples \n\nWant to see some code in action ? Take a look at the `examples/` directory:\n- `mackey_glass.py` demonstrates how to learn to predict a time series,\n- `trajectory_classification/` demonstrates how to learn to classify 2D trajectories.\n\n## Bibliography\n\nBased on:\n- *The \"echo state\" approach to analysing and training recurrent neural networks* by Herbert Jaeger ([pdf](https://www.ai.rug.nl/minds/uploads/EchoStatesTechRep.pdf)),\n- *A pratical guide to applying Echo State Networks* by Mantas Lukoševičius ([pdf](https://www.ai.rug.nl/minds/uploads/PracticalESN.pdf)),\n- *Design of deep echo state networks* by Claudio Gallicchio and al ([link](https://www.sciencedirect.com/science/article/pii/S0893608018302223)),\n- *Deep echo state network (DeepESN): A brief survey* by Claudio Gallicchio and Alessio Micheli ([pdf](https://arxiv.org/pdf/1712.04323.pdf)).\n\nSpecial thanks to Mantas Lukoševičius for his [minimal ESN example](https://mantas.info/wp/wp-content/uploads/simple_esn/minimalESN.py), which greatly helped me to get started with reservoir computing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnizil%2Fesnpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnizil%2Fesnpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnizil%2Fesnpy/lists"}