Code for the paper "Next Generation Reservoir Computing"

Overview

Next Generation Reservoir Computing

This is the code for the results and figures in our paper "Next Generation Reservoir Computing". They are written in Python, and require recent versions of NumPy, SciPy, and matplotlib. If you are using a Python environment like Anaconda, these are likely already installed.

Python Virtual Environment

If you are not using Anaconda, or want to run this code on the command line in vanilla Python, you can create a virtual environment with the required dependencies by running:

python3 -m venv env
./env/bin/pip install -r requirements.txt

This will install the most recent version of the requirements available to you. If you wish to use the exact versions we used, use requirements-exact.txt instead.

You can then run the individual scripts, for example:

./env/bin/python DoubleScrollNVAR-RK23.py
You might also like...
Code for the paper Learning the Predictability of the Future

Learning the Predictability of the Future Code from the paper Learning the Predictability of the Future. Website of the project in hyperfuture.cs.colu

PyTorch code for the paper: FeatMatch: Feature-Based Augmentation for Semi-Supervised Learning
PyTorch code for the paper: FeatMatch: Feature-Based Augmentation for Semi-Supervised Learning

FeatMatch: Feature-Based Augmentation for Semi-Supervised Learning This is the PyTorch implementation of our paper: FeatMatch: Feature-Based Augmentat

Code for the paper A Theoretical Analysis of the Repetition Problem in Text Generation
Code for the paper A Theoretical Analysis of the Repetition Problem in Text Generation

A Theoretical Analysis of the Repetition Problem in Text Generation This repository share the code for the paper "A Theoretical Analysis of the Repeti

Code for our ICASSP 2021 paper: SA-Net: Shuffle Attention for Deep Convolutional Neural Networks
Code for our ICASSP 2021 paper: SA-Net: Shuffle Attention for Deep Convolutional Neural Networks

