Git Product home page Git Product logo

samossa's Introduction

SAMoSSA

Implementation of the algorithm described in: SAMoSSA: Multivariate Singular Spectrum Analysis with Stochastic Autoregressive Noise, by Abdullah Alomar, Munther Dahleh, Sean Mann, and Devavrat Shah (published in NeurIPS 2023). See the paper in here.

Getting started

The implementation has a fairly straightforward interface. First, import SAMoSSA using,

from samossa import SAMoSSA

The algorithm takes as input $T$ observations of a multivariate time series with dimension $N$ in the form of a Numpy array. For example:

# load data and init model
data = np.load("datasets/electricity/electricity.npy")
T, N = data.shape

Then to initialize the model, you would need to specify at least two parameters: numSeries (int): the dimension of the multivariate time series; and L (int): the number of lags used in the linear model (check the example, the code and the paper for guidance about choice of L).

# choose L such that it is on the order of (sqrt(NT)) if N < T, otherwise, choose it to be on of order ~T (must be less than T in this case!)
L = int(np.sqrt(N*T/4))
model = SAMoSSA(N, L, )

Then use .fit() to train the model, and .predict(h) to forecast the next h entries in the time series.

# fit model on all but the last 24 steps
model.fit(data[:-24,:])
# forecast the next 24 steps!
predictions = model.predict(24)

samossa's People

Contributors

abdullaho avatar

Stargazers

Grayson Stoik avatar Roarke McNaught avatar  avatar Meshal Alharbi avatar Jeremy Diaz avatar Kelly Franklin-Lyons avatar  avatar

Watchers

Kostas Georgiou avatar  avatar Grayson Stoik avatar

Forkers

whigg klyons valeman

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.