Skip to content

Implementation of the algorithm described in: SAMoSSA: Multivariate Singular Spectrum Analysis with Stochastic Autoregressive Noise

License

Notifications You must be signed in to change notification settings

AbdullahO/SAMoSSA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

Implementation of the algorithm described in: SAMoSSA: Multivariate Singular Spectrum Analysis with Stochastic Autoregressive Noise

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages