Package: slants
The 'slants' Python APIThis package provides a Python implementation as well as an user-friendly API for theSequential Adaptive Nonlinear Modeling of Time Series(SLANTS) algorithm, as proposed byQ. Han, J. Ding, E. M. Airoldi and V. Tarokhin theIEEE Transactions on Signal Processing Journal, Vol. 65, NO. 19, October 2017, pages [4994, 5005]. SLANTS provides a new method for online modeling and prediction of nonlinear and nonparametric autoregressive time series.It usessplinesto approximate a wide range ofnonlinear functions and adaptive filteringto accommodate time varying data generating processes.It is built on anew online group LASSO algorithmproposed in the reference paper.It can beapplied to high dimensional time serieswhere the dimension is larger than the sample size.Further details and theory about the algorithm can be found here [PDF]A Quick Setup GuideGetting Started1. Install the 'slants' package using pip# Installing test packagepython-mpipinstallslants2. Import the Model and Experiment API classesTwo fundamental API classes are available. TheModel Class APIprovides online model fitting capabilities of the SLANTS algorithm for your data as well as diagnostic plot graphing functions to view learned optimal model parameters. TheExperiment Class APIis a utility data-loader class that will quickly set you up with the environment to test the SLANTS algorithm API by loading sample synthetic experiments. You may import both classes as follows:fromslantsimportModel,ExperimentUsing the packageExperiment Class API1. Load a synthetic experiment dataset using the Experiment.load() methodThis method returns a dictionary containing the design data matrix + tunable parameters for the model.exp=Experiment.load(1)# load synthetic experiment no. (1)2. View number of available synthetic datasetsExperiment.load('?')All the tunable parameters for model fitting, inclusive of the data design matrix, can be accessed from the 'exp' dictionary.Model Class API1. Instantiate Model objects and viewing available methods:model=Model()model.help(ls=True)#ls ~ inspiration from linux bash-style command2. Fit SLANTS algorithm on data design matrix:# Consolidating spline spline configuration + optional tunable parametersspline_info={'order':spline_info_order,'num_Bsplines':spline_info_num_Bsplines}optional_params={'test_size':test_size,'safe_shrink_lambda':safe_shrink_lambda,'random_beta':random_beta}## Note: Many more optional tunable parameters are available; see documentation# Fitting the SLANTS model on the datamodel.fit(data,predict,maximum_lag,spline_info,forget_factor,lambda_init,tau2_init,sparse_lambda_tolerance,delta_multiplier,shrink_step_size,**optional_params)# unpacking optional args dictionaryEither check theComplete_User_Guide.IPYNBnotebook or type the following to get additional documentation regarding the Model.fit() method:model.help('fit')3. View diagnostic plotsmodel.plot('coef')# show trend of beta coefficients with timemodel.plot('lambda')# show trend of LASSO penalty term with timemodel.plot('tau')# show trend of EM decomposition parameter with timemodel.plot('trace')# show trace of nonlinear functions4. Return learned model parameterslearned_model_params=model.model_params()# dictionary consisting of all learned parametersEither checkComplete_User_Guide.IPYNBnotebook or type the following to get additional documentation regarding the Model.model_params() method:model.help('model_params')5. Reset the model in rare cases of unexpected behaviourmodel.reset_model()6. View man-style documentation of the Model class/methodsmodel.help(ls=True)# show list of methods in Model classmodel.help('fit')# show info about function name, for eg. fit()model.help('all')# show info about entire classSoftware GuideInteractive hands-on guides pertaining to the package may be accessed [online] on Google Colab or is available for download in thedocs/folder of this project. Developers can avail all software-design charts of this project in thedocs/folder.Relevant PapersQ .Han, J. Ding, E. Airoldi, V. Tarokh, "SLANTS: Sequential adaptive nonlinear modeling of time series," IEEE Transactions on Signal Processing 65 (19), 4994-5005. [PDF]X. Xian, J. Ding, "Physics-assisted online learning," preprint.AcknowledgementThis research is funded by the Defense Advanced Research Projects Agency (DARPA) under grant number HR00111890040.LicenseThe software is subjected to the GNU GPLv3 licensing terms and agreements.