├── _build ├── html │ ├── _static │ │ ├── __init__.py │ │ ├── file.png │ │ ├── plus.png │ │ ├── minus.png │ │ ├── images │ │ │ ├── logo_colab.png │ │ │ ├── logo_binder.svg │ │ │ └── logo_jupyterhub.svg │ │ ├── __pycache__ │ │ │ └── __init__.cpython-38.pyc │ │ ├── css │ │ │ └── blank.css │ │ ├── vendor │ │ │ └── fontawesome │ │ │ │ └── 5.13.0 │ │ │ │ ├── webfonts │ │ │ │ ├── fa-solid-900.eot │ │ │ │ ├── fa-solid-900.ttf │ │ │ │ ├── fa-brands-400.eot │ │ │ │ ├── fa-brands-400.ttf │ │ │ │ ├── fa-brands-400.woff │ │ │ │ ├── fa-regular-400.eot │ │ │ │ ├── fa-regular-400.ttf │ │ │ │ ├── fa-solid-900.woff │ │ │ │ ├── fa-solid-900.woff2 │ │ │ │ ├── fa-brands-400.woff2 │ │ │ │ ├── fa-regular-400.woff │ │ │ │ └── fa-regular-400.woff2 │ │ │ │ └── LICENSE.txt │ │ ├── panels-variables.06eb56fa6e07937060861dad626602ad.css │ │ ├── check-solid.svg │ │ ├── copy-button.svg │ │ ├── documentation_options.js │ │ ├── webpack-macros.html │ │ ├── copybutton.css │ │ ├── copybutton_funcs.js │ │ ├── sphinx-book-theme.d59cb220de22ca1c485ebbdc042f0030.js │ │ ├── panels-main.c949a650a448cc0ae9fd3441c0e17fb0.css │ │ ├── sphinx-thebe.css │ │ ├── togglebutton.css │ │ ├── sphinx-thebe.js │ │ └── pygments.css │ ├── index.html │ ├── _sources │ │ ├── bib.md │ │ ├── chapters │ │ │ ├── pf │ │ │ │ └── pf_index.md │ │ │ ├── lgssm │ │ │ │ ├── lgssm_index.md │ │ │ │ ├── kalman_filter.ipynb │ │ │ │ ├── kalman_smoother.ipynb │ │ │ │ ├── kalman_sampling.ipynb │ │ │ │ └── kalman_parallel.ipynb │ │ │ ├── bnp │ │ │ │ └── bnp_index.md │ │ │ ├── unscented │ │ │ │ ├── unscented_index.md │ │ │ │ ├── unscented_filter.ipynb │ │ │ │ └── unscented_smoother.ipynb │ │ │ ├── extended │ │ │ │ ├── extended_index.md │ │ │ │ ├── extended_filter.ipynb │ │ │ │ ├── extended_smoother.ipynb │ │ │ │ └── extended_parallel.ipynb │ │ │ ├── adf │ │ │ │ └── adf_index.md │ │ │ ├── gp │ │ │ │ └── gp_index.md │ │ │ ├── tracking │ │ │ │ └── tracking_index.md │ │ │ ├── learning │ │ │ │ ├── learning_index.md │ │ │ │ ├── mcmc.ipynb │ │ │ │ ├── sgd.ipynb │ │ │ │ ├── vb.ipynb │ │ │ │ └── em.ipynb │ │ │ ├── quadrature │ │ │ │ └── quadrature_index.md │ │ │ ├── smc │ │ │ │ └── smc_index.md │ │ │ ├── timeseries │ │ │ │ └── timeseries_index.md │ │ │ ├── ssm │ │ │ │ ├── ssm_index.md │ │ │ │ ├── learning.ipynb │ │ │ │ └── ssm_intro.ipynb │ │ │ ├── vi │ │ │ │ └── vi_index.md │ │ │ ├── ensemble │ │ │ │ └── ensemble_index.md │ │ │ ├── ode │ │ │ │ └── ode_index.md │ │ │ ├── postlin │ │ │ │ └── postlin_index.md │ │ │ ├── control │ │ │ │ └── control_index.md │ │ │ ├── changepoint │ │ │ │ └── changepoint_index.md │ │ │ ├── hmm │ │ │ │ ├── hmm_index.md │ │ │ │ ├── hmm_viterbi.ipynb │ │ │ │ ├── hmm_sampling.ipynb │ │ │ │ ├── hmm_parallel.ipynb │ │ │ │ └── hmm_smoother.ipynb │ │ │ ├── blank.ipynb │ │ │ └── scratch.md │ │ ├── README.md │ │ └── root.md │ ├── objects.inv │ ├── _images │ │ ├── casino.png │ │ ├── cat_dog.jpg │ │ ├── lds_5_1.png │ │ ├── lds_6_1.png │ │ ├── lds_7_1.png │ │ ├── hmm_14_0.png │ │ ├── hmm_15_0.png │ │ ├── hmm_15_1.png │ │ ├── hmm_16_1.png │ │ ├── hmm_17_0.png │ │ ├── hmm_18_1.png │ │ ├── pendulum.png │ │ ├── ssm_15_0.png │ │ ├── ssm_16_1.png │ │ ├── ssm_18_1.png │ │ ├── ssm_19_1.png │ │ ├── ssm_20_1.png │ │ ├── ssm_21_1.png │ │ ├── ssm_24_1.png │ │ ├── ssm_25_1.png │ │ ├── ssm_29_1.png │ │ ├── ssm_30_1.png │ │ ├── ssm_31_1.png │ │ ├── scratch_2_0.png │ │ ├── ssm_old_15_0.png │ │ ├── ssm_old_16_1.png │ │ ├── ssm_old_21_1.png │ │ ├── ssm_old_30_1.png │ │ ├── ssm_old_31_1.png │ │ ├── SSM-AR-inputs.png │ │ ├── SSM-simplified.png │ │ ├── hmmDgmPlatesY.png │ │ ├── inference_10_1.png │ │ ├── inference_11_1.png │ │ ├── inference_14_1.png │ │ ├── inference_15_1.png │ │ ├── inference_16_1.png │ │ ├── inference_17_1.png │ │ ├── inference_7_1.png │ │ ├── inference_8_1.png │ │ ├── inference_9_1.png │ │ ├── dbn-inference-problems.png │ │ └── inference-problems-tikz.png │ ├── .buildinfo │ ├── _panels_static │ │ ├── panels-variables.06eb56fa6e07937060861dad626602ad.css │ │ └── panels-main.c949a650a448cc0ae9fd3441c0e17fb0.css │ └── reports │ │ ├── hmm_filter.log │ │ └── hmm.log ├── .doctrees │ ├── glue_cache.json │ ├── bib.doctree │ ├── README.doctree │ ├── root.doctree │ ├── old │ │ ├── ssm.doctree │ │ └── ssm_old.doctree │ ├── environment.pickle │ └── chapters │ │ ├── blank.doctree │ │ ├── hmm │ │ ├── hmm.doctree │ │ ├── hmm_filter.doctree │ │ ├── hmm_index.doctree │ │ ├── hmm_parallel.doctree │ │ ├── hmm_sampling.doctree │ │ ├── hmm_smoother.doctree │ │ └── hmm_viterbi.doctree │ │ ├── scratch.doctree │ │ ├── ssm │ │ ├── hmm.doctree │ │ ├── lds.doctree │ │ ├── ssm.doctree │ │ ├── nlds.doctree │ │ ├── learning.doctree │ │ ├── ssm_old.doctree │ │ ├── inference.doctree │ │ ├── ssm_index.doctree │ │ └── ssm_intro.doctree │ │ ├── gp │ │ └── gp_index.doctree │ │ ├── learning │ │ ├── em.doctree │ │ ├── sgd.doctree │ │ ├── vb.doctree │ │ ├── mcmc.doctree │ │ └── learning_index.doctree │ │ ├── pf │ │ └── pf_index.doctree │ │ ├── scratchpad.doctree │ │ ├── vi │ │ └── vi_index.doctree │ │ ├── adf │ │ └── adf_index.doctree │ │ ├── bnp │ │ └── bnp_index.doctree │ │ ├── ode │ │ └── ode_index.doctree │ │ ├── smc │ │ └── smc_index.doctree │ │ ├── lgssm │ │ ├── lgssm_index.doctree │ │ ├── kalman_filter.doctree │ │ ├── kalman_parallel.doctree │ │ ├── kalman_sampling.doctree │ │ └── kalman_smoother.doctree │ │ ├── control │ │ └── control_index.doctree │ │ ├── postlin │ │ └── postlin_index.doctree │ │ ├── ensemble │ │ └── ensemble_index.doctree │ │ ├── extended │ │ ├── extended_filter.doctree │ │ ├── extended_index.doctree │ │ ├── extended_parallel.doctree │ │ └── extended_smoother.doctree │ │ ├── tracking │ │ └── tracking_index.doctree │ │ ├── quadrature │ │ └── quadrature_index.doctree │ │ ├── timeseries │ │ └── timeseries_index.doctree │ │ ├── unscented │ │ ├── unscented_filter.doctree │ │ ├── unscented_index.doctree │ │ └── unscented_smoother.doctree │ │ └── changepoint │ │ └── changepoint_index.doctree └── jupyter_execute │ ├── chapters │ ├── lgssm │ │ ├── kalman_filter.py │ │ ├── kalman_smoother.py │ │ ├── kalman_sampling.py │ │ ├── kalman_parallel.py │ │ ├── kalman_filter.ipynb │ │ ├── kalman_smoother.ipynb │ │ ├── kalman_sampling.ipynb │ │ └── kalman_parallel.ipynb │ ├── hmm │ │ ├── hmm_viterbi.py │ │ ├── hmm_sampling.py │ │ ├── hmm_parallel.py │ │ ├── hmm_smoother.py │ │ ├── hmm_viterbi.ipynb │ │ ├── hmm_sampling.ipynb │ │ ├── hmm_parallel.ipynb │ │ └── hmm_smoother.ipynb │ ├── unscented │ │ ├── unscented_filter.py │ │ ├── unscented_smoother.py │ │ ├── unscented_filter.ipynb │ │ └── unscented_smoother.ipynb │ ├── extended │ │ ├── extended_filter.py │ │ ├── extended_smoother.py │ │ ├── extended_parallel.py │ │ ├── extended_filter.ipynb │ │ ├── extended_smoother.ipynb │ │ └── extended_parallel.ipynb │ ├── scratch_2_0.png │ ├── ssm │ │ ├── hmm_14_0.png │ │ ├── hmm_15_0.png │ │ ├── hmm_15_1.png │ │ ├── hmm_16_1.png │ │ ├── hmm_17_0.png │ │ ├── hmm_18_1.png │ │ ├── lds_5_1.png │ │ ├── lds_6_1.png │ │ ├── lds_7_1.png │ │ ├── ssm_15_0.png │ │ ├── ssm_16_1.png │ │ ├── ssm_18_1.png │ │ ├── ssm_19_1.png │ │ ├── ssm_20_1.png │ │ ├── ssm_21_1.png │ │ ├── ssm_24_1.png │ │ ├── ssm_25_1.png │ │ ├── ssm_29_1.png │ │ ├── ssm_30_1.png │ │ ├── ssm_31_1.png │ │ ├── inference_7_1.png │ │ ├── inference_8_1.png │ │ ├── inference_9_1.png │ │ ├── ssm_old_15_0.png │ │ ├── ssm_old_16_1.png │ │ ├── ssm_old_21_1.png │ │ ├── ssm_old_30_1.png │ │ ├── ssm_old_31_1.png │ │ ├── inference_10_1.png │ │ ├── inference_11_1.png │ │ ├── inference_14_1.png │ │ ├── inference_15_1.png │ │ ├── inference_16_1.png │ │ ├── inference_17_1.png │ │ ├── learning.py │ │ ├── ssm_intro.py │ │ ├── learning.ipynb │ │ ├── ssm_intro.ipynb │ │ └── nlds.py │ ├── learning │ │ ├── vb.py │ │ ├── mcmc.py │ │ ├── sgd.py │ │ ├── em.py │ │ ├── mcmc.ipynb │ │ ├── sgd.ipynb │ │ ├── vb.ipynb │ │ └── em.ipynb │ ├── blank.py │ ├── blank.ipynb │ ├── scratch.py │ └── scratchpad.py │ └── old │ ├── ssm_15_0.png │ ├── ssm_16_1.png │ ├── ssm_21_1.png │ ├── ssm_30_1.png │ ├── ssm_31_1.png │ ├── ssm_old_15_0.png │ ├── ssm_old_16_1.png │ ├── ssm_old_21_1.png │ ├── ssm_old_30_1.png │ └── ssm_old_31_1.png ├── requirements.txt ├── bib.md ├── .DS_Store ├── .vscode └── settings.json ├── figures ├── .DS_Store ├── casino.png ├── cat_dog.jpg ├── pendulum.png ├── SSM-AR-inputs.png ├── SSM-simplified.png ├── hmmDgmPlatesY.png ├── dbn-inference-problems.png └── inference-problems-tikz.png ├── chapters ├── pf │ └── pf_index.md ├── lgssm │ ├── lgssm_index.md │ ├── kalman_filter.ipynb │ ├── kalman_smoother.ipynb │ ├── kalman_sampling.ipynb │ └── kalman_parallel.ipynb ├── bnp │ └── bnp_index.md ├── unscented │ ├── unscented_index.md │ ├── unscented_filter.ipynb │ └── unscented_smoother.ipynb ├── extended │ ├── extended_index.md │ ├── extended_filter.ipynb │ ├── extended_smoother.ipynb │ └── extended_parallel.ipynb ├── adf │ └── adf_index.md ├── gp │ └── gp_index.md ├── learning │ └── learning_index.md ├── tracking │ └── tracking_index.md ├── timeseries │ └── timeseries_index.md ├── quadrature │ └── quadrature_index.md ├── smc │ └── smc_index.md ├── ssm │ ├── ssm_index.md │ ├── learning.ipynb │ └── ssm_intro.ipynb ├── vi │ └── vi_index.md ├── ensemble │ └── ensemble_index.md ├── ode │ └── ode_index.md ├── postlin │ └── postlin_index.md ├── control │ └── control_index.md ├── changepoint │ └── changepoint_index.md ├── hmm │ ├── hmm_index.md │ ├── hmm_viterbi.ipynb │ ├── hmm_sampling.ipynb │ ├── hmm_parallel.ipynb │ └── hmm_smoother.ipynb ├── intro.md~ └── scratch.md ├── root.md ├── LICENSE ├── README.md ├── _toc.yml └── _config.yml /_build/html/_static/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_build/.doctrees/glue_cache.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | jupyter-book 2 | matplotlib 3 | numpy 4 | -------------------------------------------------------------------------------- /bib.md: -------------------------------------------------------------------------------- 1 | # Bibliography 2 | 3 | 4 | ```{bibliography} 5 | ``` 6 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/.DS_Store -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.formatting.provider": "black" 3 | } -------------------------------------------------------------------------------- /_build/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /_build/html/_sources/bib.md: -------------------------------------------------------------------------------- 1 | # Bibliography 2 | 3 | 4 | ```{bibliography} 5 | ``` 6 | -------------------------------------------------------------------------------- /figures/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/figures/.DS_Store -------------------------------------------------------------------------------- /figures/casino.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/figures/casino.png -------------------------------------------------------------------------------- /figures/cat_dog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/figures/cat_dog.jpg -------------------------------------------------------------------------------- /figures/pendulum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/figures/pendulum.png -------------------------------------------------------------------------------- /_build/html/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/objects.inv -------------------------------------------------------------------------------- /figures/SSM-AR-inputs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/figures/SSM-AR-inputs.png -------------------------------------------------------------------------------- /figures/SSM-simplified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/figures/SSM-simplified.png -------------------------------------------------------------------------------- /figures/hmmDgmPlatesY.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/figures/hmmDgmPlatesY.png -------------------------------------------------------------------------------- /_build/.doctrees/bib.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/bib.doctree -------------------------------------------------------------------------------- /_build/html/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_static/file.png -------------------------------------------------------------------------------- /_build/html/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_static/plus.png -------------------------------------------------------------------------------- /_build/.doctrees/README.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/README.doctree -------------------------------------------------------------------------------- /_build/.doctrees/root.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/root.doctree -------------------------------------------------------------------------------- /_build/html/_images/casino.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/casino.png -------------------------------------------------------------------------------- /_build/html/_images/cat_dog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/cat_dog.jpg -------------------------------------------------------------------------------- /_build/html/_images/lds_5_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/lds_5_1.png -------------------------------------------------------------------------------- /_build/html/_images/lds_6_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/lds_6_1.png -------------------------------------------------------------------------------- /_build/html/_images/lds_7_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/lds_7_1.png -------------------------------------------------------------------------------- /_build/html/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_static/minus.png -------------------------------------------------------------------------------- /chapters/pf/pf_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:PF)= 4 | # Particle filtering 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /_build/.doctrees/old/ssm.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/old/ssm.doctree -------------------------------------------------------------------------------- /_build/html/_images/hmm_14_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/hmm_14_0.png -------------------------------------------------------------------------------- /_build/html/_images/hmm_15_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/hmm_15_0.png -------------------------------------------------------------------------------- /_build/html/_images/hmm_15_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/hmm_15_1.png -------------------------------------------------------------------------------- /_build/html/_images/hmm_16_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/hmm_16_1.png -------------------------------------------------------------------------------- /_build/html/_images/hmm_17_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/hmm_17_0.png -------------------------------------------------------------------------------- /_build/html/_images/hmm_18_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/hmm_18_1.png -------------------------------------------------------------------------------- /_build/html/_images/pendulum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/pendulum.png -------------------------------------------------------------------------------- /_build/html/_images/ssm_15_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/ssm_15_0.png -------------------------------------------------------------------------------- /_build/html/_images/ssm_16_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/ssm_16_1.png -------------------------------------------------------------------------------- /_build/html/_images/ssm_18_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/ssm_18_1.png -------------------------------------------------------------------------------- /_build/html/_images/ssm_19_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/ssm_19_1.png -------------------------------------------------------------------------------- /_build/html/_images/ssm_20_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/ssm_20_1.png -------------------------------------------------------------------------------- /_build/html/_images/ssm_21_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/ssm_21_1.png -------------------------------------------------------------------------------- /_build/html/_images/ssm_24_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/ssm_24_1.png -------------------------------------------------------------------------------- /_build/html/_images/ssm_25_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/ssm_25_1.png -------------------------------------------------------------------------------- /_build/html/_images/ssm_29_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/ssm_29_1.png -------------------------------------------------------------------------------- /_build/html/_images/ssm_30_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/ssm_30_1.png -------------------------------------------------------------------------------- /_build/html/_images/ssm_31_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/ssm_31_1.png -------------------------------------------------------------------------------- /chapters/lgssm/lgssm_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:lgssm)= 4 | # Linear-Gaussian SSMs 5 | 6 | ```{tableofcontents} 7 | ``` -------------------------------------------------------------------------------- /_build/.doctrees/environment.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/environment.pickle -------------------------------------------------------------------------------- /_build/.doctrees/old/ssm_old.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/old/ssm_old.doctree -------------------------------------------------------------------------------- /_build/html/_images/scratch_2_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/scratch_2_0.png -------------------------------------------------------------------------------- /_build/html/_images/ssm_old_15_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/ssm_old_15_0.png -------------------------------------------------------------------------------- /_build/html/_images/ssm_old_16_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/ssm_old_16_1.png -------------------------------------------------------------------------------- /_build/html/_images/ssm_old_21_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/ssm_old_21_1.png -------------------------------------------------------------------------------- /_build/html/_images/ssm_old_30_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/ssm_old_30_1.png -------------------------------------------------------------------------------- /_build/html/_images/ssm_old_31_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/ssm_old_31_1.png -------------------------------------------------------------------------------- /chapters/bnp/bnp_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:BNP)= 4 | # Bayesian non-parametric SSMs 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /figures/dbn-inference-problems.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/figures/dbn-inference-problems.png -------------------------------------------------------------------------------- /figures/inference-problems-tikz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/figures/inference-problems-tikz.png -------------------------------------------------------------------------------- /_build/html/_images/SSM-AR-inputs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/SSM-AR-inputs.png -------------------------------------------------------------------------------- /_build/html/_images/SSM-simplified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/SSM-simplified.png -------------------------------------------------------------------------------- /_build/html/_images/hmmDgmPlatesY.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/hmmDgmPlatesY.png -------------------------------------------------------------------------------- /_build/html/_images/inference_10_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/inference_10_1.png -------------------------------------------------------------------------------- /_build/html/_images/inference_11_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/inference_11_1.png -------------------------------------------------------------------------------- /_build/html/_images/inference_14_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/inference_14_1.png -------------------------------------------------------------------------------- /_build/html/_images/inference_15_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/inference_15_1.png -------------------------------------------------------------------------------- /_build/html/_images/inference_16_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/inference_16_1.png -------------------------------------------------------------------------------- /_build/html/_images/inference_17_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/inference_17_1.png -------------------------------------------------------------------------------- /_build/html/_images/inference_7_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/inference_7_1.png -------------------------------------------------------------------------------- /_build/html/_images/inference_8_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/inference_8_1.png -------------------------------------------------------------------------------- /_build/html/_images/inference_9_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/inference_9_1.png -------------------------------------------------------------------------------- /chapters/unscented/unscented_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:unscented)= 4 | # Unscented methods 5 | 6 | ```{tableofcontents} 7 | ``` -------------------------------------------------------------------------------- /_build/.doctrees/chapters/blank.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/blank.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/hmm/hmm.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/hmm/hmm.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/scratch.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/scratch.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/ssm/hmm.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/ssm/hmm.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/ssm/lds.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/ssm/lds.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/ssm/ssm.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/ssm/ssm.doctree -------------------------------------------------------------------------------- /_build/html/_sources/chapters/pf/pf_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:PF)= 4 | # Particle filtering 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /_build/html/_static/images/logo_colab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_static/images/logo_colab.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/lgssm/kalman_filter.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # # Kalman filtering 5 | -------------------------------------------------------------------------------- /_build/jupyter_execute/old/ssm_15_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/old/ssm_15_0.png -------------------------------------------------------------------------------- /_build/jupyter_execute/old/ssm_16_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/old/ssm_16_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/old/ssm_21_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/old/ssm_21_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/old/ssm_30_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/old/ssm_30_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/old/ssm_31_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/old/ssm_31_1.png -------------------------------------------------------------------------------- /_build/.doctrees/chapters/ssm/nlds.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/ssm/nlds.doctree -------------------------------------------------------------------------------- /_build/html/_sources/chapters/lgssm/lgssm_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:lgssm)= 4 | # Linear-Gaussian SSMs 5 | 6 | ```{tableofcontents} 7 | ``` -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/hmm/hmm_viterbi.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # # Viterbi algorithm 5 | # 6 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/lgssm/kalman_smoother.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # # Kalman (RTS) smoother 5 | -------------------------------------------------------------------------------- /_build/jupyter_execute/old/ssm_old_15_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/old/ssm_old_15_0.png -------------------------------------------------------------------------------- /_build/jupyter_execute/old/ssm_old_16_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/old/ssm_old_16_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/old/ssm_old_21_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/old/ssm_old_21_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/old/ssm_old_30_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/old/ssm_old_30_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/old/ssm_old_31_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/old/ssm_old_31_1.png -------------------------------------------------------------------------------- /chapters/extended/extended_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:extended)= 4 | # Extended (linearized) methods 5 | 6 | ```{tableofcontents} 7 | ``` -------------------------------------------------------------------------------- /_build/.doctrees/chapters/gp/gp_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/gp/gp_index.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/learning/em.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/learning/em.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/learning/sgd.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/learning/sgd.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/learning/vb.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/learning/vb.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/pf/pf_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/pf/pf_index.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/scratchpad.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/scratchpad.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/ssm/learning.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/ssm/learning.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/ssm/ssm_old.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/ssm/ssm_old.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/vi/vi_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/vi/vi_index.doctree -------------------------------------------------------------------------------- /_build/html/_images/dbn-inference-problems.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/dbn-inference-problems.png -------------------------------------------------------------------------------- /_build/html/_sources/chapters/bnp/bnp_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:BNP)= 4 | # Bayesian non-parametric SSMs 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/unscented/unscented_filter.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # # Unscented filtering 5 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/unscented/unscented_smoother.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # # Unscented smoothing 5 | -------------------------------------------------------------------------------- /chapters/adf/adf_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:ADF)= 4 | # Assumed Density Filtering 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /chapters/gp/gp_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:GP)= 4 | # Markovian Gaussian processes 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /_build/.doctrees/chapters/adf/adf_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/adf/adf_index.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/bnp/bnp_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/bnp/bnp_index.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/hmm/hmm_filter.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/hmm/hmm_filter.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/hmm/hmm_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/hmm/hmm_index.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/learning/mcmc.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/learning/mcmc.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/ode/ode_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/ode/ode_index.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/smc/smc_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/smc/smc_index.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/ssm/inference.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/ssm/inference.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/ssm/ssm_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/ssm/ssm_index.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/ssm/ssm_intro.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/ssm/ssm_intro.doctree -------------------------------------------------------------------------------- /_build/html/_images/inference-problems-tikz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_images/inference-problems-tikz.png -------------------------------------------------------------------------------- /_build/html/_sources/chapters/unscented/unscented_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:unscented)= 4 | # Unscented methods 5 | 6 | ```{tableofcontents} 7 | ``` -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/extended/extended_filter.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # # Extended Kalman filtering 5 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/extended/extended_smoother.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # # Extended Kalman smoother 5 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/scratch_2_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/scratch_2_0.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/hmm_14_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/hmm_14_0.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/hmm_15_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/hmm_15_0.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/hmm_15_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/hmm_15_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/hmm_16_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/hmm_16_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/hmm_17_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/hmm_17_0.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/hmm_18_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/hmm_18_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/lds_5_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/lds_5_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/lds_6_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/lds_6_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/lds_7_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/lds_7_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/ssm_15_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/ssm_15_0.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/ssm_16_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/ssm_16_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/ssm_18_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/ssm_18_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/ssm_19_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/ssm_19_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/ssm_20_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/ssm_20_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/ssm_21_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/ssm_21_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/ssm_24_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/ssm_24_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/ssm_25_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/ssm_25_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/ssm_29_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/ssm_29_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/ssm_30_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/ssm_30_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/ssm_31_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/ssm_31_1.png -------------------------------------------------------------------------------- /chapters/learning/learning_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:learning)= 4 | # Offline parameter estimation (learning) 5 | 6 | ```{tableofcontents} 7 | ``` 8 | -------------------------------------------------------------------------------- /chapters/tracking/tracking_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:tracking)= 4 | # Multi-target tracking 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /_build/.doctrees/chapters/hmm/hmm_parallel.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/hmm/hmm_parallel.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/hmm/hmm_sampling.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/hmm/hmm_sampling.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/hmm/hmm_smoother.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/hmm/hmm_smoother.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/hmm/hmm_viterbi.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/hmm/hmm_viterbi.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/lgssm/lgssm_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/lgssm/lgssm_index.doctree -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/lgssm/kalman_sampling.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # # Forwards-filtering backwards sampling 5 | -------------------------------------------------------------------------------- /_build/.doctrees/chapters/lgssm/kalman_filter.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/lgssm/kalman_filter.doctree -------------------------------------------------------------------------------- /_build/html/_sources/chapters/extended/extended_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:extended)= 4 | # Extended (linearized) methods 5 | 6 | ```{tableofcontents} 7 | ``` -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/inference_7_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/inference_7_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/inference_8_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/inference_8_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/inference_9_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/inference_9_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/ssm_old_15_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/ssm_old_15_0.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/ssm_old_16_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/ssm_old_16_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/ssm_old_21_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/ssm_old_21_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/ssm_old_30_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/ssm_old_30_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/ssm_old_31_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/ssm_old_31_1.png -------------------------------------------------------------------------------- /chapters/timeseries/timeseries_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:timeseries)= 4 | # Timeseries forecasting 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /_build/.doctrees/chapters/control/control_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/control/control_index.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/lgssm/kalman_parallel.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/lgssm/kalman_parallel.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/lgssm/kalman_sampling.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/lgssm/kalman_sampling.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/lgssm/kalman_smoother.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/lgssm/kalman_smoother.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/postlin/postlin_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/postlin/postlin_index.doctree -------------------------------------------------------------------------------- /_build/html/_sources/chapters/adf/adf_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:ADF)= 4 | # Assumed Density Filtering 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/gp/gp_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:GP)= 4 | # Markovian Gaussian processes 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /_build/html/_static/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_static/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/inference_10_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/inference_10_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/inference_11_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/inference_11_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/inference_14_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/inference_14_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/inference_15_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/inference_15_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/inference_16_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/inference_16_1.png -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/inference_17_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/jupyter_execute/chapters/ssm/inference_17_1.png -------------------------------------------------------------------------------- /chapters/quadrature/quadrature_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:quadrature)= 4 | # Quadrature and cubature methods 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapters/smc/smc_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:SMC)= 4 | # Sequential Monte Carlo 5 | 6 | {cite}`Chopin2020` 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /_build/.doctrees/chapters/ensemble/ensemble_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/ensemble/ensemble_index.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/extended/extended_filter.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/extended/extended_filter.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/extended/extended_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/extended/extended_index.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/learning/learning_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/learning/learning_index.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/tracking/tracking_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/tracking/tracking_index.doctree -------------------------------------------------------------------------------- /_build/html/_sources/chapters/tracking/tracking_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:tracking)= 4 | # Multi-target tracking 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/hmm/hmm_sampling.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # # Forwards-filtering backwards-sampling algorithm 5 | # 6 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/learning/vb.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # 5 | # (sec:VB)= 6 | # # Variational Bayes (VB) 7 | # 8 | # 9 | -------------------------------------------------------------------------------- /_build/.doctrees/chapters/extended/extended_parallel.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/extended/extended_parallel.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/extended/extended_smoother.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/extended/extended_smoother.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/quadrature/quadrature_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/quadrature/quadrature_index.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/timeseries/timeseries_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/timeseries/timeseries_index.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/unscented/unscented_filter.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/unscented/unscented_filter.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/unscented/unscented_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/unscented/unscented_index.doctree -------------------------------------------------------------------------------- /_build/html/_sources/chapters/learning/learning_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:learning)= 4 | # Offline parameter estimation (learning) 5 | 6 | ```{tableofcontents} 7 | ``` 8 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/learning/mcmc.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # (sec:mcmc)= 5 | # # Markov Chain Monte Carlo (MCMC) 6 | # 7 | # 8 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/learning/sgd.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # (sec:sgd)= 5 | # # Stochastic Gradient Descent (SGD) 6 | # 7 | # 8 | -------------------------------------------------------------------------------- /_build/.doctrees/chapters/changepoint/changepoint_index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/changepoint/changepoint_index.doctree -------------------------------------------------------------------------------- /_build/.doctrees/chapters/unscented/unscented_smoother.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/.doctrees/chapters/unscented/unscented_smoother.doctree -------------------------------------------------------------------------------- /_build/html/_sources/chapters/quadrature/quadrature_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:quadrature)= 4 | # Quadrature and cubature methods 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/smc/smc_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:SMC)= 4 | # Sequential Monte Carlo 5 | 6 | {cite}`Chopin2020` 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/timeseries/timeseries_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:timeseries)= 4 | # Timeseries forecasting 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /chapters/ssm/ssm_index.md: -------------------------------------------------------------------------------- 1 | (ch:ssm)= 2 | # State Space Models 3 | 4 | This chapter introduces state space models (SSMs). 5 | 6 | 7 | 8 | ```{tableofcontents} 9 | ``` 10 | 11 | -------------------------------------------------------------------------------- /_build/html/_static/css/blank.css: -------------------------------------------------------------------------------- 1 | /* This file is intentionally left blank to override the stylesheet of the 2 | parent theme via theme.conf. The parent style we import directly in theme.css */ -------------------------------------------------------------------------------- /_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.eot -------------------------------------------------------------------------------- /_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/learning/em.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # (sec:em)= 5 | # # Expectation Maximization (EM) 6 | # 7 | # {cite}`Ghahramani96a` 8 | # 9 | -------------------------------------------------------------------------------- /chapters/vi/vi_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:VI)= 4 | # Variational inference 5 | 6 | {cite}`BayesNewton`, 7 | {cite}`Courts2020`, {cite}`Courts2021` 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.eot -------------------------------------------------------------------------------- /_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff -------------------------------------------------------------------------------- /_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.eot -------------------------------------------------------------------------------- /_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff -------------------------------------------------------------------------------- /_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/hmm/hmm_parallel.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # # Parallel HMM smoothing 5 | # 6 | # {cite}`Hassan2021` 7 | # 8 | # 9 | # 10 | -------------------------------------------------------------------------------- /_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.woff -------------------------------------------------------------------------------- /_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/probml/ssm-book/main/_build/html/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.woff2 -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/extended/extended_parallel.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # # Parallel extended Kalman smoothing 5 | # 6 | # {cite}`Sarkka2020icassp` 7 | # 8 | -------------------------------------------------------------------------------- /chapters/ensemble/ensemble_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:ensemble)= 4 | # Data assimilation using Ensemble Kalman filter 5 | 6 | 7 | {cite}`Evensen2009`, {cite}`Roth2017enkf` 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /chapters/ode/ode_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:ODE)= 4 | # Differential equations and SSMs 5 | 6 | 7 | {cite}`Tronarp2019`, {cite}`Sarkka2019book`, {cite}`HennigBook` 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/ssm/ssm_index.md: -------------------------------------------------------------------------------- 1 | (ch:ssm)= 2 | # State Space Models 3 | 4 | This chapter introduces state space models (SSMs). 5 | 6 | 7 | 8 | ```{tableofcontents} 9 | ``` 10 | 11 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/vi/vi_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:VI)= 4 | # Variational inference 5 | 6 | {cite}`BayesNewton`, 7 | {cite}`Courts2020`, {cite}`Courts2021` 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/lgssm/kalman_parallel.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # # Parallel Kalman Smoother 5 | # 6 | # {cite}`Sarkka2021` 7 | # 8 | # 9 | # 10 | # 11 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/ensemble/ensemble_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:ensemble)= 4 | # Data assimilation using Ensemble Kalman filter 5 | 6 | 7 | {cite}`Evensen2009`, {cite}`Roth2017enkf` 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /chapters/postlin/postlin_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:postlin)= 4 | # Posterior linearization 5 | 6 | 7 | {cite}`Garcia-Fernandez2017`, {cite}`Tronarp2018`, {cite}`Garcia-Fernandez2019` 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /_build/html/_sources/README.md: -------------------------------------------------------------------------------- 1 | # ssm-book 2 | Interactive textbook on state-space models. 3 | The rendered content can be found at [https://probml.github.io/ssm-book/root.html](https://probml.github.io/ssm-book/root.html). 4 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/ode/ode_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:ODE)= 4 | # Differential equations and SSMs 5 | 6 | 7 | {cite}`Tronarp2019`, {cite}`Sarkka2019book`, {cite}`HennigBook` 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/blank.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # (chap:my-chap)= 5 | # # Chapter title 6 | # 7 | # 8 | 9 | # In[1]: 10 | 11 | 12 | print(42) 13 | 14 | 15 | # 16 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/postlin/postlin_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:postlin)= 4 | # Posterior linearization 5 | 6 | 7 | {cite}`Garcia-Fernandez2017`, {cite}`Tronarp2018`, {cite}`Garcia-Fernandez2019` 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapters/control/control_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:control)= 4 | # Optimal control 5 | 6 | 7 | {cite}`Botvinick2012`, {cite}`Kappen2012`, {cite}`Rawlik2012` 8 | 9 | ## LQR 10 | 11 | ## MPC 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /_build/html/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: 70a1b193a2154c8b9a08d7b32062e5d6 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/control/control_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:control)= 4 | # Optimal control 5 | 6 | 7 | {cite}`Botvinick2012`, {cite}`Kappen2012`, {cite}`Rawlik2012` 8 | 9 | ## LQR 10 | 11 | ## MPC 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/hmm/hmm_smoother.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # # HMM smoothing (forwards-backwards algorithm) 5 | # 6 | 7 | # ## Forwards filter, backwards smoother algorithm 8 | 9 | # ## Two-filter algorithm 10 | 11 | # 12 | -------------------------------------------------------------------------------- /chapters/changepoint/changepoint_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:changepoint)= 4 | # Changepoint detection 5 | 6 | 7 | 8 | {cite}`Agudelo-Espana2020`, {cite}`Adams2007`, {cite}`Fearnhead04`, {cite}`Fearnhead06`, {cite}`Fearnhead07`, 9 | {cite}`Fearnhead11` 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /chapters/hmm/hmm_index.md: -------------------------------------------------------------------------------- 1 | (ch:hmm)= 2 | # Hidden Markov Models 3 | 4 | This chapter discusses Hidden Markov Models (HMMs), which are state space models 5 | in which the latent state $\hidden_t \in \{1,\ldots,\nstates\}$ is discrete. 6 | 7 | 8 | ```{tableofcontents} 9 | ``` 10 | 11 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/changepoint/changepoint_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (ch:changepoint)= 4 | # Changepoint detection 5 | 6 | 7 | 8 | {cite}`Agudelo-Espana2020`, {cite}`Adams2007`, {cite}`Fearnhead04`, {cite}`Fearnhead06`, {cite}`Fearnhead07`, 9 | {cite}`Fearnhead11` 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/hmm/hmm_index.md: -------------------------------------------------------------------------------- 1 | (ch:hmm)= 2 | # Hidden Markov Models 3 | 4 | This chapter discusses Hidden Markov Models (HMMs), which are state space models 5 | in which the latent state $\hidden_t \in \{1,\ldots,\nstates\}$ is discrete. 6 | 7 | 8 | ```{tableofcontents} 9 | ``` 10 | 11 | -------------------------------------------------------------------------------- /_build/html/_static/panels-variables.06eb56fa6e07937060861dad626602ad.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --tabs-color-label-active: hsla(231, 99%, 66%, 1); 3 | --tabs-color-label-inactive: rgba(178, 206, 245, 0.62); 4 | --tabs-color-overline: rgb(207, 236, 238); 5 | --tabs-color-underline: rgb(207, 236, 238); 6 | --tabs-size-label: 1rem; 7 | } -------------------------------------------------------------------------------- /_build/html/_panels_static/panels-variables.06eb56fa6e07937060861dad626602ad.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --tabs-color-label-active: hsla(231, 99%, 66%, 1); 3 | --tabs-color-label-inactive: rgba(178, 206, 245, 0.62); 4 | --tabs-color-overline: rgb(207, 236, 238); 5 | --tabs-color-underline: rgb(207, 236, 238); 6 | --tabs-size-label: 1rem; 7 | } -------------------------------------------------------------------------------- /_build/html/_static/check-solid.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /_build/html/_static/copy-button.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /_build/html/_static/documentation_options.js: -------------------------------------------------------------------------------- 1 | var DOCUMENTATION_OPTIONS = { 2 | URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), 3 | VERSION: '', 4 | LANGUAGE: 'None', 5 | COLLAPSE_INDEX: false, 6 | BUILDER: 'html', 7 | FILE_SUFFIX: '.html', 8 | LINK_SUFFIX: '.html', 9 | HAS_SOURCE: true, 10 | SOURCELINK_SUFFIX: '', 11 | NAVIGATION_WITH_KEYS: true, 12 | SHOW_SEARCH_SUMMARY: true, 13 | ENABLE_SEARCH_SHORTCUTS: true, 14 | }; -------------------------------------------------------------------------------- /root.md: -------------------------------------------------------------------------------- 1 | # State Space Models: A Modern Approach 2 | 3 | This is an interactive textbook on state space models (SSM) 4 | using the [JAX Python library](https://github.com/google/jax). 5 | Some of the content is covered in other books 6 | such as {cite}`Sarkka13` and {cite}`vol2`. 7 | However, we go into more detail, and focus on how to efficiently 8 | implement the various algorithms in a "modern" computing environment, 9 | exploiting recent progress 10 | in automatic differentiation and parallel computing. 11 | 12 | 13 | ```{tableofcontents} 14 | ``` 15 | -------------------------------------------------------------------------------- /_build/html/_sources/root.md: -------------------------------------------------------------------------------- 1 | # State Space Models: A Modern Approach 2 | 3 | This is an interactive textbook on state space models (SSM) 4 | using the [JAX Python library](https://github.com/google/jax). 5 | Some of the content is covered in other books 6 | such as {cite}`Sarkka13` and {cite}`vol2`. 7 | However, we go into more detail, and focus on how to efficiently 8 | implement the various algorithms in a "modern" computing environment, 9 | exploiting recent progress 10 | in automatic differentiation and parallel computing. 11 | 12 | 13 | ```{tableofcontents} 14 | ``` 15 | -------------------------------------------------------------------------------- /chapters/hmm/hmm_viterbi.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Viterbi algorithm\n" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } 33 | -------------------------------------------------------------------------------- /chapters/lgssm/kalman_filter.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Kalman filtering" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } 33 | -------------------------------------------------------------------------------- /chapters/lgssm/kalman_smoother.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Kalman (RTS) smoother" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } 33 | -------------------------------------------------------------------------------- /chapters/unscented/unscented_filter.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Unscented filtering" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } 33 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/hmm/hmm_viterbi.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Viterbi algorithm\n" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } -------------------------------------------------------------------------------- /chapters/extended/extended_filter.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Extended Kalman filtering" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } 33 | -------------------------------------------------------------------------------- /chapters/extended/extended_smoother.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Extended Kalman smoother" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } 33 | -------------------------------------------------------------------------------- /chapters/unscented/unscented_smoother.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Unscented smoothing" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } 33 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/hmm/hmm_viterbi.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Viterbi algorithm\n" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } 33 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/lgssm/kalman_filter.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Kalman filtering" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } 33 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/lgssm/kalman_filter.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Kalman filtering" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/lgssm/kalman_smoother.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Kalman (RTS) smoother" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } -------------------------------------------------------------------------------- /chapters/lgssm/kalman_sampling.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Forwards-filtering backwards sampling" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } 33 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/lgssm/kalman_smoother.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Kalman (RTS) smoother" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } 33 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/unscented/unscented_filter.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Unscented filtering" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } 33 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/extended/extended_filter.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Extended Kalman filtering" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/unscented/unscented_filter.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Unscented filtering" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/unscented/unscented_smoother.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Unscented smoothing" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } -------------------------------------------------------------------------------- /chapters/hmm/hmm_sampling.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Forwards-filtering backwards-sampling algorithm\n" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } 33 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/extended/extended_filter.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Extended Kalman filtering" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } 33 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/extended/extended_smoother.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Extended Kalman smoother" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } 33 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/unscented/unscented_smoother.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Unscented smoothing" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } 33 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/extended/extended_smoother.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Extended Kalman smoother" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/lgssm/kalman_sampling.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Forwards-filtering backwards sampling" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } -------------------------------------------------------------------------------- /_build/html/_sources/chapters/lgssm/kalman_sampling.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Forwards-filtering backwards sampling" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } 33 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/hmm/hmm_sampling.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Forwards-filtering backwards-sampling algorithm\n" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } 33 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/hmm/hmm_sampling.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Forwards-filtering backwards-sampling algorithm\n" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.5" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 4 32 | } -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/learning/mcmc.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "(sec:mcmc)=\n", 8 | "# Markov Chain Monte Carlo (MCMC)\n", 9 | "\n" 10 | ] 11 | } 12 | ], 13 | "metadata": { 14 | "kernelspec": { 15 | "display_name": "Python 3", 16 | "language": "python", 17 | "name": "python3" 18 | }, 19 | "language_info": { 20 | "codemirror_mode": { 21 | "name": "ipython", 22 | "version": 3 23 | }, 24 | "file_extension": ".py", 25 | "mimetype": "text/x-python", 26 | "name": "python", 27 | "nbconvert_exporter": "python", 28 | "pygments_lexer": "ipython3", 29 | "version": "3.8.8" 30 | } 31 | }, 32 | "nbformat": 4, 33 | "nbformat_minor": 4 34 | } -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/learning/sgd.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "(sec:sgd)=\n", 8 | "# Stochastic Gradient Descent (SGD)\n", 9 | "\n" 10 | ] 11 | } 12 | ], 13 | "metadata": { 14 | "kernelspec": { 15 | "display_name": "Python 3", 16 | "language": "python", 17 | "name": "python3" 18 | }, 19 | "language_info": { 20 | "codemirror_mode": { 21 | "name": "ipython", 22 | "version": 3 23 | }, 24 | "file_extension": ".py", 25 | "mimetype": "text/x-python", 26 | "name": "python", 27 | "nbconvert_exporter": "python", 28 | "pygments_lexer": "ipython3", 29 | "version": "3.8.8" 30 | } 31 | }, 32 | "nbformat": 4, 33 | "nbformat_minor": 4 34 | } -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/learning/vb.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "(sec:VB)=\n", 9 | "# Variational Bayes (VB)\n", 10 | "\n" 11 | ] 12 | } 13 | ], 14 | "metadata": { 15 | "kernelspec": { 16 | "display_name": "Python 3", 17 | "language": "python", 18 | "name": "python3" 19 | }, 20 | "language_info": { 21 | "codemirror_mode": { 22 | "name": "ipython", 23 | "version": 3 24 | }, 25 | "file_extension": ".py", 26 | "mimetype": "text/x-python", 27 | "name": "python", 28 | "nbconvert_exporter": "python", 29 | "pygments_lexer": "ipython3", 30 | "version": "3.8.8" 31 | } 32 | }, 33 | "nbformat": 4, 34 | "nbformat_minor": 4 35 | } -------------------------------------------------------------------------------- /_build/html/_sources/chapters/learning/mcmc.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "(sec:mcmc)=\n", 8 | "# Markov Chain Monte Carlo (MCMC)\n", 9 | "\n" 10 | ] 11 | } 12 | ], 13 | "metadata": { 14 | "kernelspec": { 15 | "display_name": "Python 3", 16 | "language": "python", 17 | "name": "python3" 18 | }, 19 | "language_info": { 20 | "codemirror_mode": { 21 | "name": "ipython", 22 | "version": 3 23 | }, 24 | "file_extension": ".py", 25 | "mimetype": "text/x-python", 26 | "name": "python", 27 | "nbconvert_exporter": "python", 28 | "pygments_lexer": "ipython3", 29 | "version": "3.8.8" 30 | } 31 | }, 32 | "nbformat": 4, 33 | "nbformat_minor": 4 34 | } 35 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/learning/sgd.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "(sec:sgd)=\n", 8 | "# Stochastic Gradient Descent (SGD)\n", 9 | "\n" 10 | ] 11 | } 12 | ], 13 | "metadata": { 14 | "kernelspec": { 15 | "display_name": "Python 3", 16 | "language": "python", 17 | "name": "python3" 18 | }, 19 | "language_info": { 20 | "codemirror_mode": { 21 | "name": "ipython", 22 | "version": 3 23 | }, 24 | "file_extension": ".py", 25 | "mimetype": "text/x-python", 26 | "name": "python", 27 | "nbconvert_exporter": "python", 28 | "pygments_lexer": "ipython3", 29 | "version": "3.8.8" 30 | } 31 | }, 32 | "nbformat": 4, 33 | "nbformat_minor": 4 34 | } 35 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/learning/vb.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\n", 8 | "(sec:VB)=\n", 9 | "# Variational Bayes (VB)\n", 10 | "\n" 11 | ] 12 | } 13 | ], 14 | "metadata": { 15 | "kernelspec": { 16 | "display_name": "Python 3", 17 | "language": "python", 18 | "name": "python3" 19 | }, 20 | "language_info": { 21 | "codemirror_mode": { 22 | "name": "ipython", 23 | "version": 3 24 | }, 25 | "file_extension": ".py", 26 | "mimetype": "text/x-python", 27 | "name": "python", 28 | "nbconvert_exporter": "python", 29 | "pygments_lexer": "ipython3", 30 | "version": "3.8.8" 31 | } 32 | }, 33 | "nbformat": 4, 34 | "nbformat_minor": 4 35 | } 36 | -------------------------------------------------------------------------------- /chapters/extended/extended_parallel.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Parallel extended Kalman smoothing\n", 8 | "\n", 9 | "{cite}`Sarkka2020icassp`\n" 10 | ] 11 | } 12 | ], 13 | "metadata": { 14 | "kernelspec": { 15 | "display_name": "Python 3", 16 | "language": "python", 17 | "name": "python3" 18 | }, 19 | "language_info": { 20 | "codemirror_mode": { 21 | "name": "ipython", 22 | "version": 3 23 | }, 24 | "file_extension": ".py", 25 | "mimetype": "text/x-python", 26 | "name": "python", 27 | "nbconvert_exporter": "python", 28 | "pygments_lexer": "ipython3", 29 | "version": "3.8.5" 30 | } 31 | }, 32 | "nbformat": 4, 33 | "nbformat_minor": 4 34 | } 35 | -------------------------------------------------------------------------------- /chapters/hmm/hmm_parallel.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Parallel HMM smoothing\n", 8 | "\n", 9 | "{cite}`Hassan2021`\n", 10 | "\n", 11 | "\n" 12 | ] 13 | } 14 | ], 15 | "metadata": { 16 | "kernelspec": { 17 | "display_name": "Python 3", 18 | "language": "python", 19 | "name": "python3" 20 | }, 21 | "language_info": { 22 | "codemirror_mode": { 23 | "name": "ipython", 24 | "version": 3 25 | }, 26 | "file_extension": ".py", 27 | "mimetype": "text/x-python", 28 | "name": "python", 29 | "nbconvert_exporter": "python", 30 | "pygments_lexer": "ipython3", 31 | "version": "3.8.5" 32 | } 33 | }, 34 | "nbformat": 4, 35 | "nbformat_minor": 4 36 | } 37 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/extended/extended_parallel.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Parallel extended Kalman smoothing\n", 8 | "\n", 9 | "{cite}`Sarkka2020icassp`\n" 10 | ] 11 | } 12 | ], 13 | "metadata": { 14 | "kernelspec": { 15 | "display_name": "Python 3", 16 | "language": "python", 17 | "name": "python3" 18 | }, 19 | "language_info": { 20 | "codemirror_mode": { 21 | "name": "ipython", 22 | "version": 3 23 | }, 24 | "file_extension": ".py", 25 | "mimetype": "text/x-python", 26 | "name": "python", 27 | "nbconvert_exporter": "python", 28 | "pygments_lexer": "ipython3", 29 | "version": "3.8.5" 30 | } 31 | }, 32 | "nbformat": 4, 33 | "nbformat_minor": 4 34 | } -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/hmm/hmm_parallel.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Parallel HMM smoothing\n", 8 | "\n", 9 | "{cite}`Hassan2021`\n", 10 | "\n", 11 | "\n" 12 | ] 13 | } 14 | ], 15 | "metadata": { 16 | "kernelspec": { 17 | "display_name": "Python 3", 18 | "language": "python", 19 | "name": "python3" 20 | }, 21 | "language_info": { 22 | "codemirror_mode": { 23 | "name": "ipython", 24 | "version": 3 25 | }, 26 | "file_extension": ".py", 27 | "mimetype": "text/x-python", 28 | "name": "python", 29 | "nbconvert_exporter": "python", 30 | "pygments_lexer": "ipython3", 31 | "version": "3.8.5" 32 | } 33 | }, 34 | "nbformat": 4, 35 | "nbformat_minor": 4 36 | } -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/learning/em.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "(sec:em)=\n", 8 | "# Expectation Maximization (EM)\n", 9 | "\n", 10 | "{cite}`Ghahramani96a`\n" 11 | ] 12 | } 13 | ], 14 | "metadata": { 15 | "kernelspec": { 16 | "display_name": "Python 3", 17 | "language": "python", 18 | "name": "python3" 19 | }, 20 | "language_info": { 21 | "codemirror_mode": { 22 | "name": "ipython", 23 | "version": 3 24 | }, 25 | "file_extension": ".py", 26 | "mimetype": "text/x-python", 27 | "name": "python", 28 | "nbconvert_exporter": "python", 29 | "pygments_lexer": "ipython3", 30 | "version": "3.8.8" 31 | } 32 | }, 33 | "nbformat": 4, 34 | "nbformat_minor": 4 35 | } -------------------------------------------------------------------------------- /_build/html/_sources/chapters/extended/extended_parallel.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Parallel extended Kalman smoothing\n", 8 | "\n", 9 | "{cite}`Sarkka2020icassp`\n" 10 | ] 11 | } 12 | ], 13 | "metadata": { 14 | "kernelspec": { 15 | "display_name": "Python 3", 16 | "language": "python", 17 | "name": "python3" 18 | }, 19 | "language_info": { 20 | "codemirror_mode": { 21 | "name": "ipython", 22 | "version": 3 23 | }, 24 | "file_extension": ".py", 25 | "mimetype": "text/x-python", 26 | "name": "python", 27 | "nbconvert_exporter": "python", 28 | "pygments_lexer": "ipython3", 29 | "version": "3.8.5" 30 | } 31 | }, 32 | "nbformat": 4, 33 | "nbformat_minor": 4 34 | } 35 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/hmm/hmm_parallel.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Parallel HMM smoothing\n", 8 | "\n", 9 | "{cite}`Hassan2021`\n", 10 | "\n", 11 | "\n" 12 | ] 13 | } 14 | ], 15 | "metadata": { 16 | "kernelspec": { 17 | "display_name": "Python 3", 18 | "language": "python", 19 | "name": "python3" 20 | }, 21 | "language_info": { 22 | "codemirror_mode": { 23 | "name": "ipython", 24 | "version": 3 25 | }, 26 | "file_extension": ".py", 27 | "mimetype": "text/x-python", 28 | "name": "python", 29 | "nbconvert_exporter": "python", 30 | "pygments_lexer": "ipython3", 31 | "version": "3.8.5" 32 | } 33 | }, 34 | "nbformat": 4, 35 | "nbformat_minor": 4 36 | } 37 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/learning/em.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "(sec:em)=\n", 8 | "# Expectation Maximization (EM)\n", 9 | "\n", 10 | "{cite}`Ghahramani96a`\n" 11 | ] 12 | } 13 | ], 14 | "metadata": { 15 | "kernelspec": { 16 | "display_name": "Python 3", 17 | "language": "python", 18 | "name": "python3" 19 | }, 20 | "language_info": { 21 | "codemirror_mode": { 22 | "name": "ipython", 23 | "version": 3 24 | }, 25 | "file_extension": ".py", 26 | "mimetype": "text/x-python", 27 | "name": "python", 28 | "nbconvert_exporter": "python", 29 | "pygments_lexer": "ipython3", 30 | "version": "3.8.8" 31 | } 32 | }, 33 | "nbformat": 4, 34 | "nbformat_minor": 4 35 | } 36 | -------------------------------------------------------------------------------- /chapters/lgssm/kalman_parallel.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Parallel Kalman Smoother\n", 8 | "\n", 9 | "{cite}`Sarkka2021`\n", 10 | "\n", 11 | "\n", 12 | "\n" 13 | ] 14 | } 15 | ], 16 | "metadata": { 17 | "kernelspec": { 18 | "display_name": "Python 3", 19 | "language": "python", 20 | "name": "python3" 21 | }, 22 | "language_info": { 23 | "codemirror_mode": { 24 | "name": "ipython", 25 | "version": 3 26 | }, 27 | "file_extension": ".py", 28 | "mimetype": "text/x-python", 29 | "name": "python", 30 | "nbconvert_exporter": "python", 31 | "pygments_lexer": "ipython3", 32 | "version": "3.8.5" 33 | } 34 | }, 35 | "nbformat": 4, 36 | "nbformat_minor": 4 37 | } 38 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/lgssm/kalman_parallel.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Parallel Kalman Smoother\n", 8 | "\n", 9 | "{cite}`Sarkka2021`\n", 10 | "\n", 11 | "\n", 12 | "\n" 13 | ] 14 | } 15 | ], 16 | "metadata": { 17 | "kernelspec": { 18 | "display_name": "Python 3", 19 | "language": "python", 20 | "name": "python3" 21 | }, 22 | "language_info": { 23 | "codemirror_mode": { 24 | "name": "ipython", 25 | "version": 3 26 | }, 27 | "file_extension": ".py", 28 | "mimetype": "text/x-python", 29 | "name": "python", 30 | "nbconvert_exporter": "python", 31 | "pygments_lexer": "ipython3", 32 | "version": "3.8.5" 33 | } 34 | }, 35 | "nbformat": 4, 36 | "nbformat_minor": 4 37 | } 38 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/lgssm/kalman_parallel.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Parallel Kalman Smoother\n", 8 | "\n", 9 | "{cite}`Sarkka2021`\n", 10 | "\n", 11 | "\n", 12 | "\n" 13 | ] 14 | } 15 | ], 16 | "metadata": { 17 | "kernelspec": { 18 | "display_name": "Python 3", 19 | "language": "python", 20 | "name": "python3" 21 | }, 22 | "language_info": { 23 | "codemirror_mode": { 24 | "name": "ipython", 25 | "version": 3 26 | }, 27 | "file_extension": ".py", 28 | "mimetype": "text/x-python", 29 | "name": "python", 30 | "nbconvert_exporter": "python", 31 | "pygments_lexer": "ipython3", 32 | "version": "3.8.5" 33 | } 34 | }, 35 | "nbformat": 4, 36 | "nbformat_minor": 4 37 | } -------------------------------------------------------------------------------- /chapters/hmm/hmm_smoother.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# HMM smoothing (forwards-backwards algorithm)\n" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "## Forwards filter, backwards smoother algorithm" 15 | ] 16 | }, 17 | { 18 | "cell_type": "markdown", 19 | "metadata": {}, 20 | "source": [ 21 | "## Two-filter algorithm" 22 | ] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [] 28 | } 29 | ], 30 | "metadata": { 31 | "kernelspec": { 32 | "display_name": "Python 3", 33 | "language": "python", 34 | "name": "python3" 35 | }, 36 | "language_info": { 37 | "codemirror_mode": { 38 | "name": "ipython", 39 | "version": 3 40 | }, 41 | "file_extension": ".py", 42 | "mimetype": "text/x-python", 43 | "name": "python", 44 | "nbconvert_exporter": "python", 45 | "pygments_lexer": "ipython3", 46 | "version": "3.8.5" 47 | } 48 | }, 49 | "nbformat": 4, 50 | "nbformat_minor": 4 51 | } 52 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/hmm/hmm_smoother.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# HMM smoothing (forwards-backwards algorithm)\n" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "## Forwards filter, backwards smoother algorithm" 15 | ] 16 | }, 17 | { 18 | "cell_type": "markdown", 19 | "metadata": {}, 20 | "source": [ 21 | "## Two-filter algorithm" 22 | ] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [] 28 | } 29 | ], 30 | "metadata": { 31 | "kernelspec": { 32 | "display_name": "Python 3", 33 | "language": "python", 34 | "name": "python3" 35 | }, 36 | "language_info": { 37 | "codemirror_mode": { 38 | "name": "ipython", 39 | "version": 3 40 | }, 41 | "file_extension": ".py", 42 | "mimetype": "text/x-python", 43 | "name": "python", 44 | "nbconvert_exporter": "python", 45 | "pygments_lexer": "ipython3", 46 | "version": "3.8.5" 47 | } 48 | }, 49 | "nbformat": 4, 50 | "nbformat_minor": 4 51 | } -------------------------------------------------------------------------------- /_build/html/_sources/chapters/hmm/hmm_smoother.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# HMM smoothing (forwards-backwards algorithm)\n" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "## Forwards filter, backwards smoother algorithm" 15 | ] 16 | }, 17 | { 18 | "cell_type": "markdown", 19 | "metadata": {}, 20 | "source": [ 21 | "## Two-filter algorithm" 22 | ] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [] 28 | } 29 | ], 30 | "metadata": { 31 | "kernelspec": { 32 | "display_name": "Python 3", 33 | "language": "python", 34 | "name": "python3" 35 | }, 36 | "language_info": { 37 | "codemirror_mode": { 38 | "name": "ipython", 39 | "version": 3 40 | }, 41 | "file_extension": ".py", 42 | "mimetype": "text/x-python", 43 | "name": "python", 44 | "nbconvert_exporter": "python", 45 | "pygments_lexer": "ipython3", 46 | "version": "3.8.5" 47 | } 48 | }, 49 | "nbformat": 4, 50 | "nbformat_minor": 4 51 | } 52 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Probabilistic machine learning 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /_build/html/_static/webpack-macros.html: -------------------------------------------------------------------------------- 1 | 2 | {% macro head_pre_icons() %} 3 | 5 | 7 | 9 | {% endmacro %} 10 | 11 | {% macro head_pre_fonts() %} 12 | {% endmacro %} 13 | 14 | {% macro head_pre_bootstrap() %} 15 | 16 | 17 | {% endmacro %} 18 | 19 | {% macro head_js_preload() %} 20 | 21 | {% endmacro %} 22 | 23 | {% macro body_post() %} 24 | 25 | {% endmacro %} -------------------------------------------------------------------------------- /_build/html/_static/images/logo_binder.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 10 | logo 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/blank.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "(chap:my-chap)=\n", 8 | "# Chapter title\n", 9 | "\n" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": {}, 16 | "outputs": [ 17 | { 18 | "name": "stdout", 19 | "output_type": "stream", 20 | "text": [ 21 | "42\n" 22 | ] 23 | } 24 | ], 25 | "source": [ 26 | "print(42)" 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": {}, 32 | "source": [] 33 | } 34 | ], 35 | "metadata": { 36 | "interpreter": { 37 | "hash": "6407c60499271029b671b4ff687c4ed4626355c45fd34c44476827f4be42c4d7" 38 | }, 39 | "kernelspec": { 40 | "display_name": "Python 3.9.2 ('spyder-dev')", 41 | "language": "python", 42 | "name": "python3" 43 | }, 44 | "language_info": { 45 | "codemirror_mode": { 46 | "name": "ipython", 47 | "version": 3 48 | }, 49 | "file_extension": ".py", 50 | "mimetype": "text/x-python", 51 | "name": "python", 52 | "nbconvert_exporter": "python", 53 | "pygments_lexer": "ipython3", 54 | "version": "3.9.2" 55 | } 56 | }, 57 | "nbformat": 4, 58 | "nbformat_minor": 4 59 | } -------------------------------------------------------------------------------- /_build/html/_sources/chapters/blank.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "(chap:my-chap)=\n", 8 | "# Chapter title\n", 9 | "\n" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": {}, 16 | "outputs": [ 17 | { 18 | "name": "stdout", 19 | "output_type": "stream", 20 | "text": [ 21 | "42\n" 22 | ] 23 | } 24 | ], 25 | "source": [ 26 | "print(42)" 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": {}, 32 | "source": [] 33 | } 34 | ], 35 | "metadata": { 36 | "interpreter": { 37 | "hash": "6407c60499271029b671b4ff687c4ed4626355c45fd34c44476827f4be42c4d7" 38 | }, 39 | "kernelspec": { 40 | "display_name": "Python 3.9.2 ('spyder-dev')", 41 | "language": "python", 42 | "name": "python3" 43 | }, 44 | "language_info": { 45 | "codemirror_mode": { 46 | "name": "ipython", 47 | "version": 3 48 | }, 49 | "file_extension": ".py", 50 | "mimetype": "text/x-python", 51 | "name": "python", 52 | "nbconvert_exporter": "python", 53 | "pygments_lexer": "ipython3", 54 | "version": "3.9.2" 55 | } 56 | }, 57 | "nbformat": 4, 58 | "nbformat_minor": 4 59 | } 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ssm-book 2 | Executable textbook on state-space models, to accompany the [dynamax](https://github.com/probml/dynamax) library. 3 | The rendered content can be found at [https://probml.github.io/ssm-book/root.html](https://probml.github.io/ssm-book/root.html). 4 | 5 | 6 | 7 | Authors: Kevin Murphy, Scott Linderman, et al. MIT License. 2022 8 | 9 | 10 | 11 | Related books: 12 | - [Probabilistic Machine Learning: Advanced Topics](https://probml.github.io/pml-book/book2.html). Kevin Murphy, 2023. See chapters 8, 9 and 29. 13 | [JAX code](https://probml.github.io/dynamax/) 14 | - [Bayesian filtering and smoothing](https://users.aalto.fi/~ssarkka/pub/cup_book_online_20131111.pdf), Simo Sarkka, 2013. [Matlab code](https://www.cambridge.org/us/academic/subjects/statistics-probability/applied-probability-and-stochastic-networks/bayesian-filtering-and-smoothing?format=HB), [Numpy code](https://github.com/EEA-sensors/Bayesian-Filtering-and-Smoothing/tree/main/python), [Jax code](https://github.com/petergchang/sarkka-jax) 15 | - [State estimation for robotics](http://asrl.utias.utoronto.ca/~tdb/bib/barfoot_ser17.pdf), Tim Barfoot, 2017. 16 | - [Kalman and Bayesian filters in Python](https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python), Roger Labbe, 2015. [Python code](https://github.com/rlabbe/filterpy) 17 | -------------------------------------------------------------------------------- /_build/html/_static/vendor/fontawesome/5.13.0/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Font Awesome Free License 2 | ------------------------- 3 | 4 | Font Awesome Free is free, open source, and GPL friendly. You can use it for 5 | commercial projects, open source projects, or really almost whatever you want. 6 | Full Font Awesome Free license: https://fontawesome.com/license/free. 7 | 8 | # Icons: CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/) 9 | In the Font Awesome Free download, the CC BY 4.0 license applies to all icons 10 | packaged as SVG and JS file types. 11 | 12 | # Fonts: SIL OFL 1.1 License (https://scripts.sil.org/OFL) 13 | In the Font Awesome Free download, the SIL OFL license applies to all icons 14 | packaged as web and desktop font files. 15 | 16 | # Code: MIT License (https://opensource.org/licenses/MIT) 17 | In the Font Awesome Free download, the MIT license applies to all non-font and 18 | non-icon files. 19 | 20 | # Attribution 21 | Attribution is required by MIT, SIL OFL, and CC BY licenses. Downloaded Font 22 | Awesome Free files already contain embedded comments with sufficient 23 | attribution, so you shouldn't need to do anything additional when using these 24 | files normally. 25 | 26 | We've kept attribution comments terse, so we ask that you do not actively work 27 | to remove them from files, especially code. They're a great way for folks to 28 | learn about Font Awesome. 29 | 30 | # Brand Icons 31 | All brand icons are trademarks of their respective owners. The use of these 32 | trademarks does not indicate endorsement of the trademark holder by Font 33 | Awesome, nor vice versa. **Please do not use brand logos for any purpose except 34 | to represent the company, product, or service to which they refer.** 35 | -------------------------------------------------------------------------------- /_build/html/_static/images/logo_jupyterhub.svg: -------------------------------------------------------------------------------- 1 | logo_jupyterhubHub 2 | -------------------------------------------------------------------------------- /_toc.yml: -------------------------------------------------------------------------------- 1 | # Table of contents 2 | # Learn more at https://jupyterbook.org/customize/toc.html 3 | 4 | format: jb-book 5 | root: root 6 | chapters: 7 | 8 | - file: chapters/ssm/ssm_index 9 | sections: 10 | - file: chapters/ssm/ssm_intro 11 | - file: chapters/ssm/hmm 12 | - file: chapters/ssm/lds 13 | - file: chapters/ssm/nlds 14 | - file: chapters/ssm/inference 15 | - file: chapters/ssm/learning 16 | 17 | - file: chapters/hmm/hmm_index 18 | sections: 19 | - file: chapters/hmm/hmm_filter 20 | - file: chapters/hmm/hmm_smoother 21 | - file: chapters/hmm/hmm_viterbi 22 | - file: chapters/hmm/hmm_parallel 23 | - file: chapters/hmm/hmm_sampling 24 | 25 | - file: chapters/lgssm/lgssm_index 26 | sections: 27 | - file: chapters/lgssm/kalman_filter 28 | - file: chapters/lgssm/kalman_smoother 29 | - file: chapters/lgssm/kalman_parallel 30 | - file: chapters/lgssm/kalman_sampling 31 | 32 | - file: chapters/extended/extended_index 33 | sections: 34 | - file: chapters/extended/extended_filter 35 | - file: chapters/extended/extended_smoother 36 | - file: chapters/extended/extended_parallel 37 | 38 | - file: chapters/unscented/unscented_index 39 | sections: 40 | - file: chapters/unscented/unscented_filter 41 | - file: chapters/unscented/unscented_smoother 42 | 43 | - file: chapters/quadrature/quadrature_index 44 | - file: chapters/postlin/postlin_index 45 | - file: chapters/adf/adf_index 46 | - file: chapters/vi/vi_index 47 | - file: chapters/pf/pf_index 48 | - file: chapters/smc/smc_index 49 | - file: chapters/learning/learning_index 50 | - file: chapters/tracking/tracking_index 51 | - file: chapters/ensemble/ensemble_index 52 | - file: chapters/bnp/bnp_index 53 | - file: chapters/changepoint/changepoint_index 54 | - file: chapters/timeseries/timeseries_index 55 | - file: chapters/gp/gp_index 56 | - file: chapters/ode/ode_index 57 | - file: chapters/control/control_index 58 | 59 | - file: bib -------------------------------------------------------------------------------- /_build/html/_static/copybutton.css: -------------------------------------------------------------------------------- 1 | /* Copy buttons */ 2 | button.copybtn { 3 | position: absolute; 4 | display: flex; 5 | top: .3em; 6 | right: .3em; 7 | width: 1.7em; 8 | height: 1.7em; 9 | opacity: 0; 10 | transition: opacity 0.3s, border .3s, background-color .3s; 11 | user-select: none; 12 | padding: 0; 13 | border: none; 14 | outline: none; 15 | border-radius: 0.4em; 16 | /* The colors that GitHub uses */ 17 | border: #1b1f2426 1px solid; 18 | background-color: #f6f8fa; 19 | color: #57606a; 20 | } 21 | 22 | button.copybtn.success { 23 | border-color: #22863a; 24 | color: #22863a; 25 | } 26 | 27 | button.copybtn svg { 28 | stroke: currentColor; 29 | width: 1.5em; 30 | height: 1.5em; 31 | padding: 0.1em; 32 | } 33 | 34 | div.highlight { 35 | position: relative; 36 | } 37 | 38 | .highlight:hover button.copybtn { 39 | opacity: 1; 40 | } 41 | 42 | .highlight button.copybtn:hover { 43 | background-color: rgb(235, 235, 235); 44 | } 45 | 46 | .highlight button.copybtn:active { 47 | background-color: rgb(187, 187, 187); 48 | } 49 | 50 | /** 51 | * A minimal CSS-only tooltip copied from: 52 | * https://codepen.io/mildrenben/pen/rVBrpK 53 | * 54 | * To use, write HTML like the following: 55 | * 56 | *

