Library for implementing reservoir computing models (echo state networks) for multivariate time series classification and clustering.

Overview

Framework overview

This library allows to quickly implement different architectures based on Reservoir Computing (the family of approaches popularized in machine learning by Echo State Networks) for classification or clustering of univariate/multivariate time series.

Several options are available to customize the RC model, by selecting different configurations for each module.

  1. The reservoir module specifies the reservoir configuration (e.g., bidirectional, leaky neurons, circle topology);
  2. The dimensionality reduction module (optionally) applies a dimensionality reduction on the produced sequence of the reservoir's states;
  3. The representation module defines how to represent the input time series from the sequence of reservoir's states;
  4. The readout module specifies the model to use to perform the final classification.

The representations obtained at step 3 can also be used to perform clustering.

This library also implements the novel reservoir model space as representation for the time series. Details on the methodology can be found in the original paper (Arix version here).

Required libraries

  • sklearn (tested on version 0.22.1)
  • scipy

The code has been tested on Python 3.7, but lower versions should work as well.

Quick execution

Run the script classification_example.py or clustering_example.py to perform a quick execution on a benchmark dataset of multivariate time series.

For the clustering example, check also the notebook here.

Configure the RC-model

The main class RC_model contained in modules.py permits to specify, train and test an RC-model. The RC-model is configured by passing to the constructor of the class RC_model a set of parameters. To get an idea, you can check classification_example.py or clustering_example.py where the parameters are specified through a dictionary (config).

The available configuration hyperparameters are listed in the following and, for the sake of clarity, are grouped according to which module of the architecture they refer to.

