Skip to content
Time series auto-regressor.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests fixed typo that was causing test to fail Nov 21, 2019
tsar non_par works Nov 20, 2019
.gitignore old edits and cleanup Nov 5, 2019
.travis.yml travis Nov 5, 2019 added workspace for gaussian fit functions Nov 20, 2019
LICENSE Update Nov 20, 2019 old edits and cleanup Nov 5, 2019
requirements.txt travis Nov 5, 2019 0.8.1 Nov 21, 2019

tsar: time series auto-regressor

tsar is a Python library to model and forecast time series data. It operates on pandas dataframes and uses numba just-in-time compilation to speed up some operations.

The core algorithm used is described in the draft paper Seasonally-Adjusted Auto-Regression of Vector Time Series, E. Busseti, November 2019.


Note: tsar is currently in beta release, its interface might change.

To install, execute in a terminal

pip install tsar

To use it, you need some time series data as a pandas dataframe data with date-time index and constant time spacing (i.e., its data.index.freq attribute must not be None). Only numerical data is supported at this time.

Build a model

You build a model by

from tsar import tsar
model = tsar(data=data, P=P, F=F)

where P and F are positive integers representing how many points in the past will be used for inference, and how many steps in the future will be predicted, respectively.

If you wish, you can pass to the constructor any hyper-parameter of the model, for example, the rank R and the quadratic regularization parameter quadratic_regularization. If not specified, these will be optimized by greedy grid search (see the paper) on an internally split test set.

Missing data

The data can have any amount of missing values (np.nan).


Inference is performed with

prediction = model.predict(data=new_data, prediction_time=t)

where new_data is a dataframe with the same column names and time spacing than the one used to build the model, and prediction_time is the timestamp at which to infer. The resulting prediction dataframe has time index spanning from the time t minus P steps in the past, to the time t plus F steps in the future.

Any data that was present (and not equal to np.nan) in the new_data dataframe will be copied to the appropriate position in the prediction dataframe. All other points will be inferred.

Missing data

The provided data can have any amount of missing values, the prediction has none.

You can’t perform that action at this time.