Short

57 | */ 58 | .o-tooltip--left { 59 | position: relative; 60 | } 61 | 62 | .o-tooltip--left:after { 63 | opacity: 0; 64 | visibility: hidden; 65 | position: absolute; 66 | content: attr(data-tooltip); 67 | padding: .2em; 68 | font-size: .8em; 69 | left: -.2em; 70 | background: grey; 71 | color: white; 72 | white-space: nowrap; 73 | z-index: 2; 74 | border-radius: 2px; 75 | transform: translateX(-102%) translateY(0); 76 | transition: opacity 0.2s cubic-bezier(0.64, 0.09, 0.08, 1), transform 0.2s cubic-bezier(0.64, 0.09, 0.08, 1); 77 | } 78 | 79 | .o-tooltip--left:hover:after { 80 | display: block; 81 | opacity: 1; 82 | visibility: visible; 83 | transform: translateX(-100%) translateY(0); 84 | transition: opacity 0.2s cubic-bezier(0.64, 0.09, 0.08, 1), transform 0.2s cubic-bezier(0.64, 0.09, 0.08, 1); 85 | transition-delay: .5s; 86 | } 87 | 88 | /* By default the copy button shouldn't show up when printing a page */ 89 | @media print { 90 | button.copybtn { 91 | display: none; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /_build/html/reports/hmm_filter.log: -------------------------------------------------------------------------------- 1 | Traceback (most recent call last): 2 | File "/opt/anaconda3/lib/python3.8/site-packages/jupyter_cache/executors/utils.py", line 51, in single_nb_execution 3 | executenb( 4 | File "/opt/anaconda3/lib/python3.8/site-packages/nbclient/client.py", line 1087, in execute 5 | return NotebookClient(nb=nb, resources=resources, km=km, **kwargs).execute() 6 | File "/opt/anaconda3/lib/python3.8/site-packages/nbclient/util.py", line 74, in wrapped 7 | return just_run(coro(*args, **kwargs)) 8 | File "/opt/anaconda3/lib/python3.8/site-packages/nbclient/util.py", line 53, in just_run 9 | return loop.run_until_complete(coro) 10 | File "/opt/anaconda3/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete 11 | return future.result() 12 | File "/opt/anaconda3/lib/python3.8/site-packages/nbclient/client.py", line 540, in async_execute 13 | await self.async_execute_cell( 14 | File "/opt/anaconda3/lib/python3.8/site-packages/nbclient/client.py", line 832, in async_execute_cell 15 | self._check_raise_for_error(cell, exec_reply) 16 | File "/opt/anaconda3/lib/python3.8/site-packages/nbclient/client.py", line 740, in _check_raise_for_error 17 | raise CellExecutionError.from_cell_and_msg(cell, exec_reply['content']) 18 | nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell: 19 | ------------------ 20 | import jsl.hmm.hmm_lib as hmm_lib 21 | print_source(hmm_lib.hmm_forwards_jax) 22 | #https://github.com/probml/JSL/blob/main/jsl/hmm/hmm_lib.py#L189 23 | 24 | 25 | ------------------ 26 | 27 | --------------------------------------------------------------------------- 28 | NameError Traceback (most recent call last) 29 |  in  30 |  1 import jsl.hmm.hmm_lib as hmm_lib 31 | ----> 2 print_source(hmm_lib.hmm_forwards_jax) 32 |  3 #https://github.com/probml/JSL/blob/main/jsl/hmm/hmm_lib.py#L189 33 |  4  34 | 35 | NameError: name 'print_source' is not defined 36 | NameError: name 'print_source' is not defined 37 | 38 | -------------------------------------------------------------------------------- /_build/html/_static/copybutton_funcs.js: -------------------------------------------------------------------------------- 1 | function escapeRegExp(string) { 2 | return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string 3 | } 4 | 5 | // Callback when a copy button is clicked. Will be passed the node that was clicked 6 | // should then grab the text and replace pieces of text that shouldn't be used in output 7 | export function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onlyCopyPromptLines = true, removePrompts = true, copyEmptyLines = true, lineContinuationChar = "", hereDocDelim = "") { 8 | 9 | var regexp; 10 | var match; 11 | 12 | // Do we check for line continuation characters and "HERE-documents"? 13 | var useLineCont = !!lineContinuationChar 14 | var useHereDoc = !!hereDocDelim 15 | 16 | // create regexp to capture prompt and remaining line 17 | if (isRegexp) { 18 | regexp = new RegExp('^(' + copybuttonPromptText + ')(.*)') 19 | } else { 20 | regexp = new RegExp('^(' + escapeRegExp(copybuttonPromptText) + ')(.*)') 21 | } 22 | 23 | const outputLines = []; 24 | var promptFound = false; 25 | var gotLineCont = false; 26 | var gotHereDoc = false; 27 | const lineGotPrompt = []; 28 | for (const line of textContent.split('\n')) { 29 | match = line.match(regexp) 30 | if (match || gotLineCont || gotHereDoc) { 31 | promptFound = regexp.test(line) 32 | lineGotPrompt.push(promptFound) 33 | if (removePrompts && promptFound) { 34 | outputLines.push(match[2]) 35 | } else { 36 | outputLines.push(line) 37 | } 38 | gotLineCont = line.endsWith(lineContinuationChar) & useLineCont 39 | if (line.includes(hereDocDelim) & useHereDoc) 40 | gotHereDoc = !gotHereDoc 41 | } else if (!onlyCopyPromptLines) { 42 | outputLines.push(line) 43 | } else if (copyEmptyLines && line.trim() === '') { 44 | outputLines.push(line) 45 | } 46 | } 47 | 48 | // If no lines with the prompt were found then just use original lines 49 | if (lineGotPrompt.some(v => v === true)) { 50 | textContent = outputLines.join('\n'); 51 | } 52 | 53 | // Remove a trailing newline to avoid auto-running when pasting 54 | if (textContent.endsWith("\n")) { 55 | textContent = textContent.slice(0, -1) 56 | } 57 | return textContent 58 | } 59 | -------------------------------------------------------------------------------- /chapters/intro.md~: -------------------------------------------------------------------------------- 1 | --- 2 | jupytext: 3 | cell_metadata_filter: -all 4 | formats: md:myst 5 | text_representation: 6 | extension: .md 7 | format_name: myst 8 | kernelspec: 9 | display_name: Python 3 10 | language: python 11 | name: python3 12 | --- 13 | 14 | (ch:intro)= 15 | # Introduction 16 | 17 | 18 | 19 | 20 | In this chapter, we do blah. 21 | Specifically 22 | 23 | - foo 24 | - bar. 25 | - baz 26 | 27 | For more details, see 28 | {ref}`ch:hmm` and {cite}`Sarkka13`. 29 | 30 | 31 | ## What are state space models? 32 | 33 | ## Python 34 | 35 | We\'re now ready to start coding. 36 | 37 | ```{code-cell} 38 | from matplotlib import rcParams, cycler 39 | import matplotlib.pyplot as plt 40 | import numpy as np 41 | plt.ion() 42 | ``` 43 | 44 | ```{code-cell} 45 | # Fixing random state for reproducibility 46 | np.random.seed(19680801) 47 | 48 | N = 10 49 | data = [np.logspace(0, 1, 100) + np.random.randn(100) + ii for ii in range(N)] 50 | data = np.array(data).T 51 | cmap = plt.cm.coolwarm 52 | rcParams['axes.prop_cycle'] = cycler(color=cmap(np.linspace(0, 1, N))) 53 | 54 | 55 | from matplotlib.lines import Line2D 56 | custom_lines = [Line2D([0], [0], color=cmap(0.), lw=4), 57 | Line2D([0], [0], color=cmap(.5), lw=4), 58 | Line2D([0], [0], color=cmap(1.), lw=4)] 59 | 60 | fig, ax = plt.subplots(figsize=(10, 5)) 61 | lines = ax.plot(data) 62 | ax.legend(custom_lines, ['Cold', 'Medium', 'Hot']); 63 | ``` 64 | 65 | ```{code-cell} 66 | import matplotlib.pyplot as plt 67 | import numpy as np 68 | import jax 69 | import jax.numpy as jnp 70 | 71 | print(jax.devices()) 72 | ``` 73 | 74 | ## Images 75 | 76 | 77 | 80 | 81 | 83 | 84 | ```{figure} /images/cat_dog.jpg 85 | :scale: 50% 86 | :name: cat_dog 87 | 88 | A photo of a cat and a dog. 89 | ``` 90 | 91 | ```{figure} /images/cat_dog.jpg 92 | :scale: 50% 93 | :name: cat_dog2 94 | 95 | Another photo of a cat and a dog. 96 | ``` 97 | 98 | In {numref}`Figure %s ` we show catdog. 99 | In {numref}`Figure %s ` we show catdog2, its twin. 100 | 101 | 102 | ## Math 103 | 104 | We have $E= mc^2$, and also 105 | 106 | ```{math} 107 | :label: foo 108 | a x^2 + bx+ c = 0 109 | ``` 110 | 111 | From {eq}`foo`, it follows that 112 | $$ 113 | \begin{align} 114 | 0 &= a x^2 + bx+ c \\ 115 | 0 &= a x^2 + bx+ c 116 | \end{align} 117 | $$ 118 | 119 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/scratch.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # (ch:intro)= 5 | # # Scratchpad 6 | # 7 | # 8 | # In this chapter, we do blah. 9 | # Specifically 10 | # 11 | # - foo 12 | # - bar. 13 | # - baz 14 | # 15 | # For more details, see 16 | # {ref}`ch:hmm` and {cite}`Sarkka13`. 17 | # 18 | # 19 | # ## Python 20 | # 21 | # We\'re now ready to start coding. 22 | 23 | # In[1]: 24 | 25 | 26 | from matplotlib import rcParams, cycler 27 | import matplotlib.pyplot as plt 28 | import numpy as np 29 | plt.ion() 30 | 31 | 32 | # In[2]: 33 | 34 | 35 | # Fixing random state for reproducibility 36 | np.random.seed(19680801) 37 | 38 | N = 10 39 | data = [np.logspace(0, 1, 100) + np.random.randn(100) + ii for ii in range(N)] 40 | data = np.array(data).T 41 | cmap = plt.cm.coolwarm 42 | rcParams['axes.prop_cycle'] = cycler(color=cmap(np.linspace(0, 1, N))) 43 | 44 | 45 | from matplotlib.lines import Line2D 46 | custom_lines = [Line2D([0], [0], color=cmap(0.), lw=4), 47 | Line2D([0], [0], color=cmap(.5), lw=4), 48 | Line2D([0], [0], color=cmap(1.), lw=4)] 49 | 50 | fig, ax = plt.subplots(figsize=(10, 5)) 51 | lines = ax.plot(data) 52 | ax.legend(custom_lines, ['Cold', 'Medium', 'Hot']); 53 | 54 | 55 | # In[3]: 56 | 57 | 58 | import matplotlib.pyplot as plt 59 | import numpy as np 60 | import jax 61 | import jax.numpy as jnp 62 | 63 | print(jax.devices()) 64 | 65 | 66 | # ## Images 67 | # 68 | # 69 | # 76 | # 77 | # ```{figure} /figures/cat_dog.jpg 78 | # :scale: 50% 79 | # :name: cat_dog 80 | # 81 | # A photo of a cat and a dog. 82 | # ``` 83 | # 84 | # ```{figure} /figures/cat_dog.jpg 85 | # :height: 300px 86 | # :name: cat_dog2 87 | # 88 | # Another photo of a cat and a dog. 89 | # ``` 90 | # 91 | # In {numref}`cat_dog` 92 | # we show catdog. 93 | # In {numref}`Figure %s ` we show catdog2, its twin. 94 | # 95 | # ```{note} 96 | # I am a useful note! 97 | # ``` 98 | # 99 | # ## Math 100 | # 101 | # Here is $\N=10$ and blah. $\floor{42.3}= 42$. Let's try again. 102 | # 103 | # We have $E= mc^2$, and also 104 | # 105 | # ```{math} 106 | # :label: foo 107 | # a x^2 + bx+ c = 0 108 | # ``` 109 | # 110 | # From {eq}`foo`, it follows that 111 | # 112 | # $$ 113 | # \begin{align} 114 | # 0 &= a x^2 + bx+ c \\ 115 | # 0 &= a x^2 + bx+ c 116 | # \end{align} 117 | # $$ 118 | -------------------------------------------------------------------------------- /_build/html/_static/sphinx-book-theme.d59cb220de22ca1c485ebbdc042f0030.js: -------------------------------------------------------------------------------- 1 | var initTriggerNavBar=()=>{if($(window).width()<768){$("#navbar-toggler").trigger("click")}} 2 | var scrollToActive=()=>{var navbar=document.getElementById('site-navigation') 3 | var active_pages=navbar.querySelectorAll(".active") 4 | var active_page=active_pages[active_pages.length-1] 5 | if(active_page!==undefined&&active_page.offsetTop>($(window).height()*.5)){navbar.scrollTop=active_page.offsetTop-($(window).height()*.2)}} 6 | var sbRunWhenDOMLoaded=cb=>{if(document.readyState!='loading'){cb()}else if(document.addEventListener){document.addEventListener('DOMContentLoaded',cb)}else{document.attachEvent('onreadystatechange',function(){if(document.readyState=='complete')cb()})}} 7 | function toggleFullScreen(){var navToggler=$("#navbar-toggler");if(!document.fullscreenElement){document.documentElement.requestFullscreen();if(!navToggler.hasClass("collapsed")){navToggler.click();}}else{if(document.exitFullscreen){document.exitFullscreen();if(navToggler.hasClass("collapsed")){navToggler.click();}}}} 8 | var initTooltips=()=>{$(document).ready(function(){$('[data-toggle="tooltip"]').tooltip();});} 9 | var initTocHide=()=>{var scrollTimeout;var throttle=200;var tocHeight=$("#bd-toc-nav").outerHeight(true)+$(".bd-toc").outerHeight(true);var hideTocAfter=tocHeight+200;var checkTocScroll=function(){var margin_content=$(".margin, .tag_margin, .full-width, .full_width, .tag_full-width, .tag_full_width, .sidebar, .tag_sidebar, .popout, .tag_popout");margin_content.each((index,item)=>{var topOffset=$(item).offset().top-$(window).scrollTop();var bottomOffset=topOffset+$(item).outerHeight(true);var removeToc=(topOffset=0);if(removeToc&&window.pageYOffset>20){$("div.bd-toc").removeClass("show") 10 | return false}else{$("div.bd-toc").addClass("show")};})};var manageScrolledClassOnBody=function(){if(window.scrollY>0){document.body.classList.add("scrolled");}else{document.body.classList.remove("scrolled");}} 11 | $(window).on('scroll',function(){if(!scrollTimeout){scrollTimeout=setTimeout(function(){checkTocScroll();manageScrolledClassOnBody();scrollTimeout=null;},throttle);}});} 12 | var printPdf=(el)=>{let tooltipID=$(el).attr("aria-describedby") 13 | let tooltipTextDiv=$("#"+tooltipID).detach() 14 | window.print() 15 | $("body").append(tooltipTextDiv)} 16 | var initThebeSBT=()=>{var title=$("div.section h1")[0] 17 | if(!$(title).next().hasClass("thebe-launch-button")){$("").insertAfter($(title))} 18 | initThebe();} 19 | sbRunWhenDOMLoaded(initTooltips) 20 | sbRunWhenDOMLoaded(initTriggerNavBar) 21 | sbRunWhenDOMLoaded(scrollToActive) 22 | sbRunWhenDOMLoaded(initTocHide) 23 | -------------------------------------------------------------------------------- /_build/html/_static/panels-main.c949a650a448cc0ae9fd3441c0e17fb0.css: -------------------------------------------------------------------------------- 1 | details.dropdown .summary-title{padding-right:3em !important;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;user-select:none}details.dropdown:hover{cursor:pointer}details.dropdown .summary-content{cursor:default}details.dropdown summary{list-style:none;padding:1em}details.dropdown summary .octicon.no-title{vertical-align:middle}details.dropdown[open] summary .octicon.no-title{visibility:hidden}details.dropdown summary::-webkit-details-marker{display:none}details.dropdown summary:focus{outline:none}details.dropdown summary:hover .summary-up svg,details.dropdown summary:hover .summary-down svg{opacity:1}details.dropdown .summary-up svg,details.dropdown .summary-down svg{display:block;opacity:.6}details.dropdown .summary-up,details.dropdown .summary-down{pointer-events:none;position:absolute;right:1em;top:.75em}details.dropdown[open] .summary-down{visibility:hidden}details.dropdown:not([open]) .summary-up{visibility:hidden}details.dropdown.fade-in[open] summary~*{-moz-animation:panels-fade-in .5s ease-in-out;-webkit-animation:panels-fade-in .5s ease-in-out;animation:panels-fade-in .5s ease-in-out}details.dropdown.fade-in-slide-down[open] summary~*{-moz-animation:panels-fade-in .5s ease-in-out, panels-slide-down .5s ease-in-out;-webkit-animation:panels-fade-in .5s ease-in-out, panels-slide-down .5s ease-in-out;animation:panels-fade-in .5s ease-in-out, panels-slide-down .5s ease-in-out}@keyframes panels-fade-in{0%{opacity:0}100%{opacity:1}}@keyframes panels-slide-down{0%{transform:translate(0, -10px)}100%{transform:translate(0, 0)}}.octicon{display:inline-block;fill:currentColor;vertical-align:text-top}.tabbed-content{box-shadow:0 -.0625rem var(--tabs-color-overline),0 .0625rem var(--tabs-color-underline);display:none;order:99;padding-bottom:.75rem;padding-top:.75rem;width:100%}.tabbed-content>:first-child{margin-top:0 !important}.tabbed-content>:last-child{margin-bottom:0 !important}.tabbed-content>.tabbed-set{margin:0}.tabbed-set{border-radius:.125rem;display:flex;flex-wrap:wrap;margin:1em 0;position:relative}.tabbed-set>input{opacity:0;position:absolute}.tabbed-set>input:checked+label{border-color:var(--tabs-color-label-active);color:var(--tabs-color-label-active)}.tabbed-set>input:checked+label+.tabbed-content{display:block}.tabbed-set>input:focus+label{outline-style:auto}.tabbed-set>input:not(.focus-visible)+label{outline:none;-webkit-tap-highlight-color:transparent}.tabbed-set>label{border-bottom:.125rem solid transparent;color:var(--tabs-color-label-inactive);cursor:pointer;font-size:var(--tabs-size-label);font-weight:700;padding:1em 1.25em .5em;transition:color 250ms;width:auto;z-index:1}html .tabbed-set>label:hover{color:var(--tabs-color-label-active)} 2 | -------------------------------------------------------------------------------- /_build/html/_panels_static/panels-main.c949a650a448cc0ae9fd3441c0e17fb0.css: -------------------------------------------------------------------------------- 1 | details.dropdown .summary-title{padding-right:3em !important;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;user-select:none}details.dropdown:hover{cursor:pointer}details.dropdown .summary-content{cursor:default}details.dropdown summary{list-style:none;padding:1em}details.dropdown summary .octicon.no-title{vertical-align:middle}details.dropdown[open] summary .octicon.no-title{visibility:hidden}details.dropdown summary::-webkit-details-marker{display:none}details.dropdown summary:focus{outline:none}details.dropdown summary:hover .summary-up svg,details.dropdown summary:hover .summary-down svg{opacity:1}details.dropdown .summary-up svg,details.dropdown .summary-down svg{display:block;opacity:.6}details.dropdown .summary-up,details.dropdown .summary-down{pointer-events:none;position:absolute;right:1em;top:.75em}details.dropdown[open] .summary-down{visibility:hidden}details.dropdown:not([open]) .summary-up{visibility:hidden}details.dropdown.fade-in[open] summary~*{-moz-animation:panels-fade-in .5s ease-in-out;-webkit-animation:panels-fade-in .5s ease-in-out;animation:panels-fade-in .5s ease-in-out}details.dropdown.fade-in-slide-down[open] summary~*{-moz-animation:panels-fade-in .5s ease-in-out, panels-slide-down .5s ease-in-out;-webkit-animation:panels-fade-in .5s ease-in-out, panels-slide-down .5s ease-in-out;animation:panels-fade-in .5s ease-in-out, panels-slide-down .5s ease-in-out}@keyframes panels-fade-in{0%{opacity:0}100%{opacity:1}}@keyframes panels-slide-down{0%{transform:translate(0, -10px)}100%{transform:translate(0, 0)}}.octicon{display:inline-block;fill:currentColor;vertical-align:text-top}.tabbed-content{box-shadow:0 -.0625rem var(--tabs-color-overline),0 .0625rem var(--tabs-color-underline);display:none;order:99;padding-bottom:.75rem;padding-top:.75rem;width:100%}.tabbed-content>:first-child{margin-top:0 !important}.tabbed-content>:last-child{margin-bottom:0 !important}.tabbed-content>.tabbed-set{margin:0}.tabbed-set{border-radius:.125rem;display:flex;flex-wrap:wrap;margin:1em 0;position:relative}.tabbed-set>input{opacity:0;position:absolute}.tabbed-set>input:checked+label{border-color:var(--tabs-color-label-active);color:var(--tabs-color-label-active)}.tabbed-set>input:checked+label+.tabbed-content{display:block}.tabbed-set>input:focus+label{outline-style:auto}.tabbed-set>input:not(.focus-visible)+label{outline:none;-webkit-tap-highlight-color:transparent}.tabbed-set>label{border-bottom:.125rem solid transparent;color:var(--tabs-color-label-inactive);cursor:pointer;font-size:var(--tabs-size-label);font-weight:700;padding:1em 1.25em .5em;transition:color 250ms;width:auto;z-index:1}html .tabbed-set>label:hover{color:var(--tabs-color-label-active)} 2 | -------------------------------------------------------------------------------- /chapters/scratch.md: -------------------------------------------------------------------------------- 1 | --- 2 | jupytext: 3 | cell_metadata_filter: -all 4 | formats: md:myst 5 | text_representation: 6 | extension: .md 7 | format_name: myst 8 | kernelspec: 9 | display_name: Python 3 10 | language: python 11 | name: python3 12 | --- 13 | 14 | (ch:intro)= 15 | # Scratchpad 16 | 17 | 18 | In this chapter, we do blah. 19 | Specifically 20 | 21 | - foo 22 | - bar. 23 | - baz 24 | 25 | For more details, see 26 | {ref}`ch:hmm` and {cite}`Sarkka13`. 27 | 28 | 29 | ## Python 30 | 31 | We\'re now ready to start coding. 32 | 33 | ```{code-cell} 34 | from matplotlib import rcParams, cycler 35 | import matplotlib.pyplot as plt 36 | import numpy as np 37 | plt.ion() 38 | ``` 39 | 40 | ```{code-cell} 41 | # Fixing random state for reproducibility 42 | np.random.seed(19680801) 43 | 44 | N = 10 45 | data = [np.logspace(0, 1, 100) + np.random.randn(100) + ii for ii in range(N)] 46 | data = np.array(data).T 47 | cmap = plt.cm.coolwarm 48 | rcParams['axes.prop_cycle'] = cycler(color=cmap(np.linspace(0, 1, N))) 49 | 50 | 51 | from matplotlib.lines import Line2D 52 | custom_lines = [Line2D([0], [0], color=cmap(0.), lw=4), 53 | Line2D([0], [0], color=cmap(.5), lw=4), 54 | Line2D([0], [0], color=cmap(1.), lw=4)] 55 | 56 | fig, ax = plt.subplots(figsize=(10, 5)) 57 | lines = ax.plot(data) 58 | ax.legend(custom_lines, ['Cold', 'Medium', 'Hot']); 59 | ``` 60 | 61 | ```{code-cell} 62 | import matplotlib.pyplot as plt 63 | import numpy as np 64 | import jax 65 | import jax.numpy as jnp 66 | 67 | print(jax.devices()) 68 | ``` 69 | 70 | ## Images 71 | 72 | 73 | 80 | 81 | ```{figure} /figures/cat_dog.jpg 82 | :scale: 50% 83 | :name: cat_dog 84 | 85 | A photo of a cat and a dog. 86 | ``` 87 | 88 | ```{figure} /figures/cat_dog.jpg 89 | :height: 300px 90 | :name: cat_dog2 91 | 92 | Another photo of a cat and a dog. 93 | ``` 94 | 95 | In {numref}`cat_dog` 96 | we show catdog. 97 | In {numref}`Figure %s ` we show catdog2, its twin. 98 | 99 | ```{note} 100 | I am a useful note! 101 | ``` 102 | 103 | ## Math 104 | 105 | Here is $\N=10$ and blah. $\floor{42.3}= 42$. Let's try again. 106 | 107 | We have $E= mc^2$, and also 108 | 109 | ```{math} 110 | :label: foo 111 | a x^2 + bx+ c = 0 112 | ``` 113 | 114 | From {eq}`foo`, it follows that 115 | 116 | $$ 117 | \begin{align} 118 | 0 &= a x^2 + bx+ c \\ 119 | 0 &= a x^2 + bx+ c 120 | \end{align} 121 | $$ 122 | 123 | -------------------------------------------------------------------------------- /_build/html/_sources/chapters/scratch.md: -------------------------------------------------------------------------------- 1 | --- 2 | jupytext: 3 | cell_metadata_filter: -all 4 | formats: md:myst 5 | text_representation: 6 | extension: .md 7 | format_name: myst 8 | kernelspec: 9 | display_name: Python 3 10 | language: python 11 | name: python3 12 | --- 13 | 14 | (ch:intro)= 15 | # Scratchpad 16 | 17 | 18 | In this chapter, we do blah. 19 | Specifically 20 | 21 | - foo 22 | - bar. 23 | - baz 24 | 25 | For more details, see 26 | {ref}`ch:hmm` and {cite}`Sarkka13`. 27 | 28 | 29 | ## Python 30 | 31 | We\'re now ready to start coding. 32 | 33 | ```{code-cell} 34 | from matplotlib import rcParams, cycler 35 | import matplotlib.pyplot as plt 36 | import numpy as np 37 | plt.ion() 38 | ``` 39 | 40 | ```{code-cell} 41 | # Fixing random state for reproducibility 42 | np.random.seed(19680801) 43 | 44 | N = 10 45 | data = [np.logspace(0, 1, 100) + np.random.randn(100) + ii for ii in range(N)] 46 | data = np.array(data).T 47 | cmap = plt.cm.coolwarm 48 | rcParams['axes.prop_cycle'] = cycler(color=cmap(np.linspace(0, 1, N))) 49 | 50 | 51 | from matplotlib.lines import Line2D 52 | custom_lines = [Line2D([0], [0], color=cmap(0.), lw=4), 53 | Line2D([0], [0], color=cmap(.5), lw=4), 54 | Line2D([0], [0], color=cmap(1.), lw=4)] 55 | 56 | fig, ax = plt.subplots(figsize=(10, 5)) 57 | lines = ax.plot(data) 58 | ax.legend(custom_lines, ['Cold', 'Medium', 'Hot']); 59 | ``` 60 | 61 | ```{code-cell} 62 | import matplotlib.pyplot as plt 63 | import numpy as np 64 | import jax 65 | import jax.numpy as jnp 66 | 67 | print(jax.devices()) 68 | ``` 69 | 70 | ## Images 71 | 72 | 73 | 80 | 81 | ```{figure} /figures/cat_dog.jpg 82 | :scale: 50% 83 | :name: cat_dog 84 | 85 | A photo of a cat and a dog. 86 | ``` 87 | 88 | ```{figure} /figures/cat_dog.jpg 89 | :height: 300px 90 | :name: cat_dog2 91 | 92 | Another photo of a cat and a dog. 93 | ``` 94 | 95 | In {numref}`cat_dog` 96 | we show catdog. 97 | In {numref}`Figure %s ` we show catdog2, its twin. 98 | 99 | ```{note} 100 | I am a useful note! 101 | ``` 102 | 103 | ## Math 104 | 105 | Here is $\N=10$ and blah. $\floor{42.3}= 42$. Let's try again. 106 | 107 | We have $E= mc^2$, and also 108 | 109 | ```{math} 110 | :label: foo 111 | a x^2 + bx+ c = 0 112 | ``` 113 | 114 | From {eq}`foo`, it follows that 115 | 116 | $$ 117 | \begin{align} 118 | 0 &= a x^2 + bx+ c \\ 119 | 0 &= a x^2 + bx+ c 120 | \end{align} 121 | $$ 122 | 123 | -------------------------------------------------------------------------------- /_build/html/_static/sphinx-thebe.css: -------------------------------------------------------------------------------- 1 | /* Thebelab Buttons */ 2 | .thebelab-button { 3 | z-index: 999; 4 | display: inline-block; 5 | padding: 0.35em 1.2em; 6 | margin: 0px 1px; 7 | border-radius: 0.12em; 8 | box-sizing: border-box; 9 | text-decoration: none; 10 | font-family: "Roboto", sans-serif; 11 | font-weight: 300; 12 | text-align: center; 13 | transition: all 0.2s; 14 | background-color: #dddddd; 15 | border: 0.05em solid white; 16 | color: #000000; 17 | } 18 | 19 | .thebelab-button:hover { 20 | border: 0.05em solid black; 21 | background-color: #fcfcfc; 22 | } 23 | 24 | .thebe-launch-button { 25 | height: 2.2em; 26 | font-size: 0.8em; 27 | border: 1px black solid; 28 | } 29 | 30 | /* Thebelab Cell */ 31 | .thebelab-cell pre { 32 | background: none; 33 | } 34 | 35 | .thebelab-cell .thebelab-input { 36 | padding-left: 1em; 37 | margin-bottom: 0.5em; 38 | margin-top: 0.5em; 39 | } 40 | 41 | .thebelab-cell .jp-OutputArea { 42 | margin-top: 0.5em; 43 | margin-left: 1em; 44 | } 45 | 46 | button.thebelab-button.thebelab-run-button { 47 | margin-left: 1.5em; 48 | margin-bottom: 0.5em; 49 | } 50 | 51 | /* Loading button */ 52 | button.thebe-launch-button div.spinner { 53 | float: left; 54 | margin-right: 1em; 55 | } 56 | 57 | /* Remove the spinner when thebelab is ready */ 58 | .thebe-launch-button.thebe-status-ready .spinner { 59 | display: none; 60 | } 61 | 62 | .thebe-launch-button span.status { 63 | font-family: monospace; 64 | font-weight: bold; 65 | } 66 | 67 | .thebe-launch-button.thebe-status-ready span.status { 68 | color: green; 69 | } 70 | 71 | .spinner { 72 | height: 2em; 73 | text-align: center; 74 | font-size: 0.7em; 75 | } 76 | 77 | .spinner > div { 78 | background-color: #f37726; 79 | height: 100%; 80 | width: 6px; 81 | display: inline-block; 82 | 83 | -webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out; 84 | animation: sk-stretchdelay 1.2s infinite ease-in-out; 85 | } 86 | 87 | .spinner .rect2 { 88 | -webkit-animation-delay: -1.1s; 89 | animation-delay: -1.1s; 90 | } 91 | 92 | .spinner .rect3 { 93 | -webkit-animation-delay: -1s; 94 | animation-delay: -1s; 95 | } 96 | 97 | .spinner .rect4 { 98 | -webkit-animation-delay: -0.9s; 99 | animation-delay: -0.9s; 100 | } 101 | 102 | .spinner .rect5 { 103 | -webkit-animation-delay: -0.8s; 104 | animation-delay: -0.8s; 105 | } 106 | 107 | @-webkit-keyframes sk-stretchdelay { 108 | 0%, 109 | 40%, 110 | 100% { 111 | -webkit-transform: scaleY(0.4); 112 | } 113 | 20% { 114 | -webkit-transform: scaleY(1); 115 | } 116 | } 117 | 118 | @keyframes sk-stretchdelay { 119 | 0%, 120 | 40%, 121 | 100% { 122 | transform: scaleY(0.4); 123 | -webkit-transform: scaleY(0.4); 124 | } 125 | 20% { 126 | transform: scaleY(1); 127 | -webkit-transform: scaleY(1); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/learning.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # In[1]: 5 | 6 | 7 | ### Import standard libraries 8 | 9 | import abc 10 | from dataclasses import dataclass 11 | import functools 12 | from functools import partial 13 | import itertools 14 | import matplotlib.pyplot as plt 15 | import numpy as np 16 | from typing import Any, Callable, NamedTuple, Optional, Union, Tuple 17 | 18 | import jax 19 | import jax.numpy as jnp 20 | from jax import lax, vmap, jit, grad 21 | #from jax.scipy.special import logit 22 | #from jax.nn import softmax 23 | import jax.random as jr 24 | 25 | 26 | 27 | import distrax 28 | import optax 29 | 30 | import jsl 31 | import ssm_jax 32 | 33 | 34 | # (sec:learning)= 35 | # # Parameter estimation (learning) 36 | # 37 | # 38 | # So far, we have assumed that the parameters $\params$ of the SSM are known. 39 | # For example, in the case of an HMM with categorical observations 40 | # we have $\params = (\hmmInit, \hmmTrans, \hmmObs)$, 41 | # and in the case of an LDS, we have $\params = 42 | # (\ldsTrans, \ldsObs, \ldsTransIn, \ldsObsIn, \transCov, \obsCov, \initMean, \initCov)$. 43 | # If we adopt a Bayesian perspective, we can view these parameters as random variables that are 44 | # shared across all time steps, and across all sequences. 45 | # This is shown in {numref}`fig:hmm-plates`, where we adopt $\keyword{plate notation}$ 46 | # to represent repetitive structure. 47 | # 48 | # ```{figure} /figures/hmmDgmPlatesY.png 49 | # :scale: 100% 50 | # :name: fig:hmm-plates 51 | # 52 | # Illustration of an HMM using plate notation, where we show the parameter 53 | # nodes which are shared across all the sequences. 54 | # ``` 55 | # 56 | # Suppose we observe $N$ sequences $\data = \{\obs_{n,1:T_n}: n=1:N\}$. 57 | # Then the goal of $\keyword{parameter estimation}$, also called $\keyword{model learning}$ 58 | # or $\keyword{model fitting}$, is to approximate the posterior 59 | # \begin{align} 60 | # p(\params|\data) \propto p(\params) \prod_{n=1}^N p(\obs_{n,1:T_n} | \params) 61 | # \end{align} 62 | # where $p(\obs_{n,1:T_n} | \params)$ is the marginal likelihood of sequence $n$: 63 | # \begin{align} 64 | # p(\obs_{1:T} | \params) = \int p(\hidden_{1:T}, \obs_{1:T} | \params) d\hidden_{1:T} 65 | # \end{align} 66 | # 67 | # Since computing the full posterior is computationally difficult, we often settle for computing 68 | # a point estimate such as the MAP (maximum a posterior) estimate 69 | # \begin{align} 70 | # \params_{\map} = \arg \max_{\params} \log p(\params) + \sum_{n=1}^N \log p(\obs_{n,1:T_n} | \params) 71 | # \end{align} 72 | # If we ignore the prior term, we get the maximum likelihood estimate or MLE: 73 | # \begin{align} 74 | # \params_{\mle} = \arg \max_{\params} \sum_{n=1}^N \log p(\obs_{n,1:T_n} | \params) 75 | # \end{align} 76 | # In practice, the MAP estimate often works better than the MLE, since the prior can regularize 77 | # the estimate to ensure the model is numerically stable and does not overfit the training set. 78 | # 79 | # We will discuss a variety of algorithms for parameter estimation in later chapters. 80 | # 81 | # 82 | -------------------------------------------------------------------------------- /_build/html/_static/togglebutton.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Admonition-based toggles 3 | */ 4 | 5 | /* Visibility of the target */ 6 | .admonition.toggle .admonition-title ~ * { 7 | transition: opacity .3s, height .3s; 8 | } 9 | 10 | /* Toggle buttons inside admonitions so we see the title */ 11 | .toggle.admonition { 12 | position: relative; 13 | } 14 | 15 | /* Titles should cut off earlier to avoid overlapping w/ button */ 16 | .toggle.admonition .admonition-title { 17 | padding-right: 25%; 18 | cursor: pointer; 19 | } 20 | 21 | /* hides all the content of a page until de-toggled */ 22 | .toggle-hidden.admonition .admonition-title ~ * { 23 | height: 0; 24 | margin: 0; 25 | float: left; /* so they overlap when hidden */ 26 | opacity: 0; 27 | visibility: hidden; 28 | } 29 | 30 | /* General button style and position*/ 31 | button.toggle-button { 32 | /** 33 | * Background and shape. By default there's no background 34 | * but users can style as they wish 35 | */ 36 | background: none; 37 | border: none; 38 | outline: none; 39 | 40 | /* Positioning just inside the amonition title */ 41 | margin-right: 0.5em; 42 | position: absolute; 43 | right: 0em; 44 | top: .5em; 45 | float: right; 46 | padding: 0px; 47 | display: flex; 48 | } 49 | 50 | /* Display the toggle hint on wide screens */ 51 | @media (min-width: 768px) { 52 | button.toggle-button.toggle-button-hidden:before { 53 | content: attr(data-toggle-hint); /* This will be filled in by JS */ 54 | font-size: .8em; 55 | align-self: center; 56 | } 57 | } 58 | 59 | /* Icon behavior */ 60 | .tb-icon { 61 | transition: transform .2s ease-out; 62 | height: 1.5em; 63 | width: 1.5em; 64 | stroke: currentColor; /* So that we inherit the color of other text */ 65 | } 66 | 67 | details.toggle-details .tb-icon { 68 | height: 1.3em; 69 | width: 1.3em; 70 | } 71 | 72 | .toggle-button-hidden .tb-icon { 73 | transform: rotate(90deg); 74 | } 75 | 76 | /** 77 | * Details-based toggles. 78 | * In this case, we wrap elements with `.toggle` in a details block. 79 | */ 80 | 81 | /* Details blocks */ 82 | details.toggle-details { 83 | margin: 1em 0; 84 | } 85 | 86 | details.toggle-details summary { 87 | display: flex; 88 | align-items: center; 89 | width: fit-content; 90 | cursor: pointer; 91 | list-style: none; 92 | border-radius: .4em; 93 | border: 1px solid #ccc; 94 | background: #f8f8f8; 95 | padding: 0.4em 1em 0.4em 0.5em; /* Less padding on left because the SVG has left margin */ 96 | font-size: .9em; 97 | } 98 | 99 | details.toggle-details summary:hover { 100 | background: #f6f6f6; 101 | } 102 | 103 | details.toggle-details summary:active { 104 | background: #eee; 105 | } 106 | 107 | details.toggle-details[open] summary { 108 | margin-bottom: .5em; 109 | } 110 | 111 | details.toggle-details[open] summary .tb-icon { 112 | transform: rotate(90deg); 113 | } 114 | 115 | details.toggle-details[open] summary ~ * { 116 | animation: toggle-fade-in .3s ease-out; 117 | } 118 | 119 | @keyframes toggle-fade-in { 120 | from {opacity: 0%;} 121 | to {opacity: 100%;} 122 | } 123 | 124 | /* Print rules - we hide all toggle button elements at print */ 125 | @media print { 126 | /* Always hide the summary so the button doesn't show up */ 127 | details.toggle-details summary { 128 | display: none; 129 | } 130 | } -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/ssm_intro.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # (sec:ssm-intro)= 5 | # # What are State Space Models? 6 | # 7 | # 8 | # A state space model or SSM 9 | # is a partially observed Markov model, 10 | # in which the hidden state, $\hidden_t$, 11 | # evolves over time according to a Markov process, 12 | # possibly conditional on external inputs or controls $\input_t$, 13 | # and each hidden state generates some 14 | # observations $\obs_t$ at each time step. 15 | # (In this book, we mostly focus on discrete time systems, 16 | # although we consider the continuous-time case in XXX.) 17 | # We get to see the observations, but not the hidden state. 18 | # Our main goal is to infer the hidden state given the observations. 19 | # However, we can also use the model to predict future observations, 20 | # by first predicting future hidden states, and then predicting 21 | # what observations they might generate. 22 | # By using a hidden state $\hidden_t$ 23 | # to represent the past observations, $\obs_{1:t-1}$, 24 | # the model can have ``infinite'' memory, 25 | # unlike a standard Markov model. 26 | # 27 | # ```{figure} /figures/SSM-AR-inputs.png 28 | # :height: 150px 29 | # :name: fig:ssm-ar 30 | # 31 | # Illustration of an SSM as a graphical model. 32 | # ``` 33 | # 34 | # 35 | # Formally we can define an SSM 36 | # as the following joint distribution: 37 | # ```{math} 38 | # :label: eq:SSM-ar 39 | # p(\obs_{1:T},\hidden_{1:T}|\inputs_{1:T}) 40 | # = \left[ p(\hidden_1|\inputs_1) \prod_{t=2}^{T} 41 | # p(\hidden_t|\hidden_{t-1},\inputs_t) \right] 42 | # \left[ \prod_{t=1}^T p(\obs_t|\hidden_t, \inputs_t, \obs_{t-1}) \right] 43 | # ``` 44 | # where $p(\hidden_t|\hidden_{t-1},\inputs_t)$ is the 45 | # transition model, 46 | # $p(\obs_t|\hidden_t, \inputs_t, \obs_{t-1})$ is the 47 | # observation model, 48 | # and $\inputs_{t}$ is an optional input or action. 49 | # See {numref}`fig:ssm-ar` 50 | # for an illustration of the corresponding graphical model. 51 | # 52 | # 53 | # We often consider a simpler setting in which the 54 | # observations are conditionally independent of each other 55 | # (rather than having Markovian dependencies) given the hidden state. 56 | # In this case the joint simplifies to 57 | # ```{math} 58 | # :label: eq:SSM-input 59 | # p(\obs_{1:T},\hidden_{1:T}|\inputs_{1:T}) 60 | # = \left[ p(\hidden_1|\inputs_1) \prod_{t=2}^{T} 61 | # p(\hidden_t|\hidden_{t-1},\inputs_t) \right] 62 | # \left[ \prod_{t=1}^T p(\obs_t|\hidden_t, \inputs_t) \right] 63 | # ``` 64 | # Sometimes there are no external inputs, so the model further 65 | # simplifies to the following unconditional generative model: 66 | # ```{math} 67 | # :label: eq:SSM-no-input 68 | # p(\obs_{1:T},\hidden_{1:T}) 69 | # = \left[ p(\hidden_1) \prod_{t=2}^{T} 70 | # p(\hidden_t|\hidden_{t-1}) \right] 71 | # \left[ \prod_{t=1}^T p(\obs_t|\hidden_t) \right] 72 | # ``` 73 | # See {numref}`ssm-simplified` 74 | # for an illustration of the corresponding graphical model. 75 | # 76 | # 77 | # ```{figure} /figures/SSM-simplified.png 78 | # :height: 150px 79 | # :name: ssm-simplified 80 | # 81 | # Illustration of a simplified SSM. 82 | # ``` 83 | # 84 | # SSMs are widely used in many areas of science, engineering, finance, economics, etc. 85 | # The main applications are state estimation (i.e., inferring the underlying hidden state of the system given the observation), 86 | # forecasting (i.e., predicting future states and observations), and control (i.e., inferring the sequence of inputs that will 87 | # give rise to a desired target state). We will discuss these applications in later chapters. 88 | 89 | # 90 | -------------------------------------------------------------------------------- /_build/html/reports/hmm.log: -------------------------------------------------------------------------------- 1 | Traceback (most recent call last): 2 | File "/opt/anaconda3/lib/python3.8/site-packages/jupyter_cache/executors/utils.py", line 51, in single_nb_execution 3 | executenb( 4 | File "/opt/anaconda3/lib/python3.8/site-packages/nbclient/client.py", line 1087, in execute 5 | return NotebookClient(nb=nb, resources=resources, km=km, **kwargs).execute() 6 | File "/opt/anaconda3/lib/python3.8/site-packages/nbclient/util.py", line 74, in wrapped 7 | return just_run(coro(*args, **kwargs)) 8 | File "/opt/anaconda3/lib/python3.8/site-packages/nbclient/util.py", line 53, in just_run 9 | return loop.run_until_complete(coro) 10 | File "/opt/anaconda3/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete 11 | return future.result() 12 | File "/opt/anaconda3/lib/python3.8/site-packages/nbclient/client.py", line 540, in async_execute 13 | await self.async_execute_cell( 14 | File "/opt/anaconda3/lib/python3.8/site-packages/nbclient/client.py", line 832, in async_execute_cell 15 | self._check_raise_for_error(cell, exec_reply) 16 | File "/opt/anaconda3/lib/python3.8/site-packages/nbclient/client.py", line 740, in _check_raise_for_error 17 | raise CellExecutionError.from_cell_and_msg(cell, exec_reply['content']) 18 | nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell: 19 | ------------------ 20 | 21 | 22 | import collections 23 | def compute_counts(state_seq, nstates): 24 | wseq = np.array(state_seq) 25 | word_pairs = [pair for pair in zip(wseq[:-1], wseq[1:])] 26 | counter_pairs = collections.Counter(word_pairs) 27 | counts = np.zeros((nstates, nstates)) 28 | for (k,v) in counter_pairs.items(): 29 | counts[k[0], k[1]] = v 30 | return counts 31 | 32 | 33 | def normalize(u, axis=0, eps=1e-15): 34 | u = jnp.where(u == 0, 0, jnp.where(u < eps, eps, u)) 35 | c = u.sum(axis=axis) 36 | c = jnp.where(c == 0, 1, c) 37 | return u / c, c 38 | 39 | def normalize_counts(counts): 40 | ncounts = vmap(lambda v: normalize(v)[0], in_axes=0)(counts) 41 | return ncounts 42 | 43 | init_dist = jnp.array([1.0, 0.0]) 44 | trans_mat = jnp.array([[0.7, 0.3], [0.5, 0.5]]) 45 | obs_mat = jnp.eye(2) 46 | 47 | hmm = HMM(trans_dist=distrax.Categorical(probs=trans_mat), 48 | init_dist=distrax.Categorical(probs=init_dist), 49 | obs_dist=distrax.Categorical(probs=obs_mat)) 50 | 51 | rng_key = jax.random.PRNGKey(0) 52 | seq_len = 500 53 | state_seq, _ = hmm.sample(seed=PRNGKey(seed), seq_len=seq_len) 54 | 55 | counts = compute_counts(state_seq, nstates=2) 56 | print(counts) 57 | 58 | trans_mat_empirical = normalize_counts(counts) 59 | print(trans_mat_empirical) 60 | 61 | assert jnp.allclose(trans_mat, trans_mat_empirical, atol=1e-1) 62 | ------------------ 63 | 64 | --------------------------------------------------------------------------- 65 | NameError Traceback (most recent call last) 66 |  in  67 |  30 rng_key = jax.random.PRNGKey(0) 68 |  31 seq_len = 500 69 | ---> 32 state_seq, _ = hmm.sample(seed=PRNGKey(seed), seq_len=seq_len) 70 |  33  71 |  34 counts = compute_counts(state_seq, nstates=2) 72 | 73 | NameError: name 'PRNGKey' is not defined 74 | NameError: name 'PRNGKey' is not defined 75 | 76 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/scratchpad.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # In[1]: 5 | 6 | 7 | ### Import standard libraries 8 | 9 | import abc 10 | from dataclasses import dataclass 11 | import functools 12 | from functools import partial 13 | import itertools 14 | import matplotlib.pyplot as plt 15 | import numpy as np 16 | from typing import Any, Callable, NamedTuple, Optional, Union, Tuple 17 | 18 | import jax 19 | import jax.numpy as jnp 20 | from jax import lax, vmap, jit, grad 21 | #from jax.scipy.special import logit 22 | #from jax.nn import softmax 23 | import jax.random as jr 24 | 25 | 26 | 27 | import distrax 28 | import optax 29 | 30 | import jsl 31 | import ssm_jax 32 | 33 | 34 | # In[2]: 35 | 36 | 37 | import inspect 38 | import inspect as py_inspect 39 | import rich 40 | from rich import inspect as r_inspect 41 | from rich import print as r_print 42 | 43 | def print_source(fname): 44 | r_print(py_inspect.getsource(fname)) 45 | 46 | 47 | # In[3]: 48 | 49 | 50 | # meta-data does not work yet in VScode 51 | # https://github.com/microsoft/vscode-jupyter/issues/1121 52 | 53 | { 54 | "tags": [ 55 | "hide-cell" 56 | ] 57 | } 58 | 59 | 60 | ### Install necessary libraries 61 | 62 | try: 63 | import jax 64 | except: 65 | # For cuda version, see https://github.com/google/jax#installation 66 | get_ipython().run_line_magic('pip', 'install --upgrade "jax[cpu]"') 67 | import jax 68 | 69 | try: 70 | import distrax 71 | except: 72 | get_ipython().run_line_magic('pip', 'install --upgrade distrax') 73 | import distrax 74 | 75 | try: 76 | import jsl 77 | except: 78 | get_ipython().run_line_magic('pip', 'install git+https://github.com/probml/jsl') 79 | import jsl 80 | 81 | try: 82 | import rich 83 | except: 84 | get_ipython().run_line_magic('pip', 'install rich') 85 | import rich 86 | 87 | 88 | 89 | # In[ ]: 90 | 91 | 92 | 93 | 94 | 95 | # In[4]: 96 | 97 | 98 | { 99 | "tags": [ 100 | "hide-cell" 101 | ] 102 | } 103 | 104 | 105 | ### Import standard libraries 106 | 107 | import abc 108 | from dataclasses import dataclass 109 | import functools 110 | import itertools 111 | 112 | from typing import Any, Callable, NamedTuple, Optional, Union, Tuple 113 | 114 | import matplotlib.pyplot as plt 115 | import numpy as np 116 | 117 | 118 | import jax 119 | import jax.numpy as jnp 120 | from jax import lax, vmap, jit, grad 121 | from jax.scipy.special import logit 122 | from jax.nn import softmax 123 | from functools import partial 124 | from jax.random import PRNGKey, split 125 | 126 | import inspect 127 | import inspect as py_inspect 128 | import rich 129 | from rich import inspect as r_inspect 130 | from rich import print as r_print 131 | 132 | def print_source(fname): 133 | r_print(py_inspect.getsource(fname)) 134 | 135 | 136 | # In[5]: 137 | 138 | 139 | import ssm_jax 140 | from ssm_jax.hmm.models import GaussianHMM 141 | 142 | print_source(GaussianHMM) 143 | 144 | 145 | # In[6]: 146 | 147 | 148 | # Set dimensions 149 | num_states = 5 150 | emission_dim = 2 151 | 152 | # Specify parameters of the HMM 153 | initial_probs = jnp.ones(num_states) / num_states 154 | transition_matrix = 0.95 * jnp.eye(num_states) + 0.05 * jnp.roll(jnp.eye(num_states), 1, axis=1) 155 | emission_means = jnp.column_stack([ 156 | jnp.cos(jnp.linspace(0, 2 * jnp.pi, num_states+1))[:-1], 157 | jnp.sin(jnp.linspace(0, 2 * jnp.pi, num_states+1))[:-1] 158 | ]) 159 | emission_covs = jnp.tile(0.1**2 * jnp.eye(emission_dim), (num_states, 1, 1)) 160 | 161 | hmm = GaussianHMM(initial_probs, 162 | transition_matrix, 163 | emission_means, 164 | emission_covs) 165 | 166 | print_source(hmm.sample) 167 | 168 | 169 | # In[7]: 170 | 171 | 172 | import distrax 173 | from distrax import HMM 174 | 175 | A = np.array([ 176 | [0.95, 0.05], 177 | [0.10, 0.90] 178 | ]) 179 | 180 | # observation matrix 181 | B = np.array([ 182 | [1/6, 1/6, 1/6, 1/6, 1/6, 1/6], # fair die 183 | [1/10, 1/10, 1/10, 1/10, 1/10, 5/10] # loaded die 184 | ]) 185 | 186 | pi = np.array([0.5, 0.5]) 187 | 188 | (nstates, nobs) = np.shape(B) 189 | 190 | hmm = HMM(trans_dist=distrax.Categorical(probs=A), 191 | init_dist=distrax.Categorical(probs=pi), 192 | obs_dist=distrax.Categorical(probs=B)) 193 | 194 | print(hmm) 195 | 196 | 197 | # In[8]: 198 | 199 | 200 | print_source(hmm.sample) 201 | 202 | 203 | # In[ ]: 204 | 205 | 206 | 207 | 208 | -------------------------------------------------------------------------------- /_build/html/_static/sphinx-thebe.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Add attributes to Thebe blocks to initialize thebe properly 3 | */ 4 | var configureThebe = () => { 5 | // Load thebe config in case we want to update it as some point 6 | console.log("[sphinx-thebe]: Loading thebe config..."); 7 | thebe_config = $('script[type="text/x-thebe-config"]')[0]; 8 | 9 | // If we already detect a Thebe cell, don't re-run 10 | if (document.querySelectorAll("div.thebe-cell").length > 0) { 11 | return; 12 | } 13 | 14 | // Update thebe buttons with loading message 15 | $(".thebe-launch-button").each((ii, button) => { 16 | button.innerHTML = ` 17 |
18 |
19 |
20 |
21 |
22 |
23 | `; 24 | }); 25 | 26 | // Set thebe event hooks 27 | var thebeStatus; 28 | thebelab.on("status", function (evt, data) { 29 | console.log("Status changed:", data.status, data.message); 30 | 31 | $(".thebe-launch-button ") 32 | .removeClass("thebe-status-" + thebeStatus) 33 | .addClass("thebe-status-" + data.status) 34 | .find(".loading-text") 35 | .html( 36 | "Launching from mybinder.org: " + 37 | data.status + 38 | "" 39 | ); 40 | 41 | // Now update our thebe status 42 | thebeStatus = data.status; 43 | 44 | // Find any cells with an initialization tag and ask thebe to run them when ready 45 | if (data.status === "ready") { 46 | var thebeInitCells = document.querySelectorAll( 47 | ".thebe-init, .tag_thebe-init" 48 | ); 49 | thebeInitCells.forEach((cell) => { 50 | console.log("Initializing Thebe with cell: " + cell.id); 51 | cell.querySelector(".thebelab-run-button").click(); 52 | }); 53 | } 54 | }); 55 | }; 56 | 57 | /** 58 | * Update the page DOM to use Thebe elements 59 | */ 60 | var modifyDOMForThebe = () => { 61 | // Find all code cells, replace with Thebe interactive code cells 62 | const codeCells = document.querySelectorAll(thebe_selector); 63 | codeCells.forEach((codeCell, index) => { 64 | const codeCellId = (index) => `codecell${index}`; 65 | codeCell.id = codeCellId(index); 66 | codeCellText = codeCell.querySelector(thebe_selector_input); 67 | codeCellOutput = codeCell.querySelector(thebe_selector_output); 68 | 69 | // Clean up the language to make it work w/ CodeMirror and add it to the cell 70 | dataLanguage = detectLanguage(kernelName); 71 | 72 | // Re-arrange the cell and add metadata 73 | if (codeCellText) { 74 | codeCellText.setAttribute("data-language", dataLanguage); 75 | codeCellText.setAttribute("data-executable", "true"); 76 | 77 | // If we had an output, insert it just after the `pre` cell 78 | if (codeCellOutput) { 79 | $(codeCellOutput).attr("data-output", ""); 80 | $(codeCellOutput).insertAfter(codeCellText); 81 | } 82 | } 83 | 84 | // Remove sphinx-copybutton blocks, which are common in Sphinx 85 | codeCell.querySelectorAll("button.copybtn").forEach((el) => { 86 | el.remove(); 87 | }); 88 | }); 89 | }; 90 | 91 | var initThebe = () => { 92 | // Load thebe dynamically if it's not already loaded 93 | if (typeof thebelab === "undefined") { 94 | console.log("[sphinx-thebe]: Loading thebe from CDN..."); 95 | $(".thebe-launch-button ").text("Loading thebe from CDN..."); 96 | 97 | const script = document.createElement("script"); 98 | script.src = `${THEBE_JS_URL}`; 99 | document.head.appendChild(script); 100 | 101 | // Runs once the script has finished loading 102 | script.addEventListener("load", () => { 103 | console.log("[sphinx-thebe]: Finished loading thebe from CDN..."); 104 | configureThebe(); 105 | modifyDOMForThebe(); 106 | thebelab.bootstrap(); 107 | }); 108 | } else { 109 | console.log( 110 | "[sphinx-thebe]: thebe already loaded, not loading from CDN..." 111 | ); 112 | configureThebe(); 113 | modifyDOMForThebe(); 114 | thebelab.bootstrap(); 115 | } 116 | }; 117 | 118 | // Helper function to munge the language name 119 | var detectLanguage = (language) => { 120 | if (language.indexOf("python") > -1) { 121 | language = "python"; 122 | } else if (language === "ir") { 123 | language = "r"; 124 | } 125 | return language; 126 | }; 127 | -------------------------------------------------------------------------------- /chapters/ssm/learning.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "### Import standard libraries\n", 10 | "\n", 11 | "import abc\n", 12 | "from dataclasses import dataclass\n", 13 | "import functools\n", 14 | "from functools import partial\n", 15 | "import itertools\n", 16 | "import matplotlib.pyplot as plt\n", 17 | "import numpy as np\n", 18 | "from typing import Any, Callable, NamedTuple, Optional, Union, Tuple\n", 19 | "\n", 20 | "import jax\n", 21 | "import jax.numpy as jnp\n", 22 | "from jax import lax, vmap, jit, grad\n", 23 | "#from jax.scipy.special import logit\n", 24 | "#from jax.nn import softmax\n", 25 | "import jax.random as jr\n", 26 | "\n", 27 | "\n", 28 | "\n", 29 | "import distrax\n", 30 | "import optax\n", 31 | "\n", 32 | "import jsl\n", 33 | "import ssm_jax\n", 34 | "\n" 35 | ] 36 | }, 37 | { 38 | "cell_type": "markdown", 39 | "metadata": {}, 40 | "source": [ 41 | "(sec:learning)=\n", 42 | "# Parameter estimation (learning)\n", 43 | "\n", 44 | "\n", 45 | "So far, we have assumed that the parameters $\\params$ of the SSM are known.\n", 46 | "For example, in the case of an HMM with categorical observations\n", 47 | "we have $\\params = (\\hmmInit, \\hmmTrans, \\hmmObs)$,\n", 48 | "and in the case of an LDS, we have $\\params = \n", 49 | "(\\ldsTrans, \\ldsObs, \\ldsTransIn, \\ldsObsIn, \\transCov, \\obsCov, \\initMean, \\initCov)$.\n", 50 | "If we adopt a Bayesian perspective, we can view these parameters as random variables that are\n", 51 | "shared across all time steps, and across all sequences.\n", 52 | "This is shown in {numref}`fig:hmm-plates`, where we adopt $\\keyword{plate notation}$\n", 53 | "to represent repetitive structure.\n", 54 | "\n", 55 | "```{figure} /figures/hmmDgmPlatesY.png\n", 56 | ":scale: 100%\n", 57 | ":name: fig:hmm-plates\n", 58 | "\n", 59 | "Illustration of an HMM using plate notation, where we show the parameter\n", 60 | "nodes which are shared across all the sequences.\n", 61 | "```\n", 62 | "\n", 63 | "Suppose we observe $N$ sequences $\\data = \\{\\obs_{n,1:T_n}: n=1:N\\}$.\n", 64 | "Then the goal of $\\keyword{parameter estimation}$, also called $\\keyword{model learning}$\n", 65 | "or $\\keyword{model fitting}$, is to approximate the posterior\n", 66 | "\\begin{align}\n", 67 | "p(\\params|\\data) \\propto p(\\params) \\prod_{n=1}^N p(\\obs_{n,1:T_n} | \\params)\n", 68 | "\\end{align}\n", 69 | "where $p(\\obs_{n,1:T_n} | \\params)$ is the marginal likelihood of sequence $n$:\n", 70 | "\\begin{align}\n", 71 | "p(\\obs_{1:T} | \\params) = \\int p(\\hidden_{1:T}, \\obs_{1:T} | \\params) d\\hidden_{1:T}\n", 72 | "\\end{align}\n", 73 | "\n", 74 | "Since computing the full posterior is computationally difficult, we often settle for computing\n", 75 | "a point estimate such as the MAP (maximum a posterior) estimate\n", 76 | "\\begin{align}\n", 77 | "\\params_{\\map} = \\arg \\max_{\\params} \\log p(\\params) + \\sum_{n=1}^N \\log p(\\obs_{n,1:T_n} | \\params)\n", 78 | "\\end{align}\n", 79 | "If we ignore the prior term, we get the maximum likelihood estimate or MLE:\n", 80 | "\\begin{align}\n", 81 | "\\params_{\\mle} = \\arg \\max_{\\params} \\sum_{n=1}^N \\log p(\\obs_{n,1:T_n} | \\params)\n", 82 | "\\end{align}\n", 83 | "In practice, the MAP estimate often works better than the MLE, since the prior can regularize\n", 84 | "the estimate to ensure the model is numerically stable and does not overfit the training set.\n", 85 | "\n", 86 | "We will discuss a variety of algorithms for parameter estimation in later chapters.\n", 87 | "\n" 88 | ] 89 | } 90 | ], 91 | "metadata": { 92 | "interpreter": { 93 | "hash": "6407c60499271029b671b4ff687c4ed4626355c45fd34c44476827f4be42c4d7" 94 | }, 95 | "kernelspec": { 96 | "display_name": "Python 3.9.2 ('spyder-dev')", 97 | "language": "python", 98 | "name": "python3" 99 | }, 100 | "language_info": { 101 | "codemirror_mode": { 102 | "name": "ipython", 103 | "version": 3 104 | }, 105 | "file_extension": ".py", 106 | "mimetype": "text/x-python", 107 | "name": "python", 108 | "nbconvert_exporter": "python", 109 | "pygments_lexer": "ipython3", 110 | "version": "3.9.2" 111 | } 112 | }, 113 | "nbformat": 4, 114 | "nbformat_minor": 4 115 | } 116 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/learning.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "### Import standard libraries\n", 10 | "\n", 11 | "import abc\n", 12 | "from dataclasses import dataclass\n", 13 | "import functools\n", 14 | "from functools import partial\n", 15 | "import itertools\n", 16 | "import matplotlib.pyplot as plt\n", 17 | "import numpy as np\n", 18 | "from typing import Any, Callable, NamedTuple, Optional, Union, Tuple\n", 19 | "\n", 20 | "import jax\n", 21 | "import jax.numpy as jnp\n", 22 | "from jax import lax, vmap, jit, grad\n", 23 | "#from jax.scipy.special import logit\n", 24 | "#from jax.nn import softmax\n", 25 | "import jax.random as jr\n", 26 | "\n", 27 | "\n", 28 | "\n", 29 | "import distrax\n", 30 | "import optax\n", 31 | "\n", 32 | "import jsl\n", 33 | "import ssm_jax\n", 34 | "\n" 35 | ] 36 | }, 37 | { 38 | "cell_type": "markdown", 39 | "metadata": {}, 40 | "source": [ 41 | "(sec:learning)=\n", 42 | "# Parameter estimation (learning)\n", 43 | "\n", 44 | "\n", 45 | "So far, we have assumed that the parameters $\\params$ of the SSM are known.\n", 46 | "For example, in the case of an HMM with categorical observations\n", 47 | "we have $\\params = (\\hmmInit, \\hmmTrans, \\hmmObs)$,\n", 48 | "and in the case of an LDS, we have $\\params = \n", 49 | "(\\ldsTrans, \\ldsObs, \\ldsTransIn, \\ldsObsIn, \\transCov, \\obsCov, \\initMean, \\initCov)$.\n", 50 | "If we adopt a Bayesian perspective, we can view these parameters as random variables that are\n", 51 | "shared across all time steps, and across all sequences.\n", 52 | "This is shown in {numref}`fig:hmm-plates`, where we adopt $\\keyword{plate notation}$\n", 53 | "to represent repetitive structure.\n", 54 | "\n", 55 | "```{figure} /figures/hmmDgmPlatesY.png\n", 56 | ":scale: 100%\n", 57 | ":name: fig:hmm-plates\n", 58 | "\n", 59 | "Illustration of an HMM using plate notation, where we show the parameter\n", 60 | "nodes which are shared across all the sequences.\n", 61 | "```\n", 62 | "\n", 63 | "Suppose we observe $N$ sequences $\\data = \\{\\obs_{n,1:T_n}: n=1:N\\}$.\n", 64 | "Then the goal of $\\keyword{parameter estimation}$, also called $\\keyword{model learning}$\n", 65 | "or $\\keyword{model fitting}$, is to approximate the posterior\n", 66 | "\\begin{align}\n", 67 | "p(\\params|\\data) \\propto p(\\params) \\prod_{n=1}^N p(\\obs_{n,1:T_n} | \\params)\n", 68 | "\\end{align}\n", 69 | "where $p(\\obs_{n,1:T_n} | \\params)$ is the marginal likelihood of sequence $n$:\n", 70 | "\\begin{align}\n", 71 | "p(\\obs_{1:T} | \\params) = \\int p(\\hidden_{1:T}, \\obs_{1:T} | \\params) d\\hidden_{1:T}\n", 72 | "\\end{align}\n", 73 | "\n", 74 | "Since computing the full posterior is computationally difficult, we often settle for computing\n", 75 | "a point estimate such as the MAP (maximum a posterior) estimate\n", 76 | "\\begin{align}\n", 77 | "\\params_{\\map} = \\arg \\max_{\\params} \\log p(\\params) + \\sum_{n=1}^N \\log p(\\obs_{n,1:T_n} | \\params)\n", 78 | "\\end{align}\n", 79 | "If we ignore the prior term, we get the maximum likelihood estimate or MLE:\n", 80 | "\\begin{align}\n", 81 | "\\params_{\\mle} = \\arg \\max_{\\params} \\sum_{n=1}^N \\log p(\\obs_{n,1:T_n} | \\params)\n", 82 | "\\end{align}\n", 83 | "In practice, the MAP estimate often works better than the MLE, since the prior can regularize\n", 84 | "the estimate to ensure the model is numerically stable and does not overfit the training set.\n", 85 | "\n", 86 | "We will discuss a variety of algorithms for parameter estimation in later chapters.\n", 87 | "\n" 88 | ] 89 | } 90 | ], 91 | "metadata": { 92 | "interpreter": { 93 | "hash": "6407c60499271029b671b4ff687c4ed4626355c45fd34c44476827f4be42c4d7" 94 | }, 95 | "kernelspec": { 96 | "display_name": "Python 3.9.2 ('spyder-dev')", 97 | "language": "python", 98 | "name": "python3" 99 | }, 100 | "language_info": { 101 | "codemirror_mode": { 102 | "name": "ipython", 103 | "version": 3 104 | }, 105 | "file_extension": ".py", 106 | "mimetype": "text/x-python", 107 | "name": "python", 108 | "nbconvert_exporter": "python", 109 | "pygments_lexer": "ipython3", 110 | "version": "3.8.5" 111 | } 112 | }, 113 | "nbformat": 4, 114 | "nbformat_minor": 4 115 | } -------------------------------------------------------------------------------- /_build/html/_sources/chapters/ssm/learning.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "### Import standard libraries\n", 10 | "\n", 11 | "import abc\n", 12 | "from dataclasses import dataclass\n", 13 | "import functools\n", 14 | "from functools import partial\n", 15 | "import itertools\n", 16 | "import matplotlib.pyplot as plt\n", 17 | "import numpy as np\n", 18 | "from typing import Any, Callable, NamedTuple, Optional, Union, Tuple\n", 19 | "\n", 20 | "import jax\n", 21 | "import jax.numpy as jnp\n", 22 | "from jax import lax, vmap, jit, grad\n", 23 | "#from jax.scipy.special import logit\n", 24 | "#from jax.nn import softmax\n", 25 | "import jax.random as jr\n", 26 | "\n", 27 | "\n", 28 | "\n", 29 | "import distrax\n", 30 | "import optax\n", 31 | "\n", 32 | "import jsl\n", 33 | "import ssm_jax\n", 34 | "\n" 35 | ] 36 | }, 37 | { 38 | "cell_type": "markdown", 39 | "metadata": {}, 40 | "source": [ 41 | "(sec:learning)=\n", 42 | "# Parameter estimation (learning)\n", 43 | "\n", 44 | "\n", 45 | "So far, we have assumed that the parameters $\\params$ of the SSM are known.\n", 46 | "For example, in the case of an HMM with categorical observations\n", 47 | "we have $\\params = (\\hmmInit, \\hmmTrans, \\hmmObs)$,\n", 48 | "and in the case of an LDS, we have $\\params = \n", 49 | "(\\ldsTrans, \\ldsObs, \\ldsTransIn, \\ldsObsIn, \\transCov, \\obsCov, \\initMean, \\initCov)$.\n", 50 | "If we adopt a Bayesian perspective, we can view these parameters as random variables that are\n", 51 | "shared across all time steps, and across all sequences.\n", 52 | "This is shown in {numref}`fig:hmm-plates`, where we adopt $\\keyword{plate notation}$\n", 53 | "to represent repetitive structure.\n", 54 | "\n", 55 | "```{figure} /figures/hmmDgmPlatesY.png\n", 56 | ":scale: 100%\n", 57 | ":name: fig:hmm-plates\n", 58 | "\n", 59 | "Illustration of an HMM using plate notation, where we show the parameter\n", 60 | "nodes which are shared across all the sequences.\n", 61 | "```\n", 62 | "\n", 63 | "Suppose we observe $N$ sequences $\\data = \\{\\obs_{n,1:T_n}: n=1:N\\}$.\n", 64 | "Then the goal of $\\keyword{parameter estimation}$, also called $\\keyword{model learning}$\n", 65 | "or $\\keyword{model fitting}$, is to approximate the posterior\n", 66 | "\\begin{align}\n", 67 | "p(\\params|\\data) \\propto p(\\params) \\prod_{n=1}^N p(\\obs_{n,1:T_n} | \\params)\n", 68 | "\\end{align}\n", 69 | "where $p(\\obs_{n,1:T_n} | \\params)$ is the marginal likelihood of sequence $n$:\n", 70 | "\\begin{align}\n", 71 | "p(\\obs_{1:T} | \\params) = \\int p(\\hidden_{1:T}, \\obs_{1:T} | \\params) d\\hidden_{1:T}\n", 72 | "\\end{align}\n", 73 | "\n", 74 | "Since computing the full posterior is computationally difficult, we often settle for computing\n", 75 | "a point estimate such as the MAP (maximum a posterior) estimate\n", 76 | "\\begin{align}\n", 77 | "\\params_{\\map} = \\arg \\max_{\\params} \\log p(\\params) + \\sum_{n=1}^N \\log p(\\obs_{n,1:T_n} | \\params)\n", 78 | "\\end{align}\n", 79 | "If we ignore the prior term, we get the maximum likelihood estimate or MLE:\n", 80 | "\\begin{align}\n", 81 | "\\params_{\\mle} = \\arg \\max_{\\params} \\sum_{n=1}^N \\log p(\\obs_{n,1:T_n} | \\params)\n", 82 | "\\end{align}\n", 83 | "In practice, the MAP estimate often works better than the MLE, since the prior can regularize\n", 84 | "the estimate to ensure the model is numerically stable and does not overfit the training set.\n", 85 | "\n", 86 | "We will discuss a variety of algorithms for parameter estimation in later chapters.\n", 87 | "\n" 88 | ] 89 | } 90 | ], 91 | "metadata": { 92 | "interpreter": { 93 | "hash": "6407c60499271029b671b4ff687c4ed4626355c45fd34c44476827f4be42c4d7" 94 | }, 95 | "kernelspec": { 96 | "display_name": "Python 3.9.2 ('spyder-dev')", 97 | "language": "python", 98 | "name": "python3" 99 | }, 100 | "language_info": { 101 | "codemirror_mode": { 102 | "name": "ipython", 103 | "version": 3 104 | }, 105 | "file_extension": ".py", 106 | "mimetype": "text/x-python", 107 | "name": "python", 108 | "nbconvert_exporter": "python", 109 | "pygments_lexer": "ipython3", 110 | "version": "3.9.2" 111 | } 112 | }, 113 | "nbformat": 4, 114 | "nbformat_minor": 4 115 | } 116 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | # Book settings 2 | # Learn more at https://jupyterbook.org/customize/config.html 3 | 4 | # Based on 5 | # https://github.com/code-first-ml/book1/blob/main/_config.yml 6 | 7 | title: "State Space Models: A Modern Approach" 8 | author: Kevin Murphy, Scott Linderman, et al. 9 | #logo: logo.png 10 | 11 | # Force re-execution of notebooks on each build. 12 | # See https://jupyterbook.org/content/execute.html 13 | execute: 14 | execute_notebooks: auto 15 | 16 | # Define the name of the latex output file for PDF builds 17 | latex: 18 | latex_documents: 19 | targetname: book.tex 20 | 21 | # Add a bibtex file so that we can create citations 22 | bibtex_bibfiles: 23 | - references.bib 24 | 25 | # Information about where the book exists on the web 26 | repository: 27 | url: https://github.com/probml/ssm-book 28 | branch: main 29 | 30 | launch_buttons: 31 | colab_url: "https://colab.research.google.com" 32 | 33 | # Add GitHub buttons to your book 34 | # See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository 35 | html: 36 | use_issues_button: true 37 | use_repository_button: true 38 | 39 | # https://github.com/QuantEcon/lecture-python-advanced.myst/blob/3a0b5b40dc627f9dfabdd7e84c0c67a171bca690/lectures/_config.yml#L71 40 | # https://jupyterbook.org/en/stable/content/math.html 41 | sphinx: 42 | config: 43 | mathjax_path: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js 44 | 45 | 46 | parse: 47 | myst_enable_extensions: 48 | - amsmath 49 | - colon_fence 50 | - dollarmath 51 | - linkify 52 | - substitution 53 | 54 | 55 | #https://jupyterbook.org/en/latest/advanced/sphinx.html 56 | sphinx: 57 | config: 58 | mathjax_config: 59 | tex: 60 | macros: 61 | "argmax": "arg\\,max" 62 | "argmin": "arg\\,min" 63 | "covMat": "\\boldsymbol{\\Sigma}" 64 | "data": "\\mathcal{D}" 65 | "defeq": "\\triangleq" 66 | "diag": "\\mathrm{diag}" 67 | "discreteState": "s" 68 | "dotstar": "\\odot" 69 | "floor": ["\\lfloor#1\\rfloor", 1] 70 | "gainMatrix": "\\mathbf{K}" 71 | "gainMatrixReverse": "\\mathbf{G}" 72 | "gauss": "\\mathcal{N}" 73 | "gaussInfo": "\\mathcal{N}_{\\text{info}}" 74 | "hidden": "\\mathbf{x}" 75 | "hiddenScalar": "x" 76 | "hmmInit": "\\boldsymbol{\\pi}" 77 | "hmmInitScalar": "\\pi" 78 | "hmmObs": "\\mathbf{B}" 79 | "hmmObsScalar": "B" 80 | "hmmTrans": "\\mathbf{A}" 81 | "hmmTransScalar": "A" 82 | "infoMat": "\\precMat" 83 | "input": "\\mathbf{u}" 84 | "inputs": "\\input" 85 | "inv": ["{#1}^{-1}", 1] 86 | "keyword": ["\\textbf{#1}", 1] 87 | "initMean": "\\boldsymbol{\\mean}_0" 88 | "initCov": "\\boldsymbol{\\covMat}_0" 89 | "ldsObs": "\\mathbf{H}" 90 | "ldsObsIn": "\\mathbf{D}" 91 | "ldsTrans": "\\mathbf{F}" 92 | "ldsTransIn": "\\mathbf{B}" 93 | "obsCov": "\\mathbf{R}" 94 | "obsNoise": "\\boldsymbol{r}" 95 | "map": "\\mathrm{map}" 96 | "measurementFn": "\\mathbf{h}" 97 | "mean": "\\boldsymbol{\\mu}" 98 | "mle": "\\mathrm{mle}" 99 | "nlatents": "n_x" 100 | "nhidden": "\\nlatents" 101 | "ninputs": "n_u" 102 | "nobs": "n_y" 103 | "nsymbols": "n_y" 104 | "nstates": "n_s" 105 | "obs": "\\mathbf{y}" 106 | "obsScalar": "y" 107 | "observed": "\\obs" 108 | "obsFn": "\\measurementFn" 109 | "params": "\\boldsymbol{\\theta}" 110 | "precMean": "\\boldsymbol{\\eta}" 111 | "precMat": "\\boldsymbol{\\Lambda}" 112 | "real": "\\mathbb{R}" 113 | "sigmoid": "\\sigma" 114 | "softmax": "\\boldsymbol{\\sigma}" 115 | "trans": "\\mathsf{T}" 116 | "transpose": ["{#1}^{\\trans}", 1] 117 | "transCov": "\\mathbf{Q}" 118 | "transFn": "\\mathbf{f}" 119 | "transNoise": "\\mathbf{q}" 120 | "valpha": "\\boldsymbol{\\alpha}" 121 | "vbeta": "\\boldsymbol{\\beta}" 122 | "vdelta": "\\boldsymbol{\\delta}" 123 | "vepsilon": "\\boldsymbol{\\epsilon}" 124 | "vlambda": "\\boldsymbol{\\lambda}" 125 | "vLambda": "\\boldsymbol{\\Lambda}" 126 | "vmu": "\\boldsymbol{\\mu}" 127 | "vpi": "\\boldsymbol{\\pi}" 128 | "vsigma": "\\boldsymbol{\\sigma}" 129 | "vSigma": "\\boldsymbol{\\Sigma}" 130 | "vone": "\\boldsymbol{1}" 131 | "vzero": "\\boldsymbol{0}" 132 | 133 | -------------------------------------------------------------------------------- /chapters/ssm/ssm_intro.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "(sec:ssm-intro)=\n", 8 | "# What are State Space Models?\n", 9 | "\n", 10 | "\n", 11 | "A state space model or SSM\n", 12 | "is a partially observed Markov model,\n", 13 | "in which the hidden state, $\\hidden_t$,\n", 14 | "evolves over time according to a Markov process,\n", 15 | "possibly conditional on external inputs or controls $\\input_t$,\n", 16 | "and each hidden state generates some\n", 17 | "observations $\\obs_t$ at each time step.\n", 18 | "(In this book, we mostly focus on discrete time systems,\n", 19 | "although we consider the continuous-time case in XXX.)\n", 20 | "We get to see the observations, but not the hidden state.\n", 21 | "Our main goal is to infer the hidden state given the observations.\n", 22 | "However, we can also use the model to predict future observations,\n", 23 | "by first predicting future hidden states, and then predicting\n", 24 | "what observations they might generate.\n", 25 | "By using a hidden state $\\hidden_t$\n", 26 | "to represent the past observations, $\\obs_{1:t-1}$,\n", 27 | "the model can have ``infinite'' memory,\n", 28 | "unlike a standard Markov model.\n", 29 | "\n", 30 | "```{figure} /figures/SSM-AR-inputs.png\n", 31 | ":height: 150px\n", 32 | ":name: fig:ssm-ar\n", 33 | "\n", 34 | "Illustration of an SSM as a graphical model.\n", 35 | "```\n", 36 | "\n", 37 | "\n", 38 | "Formally we can define an SSM \n", 39 | "as the following joint distribution:\n", 40 | "```{math}\n", 41 | ":label: eq:SSM-ar\n", 42 | "p(\\obs_{1:T},\\hidden_{1:T}|\\inputs_{1:T})\n", 43 | " = \\left[ p(\\hidden_1|\\inputs_1) \\prod_{t=2}^{T}\n", 44 | " p(\\hidden_t|\\hidden_{t-1},\\inputs_t) \\right]\n", 45 | " \\left[ \\prod_{t=1}^T p(\\obs_t|\\hidden_t, \\inputs_t, \\obs_{t-1}) \\right]\n", 46 | "```\n", 47 | "where $p(\\hidden_t|\\hidden_{t-1},\\inputs_t)$ is the\n", 48 | "transition model,\n", 49 | "$p(\\obs_t|\\hidden_t, \\inputs_t, \\obs_{t-1})$ is the\n", 50 | "observation model,\n", 51 | "and $\\inputs_{t}$ is an optional input or action.\n", 52 | "See {numref}`fig:ssm-ar` \n", 53 | "for an illustration of the corresponding graphical model.\n", 54 | "\n", 55 | "\n", 56 | "We often consider a simpler setting in which the\n", 57 | " observations are conditionally independent of each other\n", 58 | "(rather than having Markovian dependencies) given the hidden state.\n", 59 | "In this case the joint simplifies to \n", 60 | "```{math}\n", 61 | ":label: eq:SSM-input\n", 62 | "p(\\obs_{1:T},\\hidden_{1:T}|\\inputs_{1:T})\n", 63 | " = \\left[ p(\\hidden_1|\\inputs_1) \\prod_{t=2}^{T}\n", 64 | " p(\\hidden_t|\\hidden_{t-1},\\inputs_t) \\right]\n", 65 | " \\left[ \\prod_{t=1}^T p(\\obs_t|\\hidden_t, \\inputs_t) \\right]\n", 66 | "```\n", 67 | "Sometimes there are no external inputs, so the model further\n", 68 | "simplifies to the following unconditional generative model: \n", 69 | "```{math}\n", 70 | ":label: eq:SSM-no-input\n", 71 | "p(\\obs_{1:T},\\hidden_{1:T})\n", 72 | " = \\left[ p(\\hidden_1) \\prod_{t=2}^{T}\n", 73 | " p(\\hidden_t|\\hidden_{t-1}) \\right]\n", 74 | " \\left[ \\prod_{t=1}^T p(\\obs_t|\\hidden_t) \\right]\n", 75 | "```\n", 76 | "See {numref}`ssm-simplified` \n", 77 | "for an illustration of the corresponding graphical model.\n", 78 | "\n", 79 | "\n", 80 | "```{figure} /figures/SSM-simplified.png\n", 81 | ":height: 150px\n", 82 | ":name: ssm-simplified\n", 83 | "\n", 84 | "Illustration of a simplified SSM.\n", 85 | "```\n", 86 | "\n", 87 | "SSMs are widely used in many areas of science, engineering, finance, economics, etc.\n", 88 | "The main applications are state estimation (i.e., inferring the underlying hidden state of the system given the observation),\n", 89 | "forecasting (i.e., predicting future states and observations), and control (i.e., inferring the sequence of inputs that will\n", 90 | "give rise to a desired target state). We will discuss these applications in later chapters." 91 | ] 92 | }, 93 | { 94 | "cell_type": "markdown", 95 | "metadata": {}, 96 | "source": [] 97 | } 98 | ], 99 | "metadata": { 100 | "kernelspec": { 101 | "display_name": "Python 3", 102 | "language": "python", 103 | "name": "python3" 104 | }, 105 | "language_info": { 106 | "codemirror_mode": { 107 | "name": "ipython", 108 | "version": 3 109 | }, 110 | "file_extension": ".py", 111 | "mimetype": "text/x-python", 112 | "name": "python", 113 | "nbconvert_exporter": "python", 114 | "pygments_lexer": "ipython3", 115 | "version": "3.9.2" 116 | } 117 | }, 118 | "nbformat": 4, 119 | "nbformat_minor": 4 120 | } 121 | -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/ssm_intro.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "(sec:ssm-intro)=\n", 8 | "# What are State Space Models?\n", 9 | "\n", 10 | "\n", 11 | "A state space model or SSM\n", 12 | "is a partially observed Markov model,\n", 13 | "in which the hidden state, $\\hidden_t$,\n", 14 | "evolves over time according to a Markov process,\n", 15 | "possibly conditional on external inputs or controls $\\input_t$,\n", 16 | "and each hidden state generates some\n", 17 | "observations $\\obs_t$ at each time step.\n", 18 | "(In this book, we mostly focus on discrete time systems,\n", 19 | "although we consider the continuous-time case in XXX.)\n", 20 | "We get to see the observations, but not the hidden state.\n", 21 | "Our main goal is to infer the hidden state given the observations.\n", 22 | "However, we can also use the model to predict future observations,\n", 23 | "by first predicting future hidden states, and then predicting\n", 24 | "what observations they might generate.\n", 25 | "By using a hidden state $\\hidden_t$\n", 26 | "to represent the past observations, $\\obs_{1:t-1}$,\n", 27 | "the model can have ``infinite'' memory,\n", 28 | "unlike a standard Markov model.\n", 29 | "\n", 30 | "```{figure} /figures/SSM-AR-inputs.png\n", 31 | ":height: 150px\n", 32 | ":name: fig:ssm-ar\n", 33 | "\n", 34 | "Illustration of an SSM as a graphical model.\n", 35 | "```\n", 36 | "\n", 37 | "\n", 38 | "Formally we can define an SSM \n", 39 | "as the following joint distribution:\n", 40 | "```{math}\n", 41 | ":label: eq:SSM-ar\n", 42 | "p(\\obs_{1:T},\\hidden_{1:T}|\\inputs_{1:T})\n", 43 | " = \\left[ p(\\hidden_1|\\inputs_1) \\prod_{t=2}^{T}\n", 44 | " p(\\hidden_t|\\hidden_{t-1},\\inputs_t) \\right]\n", 45 | " \\left[ \\prod_{t=1}^T p(\\obs_t|\\hidden_t, \\inputs_t, \\obs_{t-1}) \\right]\n", 46 | "```\n", 47 | "where $p(\\hidden_t|\\hidden_{t-1},\\inputs_t)$ is the\n", 48 | "transition model,\n", 49 | "$p(\\obs_t|\\hidden_t, \\inputs_t, \\obs_{t-1})$ is the\n", 50 | "observation model,\n", 51 | "and $\\inputs_{t}$ is an optional input or action.\n", 52 | "See {numref}`fig:ssm-ar` \n", 53 | "for an illustration of the corresponding graphical model.\n", 54 | "\n", 55 | "\n", 56 | "We often consider a simpler setting in which the\n", 57 | " observations are conditionally independent of each other\n", 58 | "(rather than having Markovian dependencies) given the hidden state.\n", 59 | "In this case the joint simplifies to \n", 60 | "```{math}\n", 61 | ":label: eq:SSM-input\n", 62 | "p(\\obs_{1:T},\\hidden_{1:T}|\\inputs_{1:T})\n", 63 | " = \\left[ p(\\hidden_1|\\inputs_1) \\prod_{t=2}^{T}\n", 64 | " p(\\hidden_t|\\hidden_{t-1},\\inputs_t) \\right]\n", 65 | " \\left[ \\prod_{t=1}^T p(\\obs_t|\\hidden_t, \\inputs_t) \\right]\n", 66 | "```\n", 67 | "Sometimes there are no external inputs, so the model further\n", 68 | "simplifies to the following unconditional generative model: \n", 69 | "```{math}\n", 70 | ":label: eq:SSM-no-input\n", 71 | "p(\\obs_{1:T},\\hidden_{1:T})\n", 72 | " = \\left[ p(\\hidden_1) \\prod_{t=2}^{T}\n", 73 | " p(\\hidden_t|\\hidden_{t-1}) \\right]\n", 74 | " \\left[ \\prod_{t=1}^T p(\\obs_t|\\hidden_t) \\right]\n", 75 | "```\n", 76 | "See {numref}`ssm-simplified` \n", 77 | "for an illustration of the corresponding graphical model.\n", 78 | "\n", 79 | "\n", 80 | "```{figure} /figures/SSM-simplified.png\n", 81 | ":height: 150px\n", 82 | ":name: ssm-simplified\n", 83 | "\n", 84 | "Illustration of a simplified SSM.\n", 85 | "```\n", 86 | "\n", 87 | "SSMs are widely used in many areas of science, engineering, finance, economics, etc.\n", 88 | "The main applications are state estimation (i.e., inferring the underlying hidden state of the system given the observation),\n", 89 | "forecasting (i.e., predicting future states and observations), and control (i.e., inferring the sequence of inputs that will\n", 90 | "give rise to a desired target state). We will discuss these applications in later chapters." 91 | ] 92 | }, 93 | { 94 | "cell_type": "markdown", 95 | "metadata": {}, 96 | "source": [] 97 | } 98 | ], 99 | "metadata": { 100 | "kernelspec": { 101 | "display_name": "Python 3", 102 | "language": "python", 103 | "name": "python3" 104 | }, 105 | "language_info": { 106 | "codemirror_mode": { 107 | "name": "ipython", 108 | "version": 3 109 | }, 110 | "file_extension": ".py", 111 | "mimetype": "text/x-python", 112 | "name": "python", 113 | "nbconvert_exporter": "python", 114 | "pygments_lexer": "ipython3", 115 | "version": "3.9.2" 116 | } 117 | }, 118 | "nbformat": 4, 119 | "nbformat_minor": 4 120 | } -------------------------------------------------------------------------------- /_build/html/_sources/chapters/ssm/ssm_intro.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "(sec:ssm-intro)=\n", 8 | "# What are State Space Models?\n", 9 | "\n", 10 | "\n", 11 | "A state space model or SSM\n", 12 | "is a partially observed Markov model,\n", 13 | "in which the hidden state, $\\hidden_t$,\n", 14 | "evolves over time according to a Markov process,\n", 15 | "possibly conditional on external inputs or controls $\\input_t$,\n", 16 | "and each hidden state generates some\n", 17 | "observations $\\obs_t$ at each time step.\n", 18 | "(In this book, we mostly focus on discrete time systems,\n", 19 | "although we consider the continuous-time case in XXX.)\n", 20 | "We get to see the observations, but not the hidden state.\n", 21 | "Our main goal is to infer the hidden state given the observations.\n", 22 | "However, we can also use the model to predict future observations,\n", 23 | "by first predicting future hidden states, and then predicting\n", 24 | "what observations they might generate.\n", 25 | "By using a hidden state $\\hidden_t$\n", 26 | "to represent the past observations, $\\obs_{1:t-1}$,\n", 27 | "the model can have ``infinite'' memory,\n", 28 | "unlike a standard Markov model.\n", 29 | "\n", 30 | "```{figure} /figures/SSM-AR-inputs.png\n", 31 | ":height: 150px\n", 32 | ":name: fig:ssm-ar\n", 33 | "\n", 34 | "Illustration of an SSM as a graphical model.\n", 35 | "```\n", 36 | "\n", 37 | "\n", 38 | "Formally we can define an SSM \n", 39 | "as the following joint distribution:\n", 40 | "```{math}\n", 41 | ":label: eq:SSM-ar\n", 42 | "p(\\obs_{1:T},\\hidden_{1:T}|\\inputs_{1:T})\n", 43 | " = \\left[ p(\\hidden_1|\\inputs_1) \\prod_{t=2}^{T}\n", 44 | " p(\\hidden_t|\\hidden_{t-1},\\inputs_t) \\right]\n", 45 | " \\left[ \\prod_{t=1}^T p(\\obs_t|\\hidden_t, \\inputs_t, \\obs_{t-1}) \\right]\n", 46 | "```\n", 47 | "where $p(\\hidden_t|\\hidden_{t-1},\\inputs_t)$ is the\n", 48 | "transition model,\n", 49 | "$p(\\obs_t|\\hidden_t, \\inputs_t, \\obs_{t-1})$ is the\n", 50 | "observation model,\n", 51 | "and $\\inputs_{t}$ is an optional input or action.\n", 52 | "See {numref}`fig:ssm-ar` \n", 53 | "for an illustration of the corresponding graphical model.\n", 54 | "\n", 55 | "\n", 56 | "We often consider a simpler setting in which the\n", 57 | " observations are conditionally independent of each other\n", 58 | "(rather than having Markovian dependencies) given the hidden state.\n", 59 | "In this case the joint simplifies to \n", 60 | "```{math}\n", 61 | ":label: eq:SSM-input\n", 62 | "p(\\obs_{1:T},\\hidden_{1:T}|\\inputs_{1:T})\n", 63 | " = \\left[ p(\\hidden_1|\\inputs_1) \\prod_{t=2}^{T}\n", 64 | " p(\\hidden_t|\\hidden_{t-1},\\inputs_t) \\right]\n", 65 | " \\left[ \\prod_{t=1}^T p(\\obs_t|\\hidden_t, \\inputs_t) \\right]\n", 66 | "```\n", 67 | "Sometimes there are no external inputs, so the model further\n", 68 | "simplifies to the following unconditional generative model: \n", 69 | "```{math}\n", 70 | ":label: eq:SSM-no-input\n", 71 | "p(\\obs_{1:T},\\hidden_{1:T})\n", 72 | " = \\left[ p(\\hidden_1) \\prod_{t=2}^{T}\n", 73 | " p(\\hidden_t|\\hidden_{t-1}) \\right]\n", 74 | " \\left[ \\prod_{t=1}^T p(\\obs_t|\\hidden_t) \\right]\n", 75 | "```\n", 76 | "See {numref}`ssm-simplified` \n", 77 | "for an illustration of the corresponding graphical model.\n", 78 | "\n", 79 | "\n", 80 | "```{figure} /figures/SSM-simplified.png\n", 81 | ":height: 150px\n", 82 | ":name: ssm-simplified\n", 83 | "\n", 84 | "Illustration of a simplified SSM.\n", 85 | "```\n", 86 | "\n", 87 | "SSMs are widely used in many areas of science, engineering, finance, economics, etc.\n", 88 | "The main applications are state estimation (i.e., inferring the underlying hidden state of the system given the observation),\n", 89 | "forecasting (i.e., predicting future states and observations), and control (i.e., inferring the sequence of inputs that will\n", 90 | "give rise to a desired target state). We will discuss these applications in later chapters." 91 | ] 92 | }, 93 | { 94 | "cell_type": "markdown", 95 | "metadata": {}, 96 | "source": [] 97 | } 98 | ], 99 | "metadata": { 100 | "kernelspec": { 101 | "display_name": "Python 3", 102 | "language": "python", 103 | "name": "python3" 104 | }, 105 | "language_info": { 106 | "codemirror_mode": { 107 | "name": "ipython", 108 | "version": 3 109 | }, 110 | "file_extension": ".py", 111 | "mimetype": "text/x-python", 112 | "name": "python", 113 | "nbconvert_exporter": "python", 114 | "pygments_lexer": "ipython3", 115 | "version": "3.9.2" 116 | } 117 | }, 118 | "nbformat": 4, 119 | "nbformat_minor": 4 120 | } 121 | -------------------------------------------------------------------------------- /_build/html/_static/pygments.css: -------------------------------------------------------------------------------- 1 | pre { line-height: 125%; } 2 | td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } 3 | span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } 4 | td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } 5 | span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } 6 | .highlight .hll { background-color: #ffffcc } 7 | .highlight { background: #eeffcc; } 8 | .highlight .c { color: #408090; font-style: italic } /* Comment */ 9 | .highlight .err { border: 1px solid #FF0000 } /* Error */ 10 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */ 11 | .highlight .o { color: #666666 } /* Operator */ 12 | .highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */ 13 | .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ 14 | .highlight .cp { color: #007020 } /* Comment.Preproc */ 15 | .highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */ 16 | .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ 17 | .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ 18 | .highlight .gd { color: #A00000 } /* Generic.Deleted */ 19 | .highlight .ge { font-style: italic } /* Generic.Emph */ 20 | .highlight .gr { color: #FF0000 } /* Generic.Error */ 21 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 22 | .highlight .gi { color: #00A000 } /* Generic.Inserted */ 23 | .highlight .go { color: #333333 } /* Generic.Output */ 24 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ 25 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 26 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 27 | .highlight .gt { color: #0044DD } /* Generic.Traceback */ 28 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ 29 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ 30 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ 31 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */ 32 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ 33 | .highlight .kt { color: #902000 } /* Keyword.Type */ 34 | .highlight .m { color: #208050 } /* Literal.Number */ 35 | .highlight .s { color: #4070a0 } /* Literal.String */ 36 | .highlight .na { color: #4070a0 } /* Name.Attribute */ 37 | .highlight .nb { color: #007020 } /* Name.Builtin */ 38 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ 39 | .highlight .no { color: #60add5 } /* Name.Constant */ 40 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ 41 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ 42 | .highlight .ne { color: #007020 } /* Name.Exception */ 43 | .highlight .nf { color: #06287e } /* Name.Function */ 44 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ 45 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ 46 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ 47 | .highlight .nv { color: #bb60d5 } /* Name.Variable */ 48 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ 49 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ 50 | .highlight .mb { color: #208050 } /* Literal.Number.Bin */ 51 | .highlight .mf { color: #208050 } /* Literal.Number.Float */ 52 | .highlight .mh { color: #208050 } /* Literal.Number.Hex */ 53 | .highlight .mi { color: #208050 } /* Literal.Number.Integer */ 54 | .highlight .mo { color: #208050 } /* Literal.Number.Oct */ 55 | .highlight .sa { color: #4070a0 } /* Literal.String.Affix */ 56 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ 57 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */ 58 | .highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */ 59 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ 60 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */ 61 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ 62 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ 63 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ 64 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */ 65 | .highlight .sr { color: #235388 } /* Literal.String.Regex */ 66 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */ 67 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */ 68 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ 69 | .highlight .fm { color: #06287e } /* Name.Function.Magic */ 70 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ 71 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ 72 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ 73 | .highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */ 74 | .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ -------------------------------------------------------------------------------- /_build/jupyter_execute/chapters/ssm/nlds.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # In[1]: 5 | 6 | 7 | # meta-data does not work yet in VScode 8 | # https://github.com/microsoft/vscode-jupyter/issues/1121 9 | 10 | { 11 | "tags": [ 12 | "hide-cell" 13 | ] 14 | } 15 | 16 | 17 | ### Install necessary libraries 18 | 19 | try: 20 | import jax 21 | except: 22 | # For cuda version, see https://github.com/google/jax#installation 23 | get_ipython().run_line_magic('pip', 'install --upgrade "jax[cpu]"') 24 | import jax 25 | 26 | try: 27 | import distrax 28 | except: 29 | get_ipython().run_line_magic('pip', 'install --upgrade distrax') 30 | import distrax 31 | 32 | try: 33 | import jsl 34 | except: 35 | get_ipython().run_line_magic('pip', 'install git+https://github.com/probml/jsl') 36 | import jsl 37 | 38 | try: 39 | import rich 40 | except: 41 | get_ipython().run_line_magic('pip', 'install rich') 42 | import rich 43 | 44 | 45 | 46 | # In[2]: 47 | 48 | 49 | { 50 | "tags": [ 51 | "hide-cell" 52 | ] 53 | } 54 | 55 | 56 | ### Import standard libraries 57 | 58 | import abc 59 | from dataclasses import dataclass 60 | import functools 61 | import itertools 62 | 63 | from typing import Any, Callable, NamedTuple, Optional, Union, Tuple 64 | 65 | import matplotlib.pyplot as plt 66 | import numpy as np 67 | 68 | 69 | import jax 70 | import jax.numpy as jnp 71 | from jax import lax, vmap, jit, grad 72 | from jax.scipy.special import logit 73 | from jax.nn import softmax 74 | from functools import partial 75 | from jax.random import PRNGKey, split 76 | 77 | import inspect 78 | import inspect as py_inspect 79 | import rich 80 | from rich import inspect as r_inspect 81 | from rich import print as r_print 82 | 83 | def print_source(fname): 84 | r_print(py_inspect.getsource(fname)) 85 | 86 | 87 | # (sec:nlds-intro)= 88 | # # Nonlinear Gaussian SSMs 89 | # 90 | # In this section, we consider SSMs in which the dynamics and/or observation models are nonlinear, 91 | # but the process noise and observation noise are Gaussian. 92 | # That is, 93 | # \begin{align} 94 | # \hidden_t &= \dynamicsFn(\hidden_{t-1}, \inputs_t) + \transNoise_t \\ 95 | # \obs_t &= \obsFn(\hidden_{t}, \inputs_t) + \obsNoise_t 96 | # \end{align} 97 | # where $\transNoise_t \sim \gauss(\vzero,\transCov)$ 98 | # and $\obsNoise_t \sim \gauss(\vzero,\obsCov)$. 99 | # This is a very widely used model class. We give some examples below. 100 | 101 | # (sec:pendulum)= 102 | # ## Example: tracking a 1d pendulum 103 | # 104 | # ```{figure} /figures/pendulum.png 105 | # :scale: 50% 106 | # :name: fig:pendulum 107 | # 108 | # Illustration of a pendulum swinging. 109 | # $g$ is the force of gravity, 110 | # $w(t)$ is a random external force, 111 | # and $\alpha$ is the angle wrt the vertical. 112 | # Based on {cite}`Sarkka13` fig 3.10. 113 | # ``` 114 | # 115 | # 116 | # % Sarka p45, p74 117 | # Consider a simple pendulum of unit mass and length swinging from 118 | # a fixed attachment, as in 119 | # {numref}`fig:pendulum`. 120 | # Such an object is in principle entirely deterministic in its behavior. 121 | # However, in the real world, there are often unknown forces at work 122 | # (e.g., air turbulence, friction). 123 | # We will model these by a continuous time random Gaussian noise process $w(t)$. 124 | # This gives rise to the following differential equation: 125 | # \begin{align} 126 | # \frac{d^2 \alpha}{d t^2} 127 | # = -g \sin(\alpha) + w(t) 128 | # \end{align} 129 | # We can write this as a nonlinear SSM by defining the state to be 130 | # $\hidden_1(t) = \alpha(t)$ and $\hidden_2(t) = d\alpha(t)/dt$. 131 | # Thus 132 | # \begin{align} 133 | # \frac{d \hidden}{dt} 134 | # = \begin{pmatrix} \hiddenScalar_2 \\ -g \sin(\hiddenScalar_1) \end{pmatrix} 135 | # + \begin{pmatrix} 0 \\ 1 \end{pmatrix} w(t) 136 | # \end{align} 137 | # If we discretize this step size $\Delta$, 138 | # we get the following 139 | # formulation {cite}`Sarkka13` p74: 140 | # \begin{align} 141 | # \underbrace{ 142 | # \begin{pmatrix} \hiddenScalar_{1,t} \\ \hiddenScalar_{2,t} \end{pmatrix} 143 | # }_{\hidden_t} 144 | # = 145 | # \underbrace{ 146 | # \begin{pmatrix} \hiddenScalar_{1,t-1} + \hiddenScalar_{2,t-1} \Delta \\ 147 | # \hiddenScalar_{2,t-1} -g \sin(\hiddenScalar_{1,t-1}) \Delta \end{pmatrix} 148 | # }_{\dynamicsFn(\hidden_{t-1})} 149 | # +\transNoise_{t-1} 150 | # \end{align} 151 | # where $\transNoise_{t-1} \sim \gauss(\vzero,\transCov)$ with 152 | # \begin{align} 153 | # \transCov = q^c \begin{pmatrix} 154 | # \frac{\Delta^3}{3} & \frac{\Delta^2}{2} \\ 155 | # \frac{\Delta^2}{2} & \Delta 156 | # \end{pmatrix} 157 | # \end{align} 158 | # where $q^c$ is the spectral density (continuous time variance) 159 | # of the continuous-time noise process. 160 | # 161 | # 162 | # If we observe the angular position, we 163 | # get the linear observation model 164 | # $\obsFn(\hidden_t) = \alpha_t = \hiddenScalar_{1,t}$. 165 | # If we only observe the horizontal position, 166 | # we get the nonlinear observation model 167 | # $\obsFn(\hidden_t) = \sin(\alpha_t) = \sin(\hiddenScalar_{1,t})$. 168 | # 169 | # 170 | # 171 | # 172 | # 173 | # 174 | --------------------------------------------------------------------------------