armacell

ARMA cell: a modular and effective approach for neural autoregressive modeling

https://github.com/phschiele/armacell

Science Score: 67.0%

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

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.0%) to scientific vocabulary
Last synced: 10 months ago · JSON representation ·

Repository

ARMA cell: a modular and effective approach for neural autoregressive modeling

Basic Info
  • Host: GitHub
  • Owner: phschiele
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 82 KB
Statistics
  • Stars: 16
  • Watchers: 1
  • Forks: 2
  • Open Issues: 0
  • Releases: 0
Created almost 4 years ago · Last pushed about 2 years ago
Metadata Files
Readme License Citation

README.md

ARMA cell: a modular and effective approach for neural autoregressive modeling

CI GitHub Code style: black

This repo contains the software implementation of the ARMA cell. Data and code to reproduce the experiments in our paper can be found at the armacell_paper repository.

Installation

The ARMA cell can be installed using pip as follows

python pip install git+https://github.com/phschiele/armacell.git

Getting started

The syntax of the ARMA cell is similar to existing RNN models in tensorflow, with the additional parameter q for the number of MA lags. The number of AR lags is already represented in the preprocessed data, which is handled by prepare_arma_input.

Below is an example using the functional model API python x = ARMA(q, input_dim=(n_features, p), units=1, activation="relu", use_bias=True)(x)

The syntax for the ConvARMA cell is also similar to existing spatiotemporal RNN models. If return_lags=True, a subsequent ConvARMA layer will itself have multiple lags. python x = ConvARMA( activation="relu", units=64, q=3, image_shape=image_shape, kernel_size=(3, 3), return_lags=False, return_sequences=True )(x)

Minimum working example

```python import numpy as np from statsmodels.tsa.arima.model import ARIMA from tensorflow import keras

from armacell import ARMA from armacell.helpers import simulatearmaprocess, preparearmainput, SaveWeights, setallseeds from armacell.plotting import plot_convergence

1. Obtain time series data. Simulating an ARMA process here for simplicity

arparams = np.array([0.1, 0.3]) maparams = np.array([-0.4, -0.2]) alpha = 0 setallseeds() y = simulatearmaprocess(arparams, maparams, alpha, n_steps=25000, std=2)

2. Data pre-processing.

In practice, p and q are hyperparameters. Here, we use the true values.

p, q = len(arparams), len(maparams) Xtrain, ytrain = preparearmainput(max(p, q), y)

3. Fit the model

tfmodel = keras.Sequential( [ ARMA(q=q, inputdim=Xtrain.shape[2:]), ] ) tfmodel.compile(loss="mse", optimizer="adam") callback = [SaveWeights()] # We add a callback to plot the convergence later tfmodel.fit(Xtrain, ytrain, epochs=100, batchsize=100, callbacks=callback, verbose=True)

4. Fit a classical ARMA model for comparison

arma_model = ARIMA(endog=y, order=(p, 0, q), trend="n").fit()

5. Plot the result

plotconvergence(tfmodel, p, addintercept=False, arimamodel=arma_model, path="example.png") ```

Looking at the convergence plot, the ARMA cell converged to the true parameters at least as good as a classical ARIMA model.

convergence plot

Test

Unit and regression tests are handled through pytest, which can be installed via pip install pytest. To run all tests, simply execute shell pytest from the root of the repository.

Citing

If you use the ARMA cell in your research, please consider citing us by clicking Cite this repository on the sidebar, or using the below BibTeX. BibTeX @misc{schiele2022armacell, author = {Schiele, Philipp and Berninger, Christoph and R\"ugamer, David}, doi = {10.48550/ARXIV.2208.14919}, title = {{ARMA Cell: A Modular and Effective Approach for Neural Autoregressive Modeling}}, url = {https://arxiv.org/abs/2208.14919}, year = {2022}, month = {8} }

Owner

  • Name: Philipp Schiele
  • Login: phschiele
  • Kind: user
  • Location: Munich

CVXPY | Scalable Capital | LMU Munich

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
title: "ARMA Cell: A Modular and Effective Approach for Neural Autoregressive Modeling"
type: generic
doi: 10.48550/ARXIV.2208.14919
url: "https://arxiv.org/abs/2208.14919"
date-released: 2022-08-31
authors:
      - family-names: Schiele
        given-names: Philipp
        email: philipp.schiele@stat.uni-muenchen.de
        affiliation: Ludwig-Maximilians-Universität München
        orcid: 'https://orcid.org/0000-0002-0101-0388'
      - family-names: Berninger
        given-names: Christoph
        email: christoph.berninger@stat.uni-muenchen.de
        affiliation: Ludwig-Maximilians-Universität München
        orcid: 'https://orcid.org/0000-0002-3502-856X'
      - family-names: R\"ugamer
        given-names: David
        email: david.ruegamer@stat.uni-muenchen.de
        affiliation: Ludwig-Maximilians-Universität München
        orcid: 'https://orcid.org/0000-0002-8772-9202'
identifiers:
  - type: other
    value: 'arXiv:2208.14919'
    description: The ArXiv preprint of the paper

GitHub Events

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

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: 2 minutes
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: 2 minutes
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • elpellerano (2)
Top Labels
Issue Labels
Pull Request Labels