SA-Net: Shuffle Attention for Deep Convolutional Neural Networks (paper) By Qing-Long Zhang and Yu-Bin Yang [State Key Laboratory for Novel Software T

Open source repository for the code accompanying the paper 'Non-Rigid Neural Radiance Fields Reconstruction and Novel View Synthesis of a Deforming Scene from Monocular Video'.
Open source repository for the code accompanying the paper 'Non-Rigid Neural Radiance Fields Reconstruction and Novel View Synthesis of a Deforming Scene from Monocular Video'.

Non-Rigid Neural Radiance Fields This is the official repository for the project "Non-Rigid Neural Radiance Fields: Reconstruction and Novel View Synt

Code for the Shortformer model, from the paper by Ofir Press, Noah A. Smith and Mike Lewis.

Shortformer This repository contains the code and the final checkpoint of the Shortformer model. This file explains how to run our experiments on the

PyTorch code for ICLR 2021 paper Unbiased Teacher for Semi-Supervised Object Detection
PyTorch code for ICLR 2021 paper Unbiased Teacher for Semi-Supervised Object Detection

Unbiased Teacher for Semi-Supervised Object Detection This is the PyTorch implementation of our paper: Unbiased Teacher for Semi-Supervised Object Detection

Official code for paper "Optimization for Oriented Object Detection via Representation Invariance Loss".

Optimization for Oriented Object Detection via Representation Invariance Loss By Qi Ming, Zhiqiang Zhou, Lingjuan Miao, Xue Yang, and Yunpeng Dong. Th

Code for our CVPR 2021 paper
Code for our CVPR 2021 paper "MetaCam+DSCE"

Joint Noise-Tolerant Learning and Meta Camera Shift Adaptation for Unsupervised Person Re-Identification (CVPR'21) Introduction Code for our CVPR 2021

Comments
  • Generalized Performance

    Generalized Performance

    I modified the code given in this repo to what I think is a more generalized version (below) where the input is an array containing points generated by any sort of process. It gives a perfect result on predicting sin functions, but on a constant linear trend gives absolutely terrible, nonsense performance. By my understanding, that is simply the nature of reservoir computing, it can't handle a trend. Is that correct?

    I would also appreciate any other insight you might have on the generalization of this function. Thanks!

    import numpy as np
    import pandas as pd
    
    
    def load_linear(long=False, shape=None, start_date: str = "2021-01-01"):
        """Create a dataset of just zeroes for testing edge case."""
        if shape is None:
            shape = (500, 5)
        df_wide = pd.DataFrame(
            np.ones(shape), index=pd.date_range(start_date, periods=shape[0], freq="D")
        )
        df_wide = (df_wide * list(range(0, shape[1]))).cumsum()
        if not long:
            return df_wide
        else:
            df_wide.index.name = "datetime"
            df_long = df_wide.reset_index(drop=False).melt(
                id_vars=['datetime'], var_name='series_id', value_name='value'
            )
            return df_long
    
    
    def load_sine(long=False, shape=None, start_date: str = "2021-01-01"):
        """Create a dataset of just zeroes for testing edge case."""
        if shape is None:
            shape = (500, 5)
        df_wide = pd.DataFrame(
            np.ones(shape),
            index=pd.date_range(start_date, periods=shape[0], freq="D"),
            columns=range(shape[1])
        )
        X = pd.to_numeric(df_wide.index, errors='coerce', downcast='integer').values
    
        def sin_func(a, X):
            return a * np.sin(1 * X) + a
        for column in df_wide.columns:
            df_wide[column] = sin_func(column, X)
        if not long:
            return df_wide
        else:
            df_wide.index.name = "datetime"
            df_long = df_wide.reset_index(drop=False).melt(
                id_vars=['datetime'], var_name='series_id', value_name='value'
            )
            return df_long
    
    
    def predict_reservoir(df, forecast_length, warmup_pts, k=2, ridge_param=2.5e-6):
        # k =  # number of time delay taps
        # pass in traintime_pts to limit as .tail() for huge datasets?
    
        n_pts = df.shape[1]
        # handle short data edge case
        min_train_pts = 10
        max_warmup_pts = n_pts - min_train_pts
        if warmup_pts >= max_warmup_pts:
            warmup_pts = max_warmup_pts if max_warmup_pts > 0 else 0
    
        traintime_pts = n_pts - warmup_pts   # round(traintime / dt)
        warmtrain_pts = warmup_pts + traintime_pts
        testtime_pts = forecast_length + 1  # round(testtime / dt)
        maxtime_pts = n_pts  # round(maxtime / dt)
    
        # input dimension
        d = df.shape[0]
        # size of the linear part of the feature vector
        dlin = k * d
        # size of nonlinear part of feature vector
        dnonlin = int(dlin * (dlin + 1) / 2)
        # total size of feature vector: constant + linear + nonlinear
        dtot = 1 + dlin + dnonlin
    
        # create an array to hold the linear part of the feature vector
        x = np.zeros((dlin, maxtime_pts))
    
        # fill in the linear part of the feature vector for all times
        for delay in range(k):
            for j in range(delay, maxtime_pts):
                x[d * delay : d * (delay + 1), j] = df[:, j - delay]
    
        # create an array to hold the full feature vector for training time
        # (use ones so the constant term is already 1)
        out_train = np.ones((dtot, traintime_pts))
    
        # copy over the linear part (shift over by one to account for constant)
        out_train[1 : dlin + 1, :] = x[:, warmup_pts - 1 : warmtrain_pts - 1]
    
        # fill in the non-linear part
        cnt = 0
        for row in range(dlin):
            for column in range(row, dlin):
                # shift by one for constant
                out_train[dlin + 1 + cnt] = (
                    x[row, warmup_pts - 1 : warmtrain_pts - 1]
                    * x[column, warmup_pts - 1 : warmtrain_pts - 1]
                )
                cnt += 1
    
        # ridge regression: train W_out to map out_train to Lorenz[t] - Lorenz[t - 1]
        W_out = (
            (x[0:d, warmup_pts:warmtrain_pts] - x[0:d, warmup_pts - 1 : warmtrain_pts - 1])
            @ out_train[:, :].T
            @ np.linalg.pinv(
                out_train[:, :] @ out_train[:, :].T + ridge_param * np.identity(dtot)
            )
        )
    
        # create a place to store feature vectors for prediction
        out_test = np.ones(dtot)  # full feature vector
        x_test = np.zeros((dlin, testtime_pts))  # linear part
    
        # copy over initial linear feature vector
        x_test[:, 0] = x[:, warmtrain_pts - 1]
    
        # do prediction
        for j in range(testtime_pts - 1):
            # copy linear part into whole feature vector
            out_test[1 : dlin + 1] = x_test[:, j]  # shift by one for constant
            # fill in the non-linear part
            cnt = 0
            for row in range(dlin):
                for column in range(row, dlin):
                    # shift by one for constant
                    out_test[dlin + 1 + cnt] = x_test[row, j] * x_test[column, j]
                    cnt += 1
            # fill in the delay taps of the next state
            x_test[d:dlin, j + 1] = x_test[0 : (dlin - d), j]
            # do a prediction
            x_test[0:d, j + 1] = x_test[0:d, j] + W_out @ out_test[:]
        return x_test[0:d, 1:]
    
    
    # note transposed from the opposite of my usual shape
    data_pts = 7000
    series = 3
    forecast_length = 10
    df_sine = load_sine(long=False, shape=(data_pts, series)).transpose().to_numpy()
    df_sine_train = df_sine[:, :-10]
    df_sine_test = df_sine[:, -10:]
    prediction_sine = predict_reservoir(df_sine_train, forecast_length=forecast_length, warmup_pts=150, k=2, ridge_param=2.5e-6)
    print(f"sine MAE {np.mean(np.abs(df_sine_test - prediction_sine))}")
    
    df_linear = load_linear(long=False, shape=(data_pts, series)).transpose().to_numpy()
    df_linear_train = df_linear[:, :-10]
    df_linear_test = df_linear[:, -10:]
    prediction_linear = predict_reservoir(df_linear_train, forecast_length=forecast_length, warmup_pts=150, k=2, ridge_param=2.5e-6)
    print(f"linear MAE {np.mean(np.abs(df_linear_test - prediction_linear))}")
    
    
    opened by winedarksea 2
  • Link to your paper

    Link to your paper

    I'm documenting here the link to your paper. I couldn't find it in the readme:


    Next generation reservoir computing

    Daniel J. Gauthier, Erik Bollt, Aaron Griffith & Wendson A. S. Barbosa 
    

    Nature Communications volume 12, Article number: 5564 (2021) https://www.nature.com/articles/s41467-021-25801-2

    opened by impredicative 1
Releases(v1.0)
Owner
OSU QuantInfo Lab
Daniel Gauthier's Research Group
OSU QuantInfo Lab
Dynamic View Synthesis from Dynamic Monocular Video

Dynamic View Synthesis from Dynamic Monocular Video Project Website | Video | Paper Dynamic View Synthesis from Dynamic Monocular Video Chen Gao, Ayus

Chen Gao 139 Dec 28, 2022
Distance-Ratio-Based Formulation for Metric Learning

Distance-Ratio-Based Formulation for Metric Learning Environment Python3 Pytorch (http://pytorch.org/) (version 1.6.0+cu101) json tqdm Preparing datas

Hyeongji Kim 1 Dec 07, 2022
Graph Representation Learning via Graphical Mutual Information Maximization

GMI (Graphical Mutual Information) Graph Representation Learning via Graphical Mutual Information Maximization (Peng Z, Huang W, Luo M, et al., WWW 20

93 Dec 29, 2022
PyTorch implementation of Interpretable Explanations of Black Boxes by Meaningful Perturbation

PyTorch implementation of Interpretable Explanations of Black Boxes by Meaningful Perturbation The paper: https://arxiv.org/abs/1704.03296 What makes

Jacob Gildenblat 322 Dec 17, 2022
A3C LSTM Atari with Pytorch plus A3G design

NEWLY ADDED A3G A NEW GPU/CPU ARCHITECTURE OF A3C FOR SUBSTANTIALLY ACCELERATED TRAINING!! RL A3C Pytorch NEWLY ADDED A3G!! New implementation of A3C

David Griffis 532 Jan 02, 2023
FEDn is an open-source, modular and ML-framework agnostic framework for Federated Machine Learning

FEDn is an open-source, modular and ML-framework agnostic framework for Federated Machine Learning (FedML) developed and maintained by Scaleout Systems. FEDn enables highly scalable cross-silo and cr

Scaleout 75 Nov 09, 2022
Progressive Image Deraining Networks: A Better and Simpler Baseline

Progressive Image Deraining Networks: A Better and Simpler Baseline [arxiv] [pdf] [supp] Introduction This paper provides a better and simpler baselin

190 Dec 01, 2022
Easily Process a Batch of Cox Models

ezcox: Easily Process a Batch of Cox Models The goal of ezcox is to operate a batch of univariate or multivariate Cox models and return tidy result. ⏬

Shixiang Wang 15 May 23, 2022
Code for DeepXML: A Deep Extreme Multi-Label Learning Framework Applied to Short Text Documents

DeepXML Code for DeepXML: A Deep Extreme Multi-Label Learning Framework Applied to Short Text Documents Architectures and algorithms DeepXML supports

Extreme Classification 49 Nov 06, 2022
Mmdet benchmark with python

mmdet_benchmark 本项目是为了研究 mmdet 推断性能瓶颈,并且对其进行优化。 配置与环境 机器配置 CPU:Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz GPU:NVIDIA GeForce RTX 3080 10GB 内存:64G 硬盘:1T

杨培文 (Yang Peiwen) 24 May 21, 2022
An original implementation of "MetaICL Learning to Learn In Context" by Sewon Min, Mike Lewis, Luke Zettlemoyer and Hannaneh Hajishirzi

MetaICL: Learning to Learn In Context This includes an original implementation of "MetaICL: Learning to Learn In Context" by Sewon Min, Mike Lewis, Lu

Meta Research 141 Jan 07, 2023
Code for the paper BERT might be Overkill: A Tiny but Effective Biomedical Entity Linker based on Residual Convolutional Neural Networks

Biomedical Entity Linking This repo provides the code for the paper BERT might be Overkill: A Tiny but Effective Biomedical Entity Linker based on Res

Tuan Manh Lai 24 Oct 24, 2022
PyTorch implementations of the NeRF model described in "NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis"

PyTorch NeRF and pixelNeRF NeRF: Tiny NeRF: pixelNeRF: This repository contains minimal PyTorch implementations of the NeRF model described in "NeRF:

Michael A. Alcorn 178 Dec 20, 2022
SNE-RoadSeg in PyTorch, ECCV 2020

SNE-RoadSeg Introduction This is the official PyTorch implementation of SNE-RoadSeg: Incorporating Surface Normal Information into Semantic Segmentati

242 Dec 20, 2022
Official PyTorch code of DeepPanoContext: Panoramic 3D Scene Understanding with Holistic Scene Context Graph and Relation-based Optimization (ICCV 2021 Oral).

DeepPanoContext (DPC) [Project Page (with interactive results)][Paper] DeepPanoContext: Panoramic 3D Scene Understanding with Holistic Scene Context G

Cheng Zhang 66 Nov 16, 2022
LF-YOLO (Lighter and Faster YOLO) is used to detect defect of X-ray weld image.

This project is based on ultralytics/yolov3. LF-YOLO (Lighter and Faster YOLO) is used to detect defect of X-ray weld image. Download $ git clone http

26 Dec 13, 2022
Use unsupervised and supervised learning to predict stocks

AIAlpha: Multilayer neural network architecture for stock return prediction This project is meant to be an advanced implementation of stacked neural n

Vivek Palaniappan 1.5k Jan 06, 2023
Revisiting Oxford and Paris: Large-Scale Image Retrieval Benchmarking

Revisiting Oxford and Paris: Large-Scale Image Retrieval Benchmarking We revisit and address issues with Oxford 5k and Paris 6k image retrieval benchm

Filip Radenovic 188 Dec 17, 2022
Production First and Production Ready End-to-End Speech Recognition Toolkit

WeNet 中文版 Discussions | Docs | Papers | Runtime (x86) | Runtime (android) | Pretrained Models We share neural Net together. The main motivation of WeN

2.7k Jan 04, 2023
yufan 81 Dec 08, 2022