This is the code repository for the TVART method, to accompany the paper "Time-varying Autoregression with Low Rank Tensors" by Kameron Decker Harris, Aleksandr Aravkin, Rajesh Rao, and Bing Brunton. [arxiv link]
Dependencies:
- MATLAB R2017b (not tested on earlier versions) with relevant toolboxes
- UNLocBox https://epfl-lts2.github.io/unlocbox-html/
- vline/hline https://www.mathworks.com/matlabcentral/fileexchange/1039-hline-and-vline
- Python 2.7 or 3.6 with numpy, scipy (optional, for preprocessing neural example)
The files to run the TVART algorithm and examples are included here.
- TVART_alt_min.m - implementes the alternating minimization algorithm described in the text
- switching_linear.m - switching linear test case
- smooth_linear.m - smooth linear test case
- example_worms.m - worm behavior example
- example_el_nino.m - sea surface temperature example
- preprocess_neurotycho.py - preprocessing script to remove line noise and compute band power for neural example
- example_neurotycho.m - neural activity example
- other files: helper functions, iPython notebooks used to compare with SLDS, switching_linear_comparison* and smooth_linear_comparison* run sweeps of test problems across N... these are provided as-is and will require some tweaking to run
The data for the examples is stored here. You will need to carry out some extra steps to run all examples:
We obtained the code and data from Costa et al. from https://github.com/AntonioCCosta/local-linear-segmentation. To just run our example, all that is needed is "worm_tseries.h5".
In order to run the "Sea surface temperature" example, you must download
- sst.wkmean.1990-present.nc
- lsmask.nc
The files "ersst4.nino.mth.81-10.ascii" and "PDO.txt" are from https://www.cpc.ncep.noaa.gov/data/indices/ersst4.nino.mth.81-10.ascii and http://research.jisao.washington.edu/pdo/PDO.latest.txt.
These data are kindly provided by the Neurotycho project: http://neurotycho.brain.riken.jp/download/base/20090525S1_Food-Tracking_K1_Zenas+Chao_mat_ECoG64-Motion8.zip.
In order to prepare the data, you must run the preprocessing script.
After running the code, figures will be saved in this directory. We include some figures modified from Neurotycho http://neurotycho.org/food-tracking-task.