1. Reservoir:

  • n_drop - number of transient states to drop
  • bidir - use a bidirectional reservoir (True or False)
  • reservoir - precomputed reservoir (object of class Reservoir in reservoir.py; if None, the following hyperparameters must be specified:
    • n_internal_units = number of processing units in the reservoir
    • spectral_radius = largest eigenvalue of the reservoir matrix of connection weights (to guarantee the Echo State Property, set spectral_radius <= leak <= 1)
    • leak = amount of leakage in the reservoir state update (optional, None or 1.0 --> no leakage)
    • circ = if True, generate a determinisitc reservoir with circle topology where each connection has the same weight
    • connectivity = percentage of nonzero connection weights (ignored if circ = True)
    • input_scaling = scaling of the input connection weights (note that weights are randomly drawn from {-1,1})
    • noise_level = deviation of the Gaussian noise injected in the state update

2. Dimensionality reduction:

  • dimred_method - procedure for reducing the number of features in the sequence of reservoir states; possible options are: None (no dimensionality reduction), 'pca' (standard PCA) or 'tenpca' (tensorial PCA for multivariate time series data)
  • n_dim - number of resulting dimensions after the dimensionality reduction procedure

3. Representation:

  • mts_rep - type of multivariate time series representation. It can be 'last' (last state), 'mean' (mean of all states), 'output' (output model space), or 'reservoir' (reservoir model space)
  • w_ridge_embedding - regularization parameter of the ridge regression in the output model space and reservoir model space representation; ignored if mts_rep is None

4. Readout:

  • readout_type - type of readout used for classification. It can be 'lin' (ridge regression), 'mlp' (multilayer perceptron), 'svm' (support vector machine), or None. If None, the input representations will be stored in the .input_repr attribute: this is useful for clustering and visualization. Also, if None, the other Readout hyperparameters can be left unspecified.
  • w_ridge - regularization parameter of the ridge regression readout (only when readout_type is 'lin')
  • mlp_layout - list with the sizes of MLP layers, e.g. [20,20,10] defines a MLP with 3 layers of 20, 20 and 10 units respectively (only when readout_type is 'mlp')
  • batch_size - size of the mini batches used during training (only when readout_type is 'mlp')
  • num_epochs - number of iterations during the optimization (only when readout_type is 'mlp')
  • w_l2 = weight of the L2 regularization (only when readout_type is 'mlp')
  • learning_rate = learning rate in the gradient descent optimization (only when readout_type is 'mlp')
  • nonlinearity = type of activation function; it can be {'relu', 'tanh', 'logistic', 'identity'} (only when readout_type is 'mlp')
  • svm_gamma = bandwith of the RBF kernel (only when readout_type is 'svm')
  • svm_C = regularization for the SVM hyperplane (only when readout_type is 'svm')

Train and test the RC-model for classification

The training and test function requires in input training and test data, which must be provided as multidimensional NumPy arrays of shape [N,T,V], with:

  • N = number of samples
  • T = number of time steps in each sample
  • V = number of variables in each sample

Training and test labels (Y and Yte) must be provided in one-hot encoding format, i.e. a matrix [N,C], where C is the number of classes.

Training

RC_model.train(X, Y)

Inputs:

  • X, Y: training data and respective labels

Outputs:

  • tr_time: time (in seconds) used to train the classifier

Test

RC_module.test(Xte, Yte)

Inputs:

  • Xte, Yte: test data and respective labels

Outputs:

  • accuracy, F1 score: metrics achieved on the test data

Train the RC-model for clustering

As in the case of classification, the data must be provided as multidimensional NumPy arrays of shape [N,T,V]

Training

RC_model.train(X)

Inputs:

  • X: time series data

Outputs:

  • tr_time: time (in seconds) used to generate the representations

Additionally, the representations of the input data X are stored in the attribute RC_model.input_repr

Time series datasets

A collection of univariate and multivariate time series dataset is available for download here. The dataset are provided both in MATLAB and Python (Numpy) format. Original raw data come from UCI, UEA, and UCR public repositories.

Citation

Please, consider citing the original paper if you are using this library in your reasearch

@article{bianchi2020reservoir,
  title={Reservoir computing approaches for representation and classification of multivariate time series},
  author={Bianchi, Filippo Maria and Scardapane, Simone and L{\o}kse, Sigurd and Jenssen, Robert},
  journal={IEEE Transactions on Neural Networks and Learning Systems},
  year={2020},
  publisher={IEEE}
}

Tensorflow version

In the latest version of the repository there is no longer a dependency from Tensorflow, reducing the dependecies of this repository only to scipy and scikit-learn. The MLP readout is now based on the scikit-learn implementation that, however, does not support dropout and the two custom activation functions, Maxout and Kafnets. These functionalities are still available in the branch "Tensorflow". Checkout it to use the Tensorflow version of this repository.

License

The code is released under the MIT License. See the attached LICENSE file.

Owner
Filippo Bianchi
Filippo Bianchi
Code for Max-Margin Contrastive Learning - AAAI 2022

Max-Margin Contrastive Learning This is a pytorch implementation for the paper Max-Margin Contrastive Learning accepted to AAAI 2022. This repository

Anshul Shah 12 Oct 22, 2022
Implementation of the paper "Language-agnostic representation learning of source code from structure and context".

Code Transformer This is an official PyTorch implementation of the CodeTransformer model proposed in: D. Zügner, T. Kirschstein, M. Catasta, J. Leskov

Daniel Zügner 131 Dec 13, 2022
Fast and Context-Aware Framework for Space-Time Video Super-Resolution (VCIP 2021)

Fast and Context-Aware Framework for Space-Time Video Super-Resolution Preparation Dependencies PyTorch 1.2.0 CUDA 10.0 DCNv2 cd model/DCNv2 bash make

Xueheng Zhang 1 Mar 29, 2022
T-LOAM: Truncated Least Squares Lidar-only Odometry and Mapping in Real-Time

T-LOAM: Truncated Least Squares Lidar-only Odometry and Mapping in Real-Time The first Lidar-only odometry framework with high performance based on tr

Pengwei Zhou 183 Dec 01, 2022
Face Recognition Attendance Project

Face-Recognition-Attendance-Project In This Project You will learn how to mark attendance using face recognition, Hello Guys This is Gautam Kumar, Thi

Gautam Kumar 1 Dec 03, 2022
Labels4Free: Unsupervised Segmentation using StyleGAN

Labels4Free: Unsupervised Segmentation using StyleGAN ICCV 2021 Figure: Some segmentation masks predicted by Labels4Free Framework on real and synthet

70 Dec 23, 2022
A PyTorch implementation of SIN: Superpixel Interpolation Network

SIN: Superpixel Interpolation Network This is is a PyTorch implementation of the superpixel segmentation network introduced in our PRICAI-2021 paper:

6 Sep 28, 2022
Official PyTorch Implementation of Mask-aware IoU and maYOLACT Detector [BMVC2021]

The official implementation of Mask-aware IoU and maYOLACT detector. Our implementation is based on mmdetection. Mask-aware IoU for Anchor Assignment

Kemal Oksuz 46 Sep 29, 2022
Softlearning is a reinforcement learning framework for training maximum entropy policies in continuous domains. Includes the official implementation of the Soft Actor-Critic algorithm.

Softlearning Softlearning is a deep reinforcement learning toolbox for training maximum entropy policies in continuous domains. The implementation is

Robotic AI & Learning Lab Berkeley 997 Dec 30, 2022
Spectrum Surveying: Active Radio Map Estimation with Autonomous UAVs

Spectrum Surveying: The Python code in this repository implements the simulations and plots the figures described in the paper “Spectrum Surveying: Ac

Universitetet i Agder 2 Dec 06, 2022
A Tensorflow implementation of BicycleGAN.

BicycleGAN implementation in Tensorflow As part of the implementation series of Joseph Lim's group at USC, our motivation is to accelerate (or sometim

Cognitive Learning for Vision and Robotics (CLVR) lab @ USC 97 Dec 02, 2022
OpenPose: Real-time multi-person keypoint detection library for body, face, hands, and foot estimation

Build Type Linux MacOS Windows Build Status OpenPose has represented the first real-time multi-person system to jointly detect human body, hand, facia

25.7k Jan 09, 2023
CVAT is free, online, interactive video and image annotation tool for computer vision

Computer Vision Annotation Tool (CVAT) CVAT is free, online, interactive video and image annotation tool for computer vision. It is being used by our

OpenVINO Toolkit 8.6k Jan 04, 2023
Lex Rosetta: Transfer of Predictive Models Across Languages, Jurisdictions, and Legal Domains

Lex Rosetta: Transfer of Predictive Models Across Languages, Jurisdictions, and Legal Domains This is an accompanying repository to the ICAIL 2021 pap

4 Dec 16, 2021
Custom IMDB Dataset is extracted between 2020-2021 and custom distilBERT model is trained for movie success probability prediction

IMDB Success Predictor Project involves Web Scraping custom IMDB data between 2020 and 2021 of 10000 movies and shows sorted by number of votes ,fine

Gautam Diwan 1 Jan 18, 2022
Fast mesh denoising with data driven normal filtering using deep variational autoencoders

Fast mesh denoising with data driven normal filtering using deep variational autoencoders This is an implementation for the paper entitled "Fast mesh

9 Dec 02, 2022
Adversarial Attacks on Probabilistic Autoregressive Forecasting Models.

Attack-Probabilistic-Models This is the source code for Adversarial Attacks on Probabilistic Autoregressive Forecasting Models. This repository contai

SRI Lab, ETH Zurich 25 Sep 14, 2022
clDice - a Novel Topology-Preserving Loss Function for Tubular Structure Segmentation

README clDice - a Novel Topology-Preserving Loss Function for Tubular Structure Segmentation CVPR 2021 Authors: Suprosanna Shit and Johannes C. Paetzo

110 Dec 29, 2022
Cl datasets - PyTorch image dataloaders and utility functions to load datasets for supervised continual learning

Continual learning datasets Introduction This repository contains PyTorch image

berjaoui 5 Aug 28, 2022
This repository contains the exercises and its solution contained in the book "An Introduction to Statistical Learning" in python.

An-Introduction-to-Statistical-Learning This repository contains the exercises and its solution contained in the book An Introduction to Statistical L

2.1k Jan 02, 2023