This repo provides the necessary code for reproducing the results of the paper A projected nonlinear state-space model for forecasting time series signals (arxiv). If you are interested in only running the PNLSS model, please refer to this repository.
GPU is required to run the codes. The following docker image is built for CUDA12. For setting up the environment we assume that you have installed Docker on your machine. First clone the repository and build the image:
git clone https://github.com/christiando/pnlss.git
cd pnlss
git submodule update --init --recursive
docker build -t pnlss .This might take a couple of minutes. Alternatively you can also use/pull the built image from dockerhub chdonner/pnlss. If not already installed, install NVIDIA Container Toolkit by following instructions and run in the following.
sudo systemctl restart dockerOnce this is done you can start a jupyter lab environment.
docker run --gpus all -p 8888:8888 -v $(pwd):/app/work pnlssClick on the link, that is prompted in your terminal, and you can execute the notebooks that come with this repository.
Figure 2: Run Fig2_PNLSS-VanderPol.ipynb
Figure 3: Run Fig3_PNLSS-Lorentz_computation-time.ipynb
Figure 4a: Run Fig4a_models_Dysts-Darts.ipynb
Figure 4b: Run Fig4b_models_correlations.ipynb
Figure 5: Run Fig5_violin_plot.ipynb
Figure 6: Run Fig6_combine_plots.ipynb
Figure 7: Run Fig7_vectorfield.ipynb
The repo comes already with the data for the figures. However, we also provide the code to reproduce the data. Be aware, that this can be time intensive. First start the docker image from within the pnlss folder:
docker run --gpus all -it -v "$(pwd):/app" pnlss /bin/bashFigure 3:
Run the following
python notebooks/Fig3_computation_time_nlss.py
python notebooks/Fig3_computation_time_rbf.py
python notebooks/Fig3_computation_time_nlss.py --fixed
python notebooks/Fig3_computation_time_rbf.py --fixedFigure 4b, 5, and 6: These figures use the fitted models and their prediction data. To re-run the benchmarking of the PNL-SS method only, run at pnlss/ (Each file takes ~3 days):
python repos/dysts/benchmarks/compute_benchmarks_noise_fine_high.py --pnlss_only
python repos/dysts/benchmarks/compute_benchmarks_noise_fine_low.py --pnlss_onlyTo compute the benchmarking of the PNL-SS and all the 13 methods in Darts, comment out the following lines in the codes and run the codes (This will take ~ 1 week):
python repos/dysts/benchmarks/compute_benchmarks_noise_fine_high.py
python repos/dysts/benchmarks/compute_benchmarks_noise_fine_low.pyThe above codes use the optimized hyperparameters. To do the hyperparameter searchers of the PNL-SS and all the 13 methods in Darts, run (Each file takes ~ 3 weeks):
repos/dysts/benchmarks/find_hyperparameters_high.py
python repos/dysts/benchmarks/find_hyperparameters_low.pyFigure 7:
Run the first file to compute the darts models for figure 7, and the second for the pnlss models.
python notebooks/Fig7_run_darts_models.py
python notebooks/Fig7_run_pnlss.py