Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
674 changes: 674 additions & 0 deletions ESN/EchoTorch-master/LICENSE

Large diffs are not rendered by default.

130 changes: 130 additions & 0 deletions ESN/EchoTorch-master/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<p align="center"><img src="docs/images/echotorch_complete.png" /></p>

--------------------------------------------------------------------------------

EchoTorch is a python module based on pyTorch to implement and test
various flavours of Echo State Network models. EchoTorch is not
intended to be put into production but for research purposes. As it is
based on pyTorch, EchoTorch's layers can be integrated into deep
architectures.
EchoTorch gives two possible ways to train models :
* Classical ESN training with Moore Penrose pseudo-inverse or LU decomposition;
* pyTorch gradient descent optimizer;

<a href="https://twitter.com/intent/tweet?text=EchoTorch%20is%20a%20python%20module%20based%20on%20pyTorch%20to%20implement%20and%20test%20various%20flavours%20of%20Echo%20State%20Network%20models&url=https://github.com/nschaetti/EchoTorch&hashtags=pytorch,reservoircomputing,research">
<img style='vertical-align: text-bottom !important;' src="https://img.shields.io/twitter/url/http/shields.io.svg?style=social" alt="Tweet">
</a>

Join our community to create datasets and deep-learning models! Chat with us on [Gitter](https://gitter.im/EchoTorch/Lobby) and join the [Google Group](https://groups.google.com/forum/#!forum/echotorch/) to collaborate with us.

![PyPI - Python Version](https://img.shields.io/pypi/pyversions/echotorch.svg?style=flat-square)
[![Codecov](https://img.shields.io/codecov/c/github/nschaetti/echotorch/master.svg?style=flat-square)](https://codecov.io/gh/nschaetti/EchoTorch)
[![Documentation Status]( https://img.shields.io/readthedocs/echotorch/latest.svg?style=flat-square)](http://echotorch.readthedocs.io/en/latest/?badge=latest&style=flat-square)
[![Build Status](https://img.shields.io/travis/nschaetti/EchoTorch/master.svg?style=flat-square)](https://travis-ci.org/nschaetti/EchoTorch)

This repository consists of:

* echotorch.datasets : Pre-built datasets for common ESN tasks
* echotorch.models : Generic pretrained ESN models
* echotorch.transforms : Data transformations specific to echo state networks
* echotorch.utils : Tools, functions and measures for echo state networks

## Getting started

These instructions will get you a copy of the project up and running
on your local machine for development and testing purposes.
See deployment for notes on how to deploy the project on a live system.

### Prerequisites

You need to following package to install EchoTorch.

* pyTorch
* TorchVision

### Installation

pip install EchoTorch

## Authors

* **Nils Schaetti** - *Initial work* - [nschaetti](https://github.com/nschaetti/)

## License

This project is licensed under the GPLv3 License - see the [LICENSE](LICENSE) file
for details.

## Citing

If you find EchoTorch useful for an academic publication, then please use the following BibTeX to cite it:

```
@misc{echotorch,
author = {Schaetti, Nils},
title = {EchoTorch: Reservoir Computing with pyTorch},
year = {2018},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/nschaetti/EchoTorch}},
}
```

## A short introduction

### Classical ESN training

You can simply create an ESN with the ESN or LiESN objects in the nn
module.

```python
esn = etnn.LiESN(
input_dim,
n_hidden,
output_dim,
spectral_radius,
learning_algo='inv',
leaky_rate=leaky_rate
)
```

Where

* input_dim is the input dimensionality;
* h_hidden is the size of the reservoir;
* output_dim is the output dimensionality;
* spectral_radius is the spectral radius with a default value of 0.9;
* learning_algo allows you to choose with training algorithms to use.
The possible values are inv, LU and sdg;

You now just have to give the ESN the inputs and the attended outputs.

```python
for data in trainloader:
# Inputs and outputs
inputs, targets = data

# To variable
inputs, targets = Variable(inputs), Variable(targets)

# Give the example to EchoTorch
esn(inputs, targets)
# end for
```

After giving all examples to EchoTorch, you just have to call the
finalize method.

```python
esn.finalize()
```

The model is now trained and you can call the esn object to get a
prediction.

```python
predicted = esn(test_input)
```

### ESN training with Stochastic Gradient Descent

20 changes: 20 additions & 0 deletions ESN/EchoTorch-master/docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = EchoTorch
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Binary file added ESN/EchoTorch-master/docs/images/echotorch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
164 changes: 164 additions & 0 deletions ESN/EchoTorch-master/docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# -*- coding: utf-8 -*-
#
# EchoTorch documentation build configuration file, created by
# sphinx-quickstart on Thu Apr 6 11:30:46 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
import echotorch
#import sphinx_bootstrap_theme
sys.path.insert(0, os.path.abspath('../../echotorch'))


# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.githubpages']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'EchoTorch'
copyright = u'2017, Nils Schaetti'
author = u'Nils Schaetti'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u'0.1'
# The full version, including alpha/beta/rc tags.
release = u'0.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = []

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True


# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
#html_theme = 'bootstrap'
#html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']


# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'EchoTorchdoc'


# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'EchoTorch.tex', u'EchoTorch Documentation',
u'Nils Schaetti', 'manual'),
]


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'echotorch', u'EchoTorch Documentation',
[author], 1)
]


# -- Options for Texinfo output -------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'EchoTorch', u'EchoTorch Documentation',
author, 'EchoTorch', 'One line description of project.',
'Miscellaneous'),
]



38 changes: 38 additions & 0 deletions ESN/EchoTorch-master/docs/source/echotorch.datasets.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
echotorch\.datasets package
===========================

Submodules
----------

echotorch\.datasets\.MackeyGlassDataset module
----------------------------------------------

.. automodule:: echotorch.datasets.MackeyGlassDataset
:members:
:undoc-members:
:show-inheritance:

echotorch\.datasets\.MemTestDataset module
------------------------------------------

.. automodule:: echotorch.datasets.MemTestDataset
:members:
:undoc-members:
:show-inheritance:

echotorch\.datasets\.NARMADataset module
----------------------------------------

.. automodule:: echotorch.datasets.NARMADataset
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: echotorch.datasets
:members:
:undoc-members:
:show-inheritance:
32 changes: 32 additions & 0 deletions ESN/EchoTorch-master/docs/source/echotorch.nn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
echotorch.nn
============

.. automodule:: torch.nn
.. currentmodule:: torch.nn

Echo State Layers
-----------------

ESNCell
~~~~~~~

.. autoclass:: nn.ESNCell
:members:

ESN
~~~

.. autoclass:: nn.ESN
:members:

LiESNCell
~~~~~~~~~

.. autoclass:: nn.LiESNCell
:members:

LiESN
~~~~~

.. autoclass:: nn.LiESN
:members:
Loading