123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>Linear Gaussian SSMs — State Space Models: A Modern Approach</title>
-
- <link href="../../_static/css/theme.css" rel="stylesheet">
- <link href="../../_static/css/index.ff1ffe594081f20da1ef19478df9384b.css" rel="stylesheet">
-
- <link rel="stylesheet"
- href="../../_static/vendor/fontawesome/5.13.0/css/all.min.css">
- <link rel="preload" as="font" type="font/woff2" crossorigin
- href="../../_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff2">
- <link rel="preload" as="font" type="font/woff2" crossorigin
- href="../../_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2">
-
-
-
- <link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
- <link rel="stylesheet" type="text/css" href="../../_static/sphinx-book-theme.css?digest=c3fdc42140077d1ad13ad2f1588a4309" />
- <link rel="stylesheet" type="text/css" href="../../_static/togglebutton.css" />
- <link rel="stylesheet" type="text/css" href="../../_static/copybutton.css" />
- <link rel="stylesheet" type="text/css" href="../../_static/mystnb.css" />
- <link rel="stylesheet" type="text/css" href="../../_static/sphinx-thebe.css" />
- <link rel="stylesheet" type="text/css" href="../../_static/panels-main.c949a650a448cc0ae9fd3441c0e17fb0.css" />
- <link rel="stylesheet" type="text/css" href="../../_static/panels-variables.06eb56fa6e07937060861dad626602ad.css" />
-
- <link rel="preload" as="script" href="../../_static/js/index.be7d3bbb2ef33a8344ce.js">
- <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
- <script src="../../_static/jquery.js"></script>
- <script src="../../_static/underscore.js"></script>
- <script src="../../_static/doctools.js"></script>
- <script src="../../_static/clipboard.min.js"></script>
- <script src="../../_static/copybutton.js"></script>
- <script>let toggleHintShow = 'Click to show';</script>
- <script>let toggleHintHide = 'Click to hide';</script>
- <script>let toggleOpenOnPrint = 'true';</script>
- <script src="../../_static/togglebutton.js"></script>
- <script>var togglebuttonSelector = '.toggle, .admonition.dropdown, .tag_hide_input div.cell_input, .tag_hide-input div.cell_input, .tag_hide_output div.cell_output, .tag_hide-output div.cell_output, .tag_hide_cell.cell, .tag_hide-cell.cell';</script>
- <script src="../../_static/sphinx-book-theme.d59cb220de22ca1c485ebbdc042f0030.js"></script>
- <script>const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"
- const thebe_selector = ".thebe,.cell"
- const thebe_selector_input = "pre"
- const thebe_selector_output = ".output, .cell_output"
- </script>
- <script async="async" src="../../_static/sphinx-thebe.js"></script>
- <script>window.MathJax = {"tex": {"macros": {"covMat": "\\boldsymbol{\\Sigma}", "data": "\\mathcal{D}", "defeq": "\\triangleq", "diag": "\\mathrm{diag}", "discreteState": "s", "dotstar": "\\odot", "dynamicsFn": "\\mathbf{f}", "floor": ["\\lfloor#1\\rfloor", 1], "gainMatrix": "\\mathbf{K}", "gainMatrixReverse": "\\mathbf{G}", "gauss": "\\mathcal{N}", "gaussInfo": "\\mathcal{N}_{\\text{info}}", "hidden": "\\mathbf{x}", "hiddenScalar": "x", "hmmInit": "\\boldsymbol{\\pi}", "hmmInitScalar": "\\pi", "hmmObs": "\\mathbf{B}", "hmmObsScalar": "B", "hmmTrans": "\\mathbf{A}", "hmmTransScalar": "A", "infoMat": "\\precMat", "input": "\\mathbf{u}", "inputs": "\\input", "inv": ["{#1}^{-1}", 1], "keyword": ["\\textbf{#1}", 1], "ldsDyn": "\\mathbf{F}", "ldsDynIn": "\\mathbf{B}", "initMean": "\\boldsymbol{\\mean}_0", "initCov": "\\boldsymbol{\\covMat}_0", "ldsObs": "\\mathbf{H}", "ldsObsIn": "\\mathbf{D}", "ldsTrans": "\\ldsDyn", "ldsTransIn": "\\ldsDynIn", "obsCov": "\\mathbf{R}", "obsNoise": "\\boldsymbol{r}", "map": "\\mathrm{map}", "measurementFn": "\\mathbf{h}", "mean": "\\boldsymbol{\\mu}", "mle": "\\mathrm{mle}", "nlatents": "n_x", "nhidden": "\\nlatents", "ninputs": "n_u", "nobs": "n_y", "nsymbols": "n_y", "nstates": "n_s", "obs": "\\mathbf{y}", "obsScalar": "y", "observed": "\\obs", "obsFn": "\\measurementFn", "params": "\\boldsymbol{\\theta}", "precMean": "\\boldsymbol{\\eta}", "precMat": "\\boldsymbol{\\Lambda}", "real": "\\mathbb{R}", "sigmoid": "\\sigma", "softmax": "\\boldsymbol{\\sigma}", "trans": "\\mathsf{T}", "transpose": ["{#1}^{\\trans}", 1], "transCov": "\\mathbf{Q}", "transNoise": "\\mathbf{q}", "valpha": "\\boldsymbol{\\alpha}", "vbeta": "\\boldsymbol{\\beta}", "vdelta": "\\boldsymbol{\\delta}", "vepsilon": "\\boldsymbol{\\epsilon}", "vlambda": "\\boldsymbol{\\lambda}", "vLambda": "\\boldsymbol{\\Lambda}", "vmu": "\\boldsymbol{\\mu}", "vpi": "\\boldsymbol{\\pi}", "vsigma": "\\boldsymbol{\\sigma}", "vSigma": "\\boldsymbol{\\Sigma}", "vone": "\\boldsymbol{1}", "vzero": "\\boldsymbol{0}"}}, "options": {"processHtmlClass": "tex2jax_process|mathjax_process|math|output_area"}}</script>
- <script defer="defer" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
- <link rel="index" title="Index" href="../../genindex.html" />
- <link rel="search" title="Search" href="../../search.html" />
- <link rel="next" title="Nonlinear Gaussian SSMs" href="nlds.html" />
- <link rel="prev" title="Hidden Markov Models" href="hmm.html" />
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <meta name="docsearch:language" content="None">
-
- <!-- Google Analytics -->
-
- </head>
- <body data-spy="scroll" data-target="#bd-toc-nav" data-offset="80">
-
- <div class="container-fluid" id="banner"></div>
-
- <div class="container-xl">
- <div class="row">
-
- <div class="col-12 col-md-3 bd-sidebar site-navigation show" id="site-navigation">
-
- <div class="navbar-brand-box">
- <a class="navbar-brand text-wrap" href="../../index.html">
-
-
-
- <h1 class="site-logo" id="site-title">State Space Models: A Modern Approach</h1>
-
- </a>
- </div><form class="bd-search d-flex align-items-center" action="../../search.html" method="get">
- <i class="icon fas fa-search"></i>
- <input type="search" class="form-control" name="q" id="search-input" placeholder="Search this book..." aria-label="Search this book..." autocomplete="off" >
- </form><nav class="bd-links" id="bd-docs-nav" aria-label="Main">
- <div class="bd-toc-item active">
- <ul class="nav bd-sidenav">
- <li class="toctree-l1">
- <a class="reference internal" href="../../root.html">
- State Space Models: A Modern Approach
- </a>
- </li>
- </ul>
- <ul class="current nav bd-sidenav">
- <li class="toctree-l1 current active has-children">
- <a class="reference internal" href="ssm_index.html">
- State Space Models
- </a>
- <input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/>
- <label for="toctree-checkbox-1">
- <i class="fas fa-chevron-down">
- </i>
- </label>
- <ul class="current">
- <li class="toctree-l2">
- <a class="reference internal" href="ssm_intro.html">
- What are State Space Models?
- </a>
- </li>
- <li class="toctree-l2">
- <a class="reference internal" href="hmm.html">
- Hidden Markov Models
- </a>
- </li>
- <li class="toctree-l2 current active">
- <a class="current reference internal" href="#">
- Linear Gaussian SSMs
- </a>
- </li>
- <li class="toctree-l2">
- <a class="reference internal" href="nlds.html">
- Nonlinear Gaussian SSMs
- </a>
- </li>
- <li class="toctree-l2">
- <a class="reference internal" href="inference.html">
- States estimation (inference)
- </a>
- </li>
- <li class="toctree-l2">
- <a class="reference internal" href="learning.html">
- Parameter estimation (learning)
- </a>
- </li>
- </ul>
- </li>
- <li class="toctree-l1 has-children">
- <a class="reference internal" href="../hmm/hmm_index.html">
- Hidden Markov Models
- </a>
- <input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/>
- <label for="toctree-checkbox-2">
- <i class="fas fa-chevron-down">
- </i>
- </label>
- <ul>
- <li class="toctree-l2">
- <a class="reference internal" href="../hmm/hmm_filter.html">
- HMM filtering (forwards algorithm)
- </a>
- </li>
- <li class="toctree-l2">
- <a class="reference internal" href="../hmm/hmm_smoother.html">
- HMM smoothing (forwards-backwards algorithm)
- </a>
- </li>
- <li class="toctree-l2">
- <a class="reference internal" href="../hmm/hmm_viterbi.html">
- Viterbi algorithm
- </a>
- </li>
- <li class="toctree-l2">
- <a class="reference internal" href="../hmm/hmm_parallel.html">
- Parallel HMM smoothing
- </a>
- </li>
- <li class="toctree-l2">
- <a class="reference internal" href="../hmm/hmm_sampling.html">
- Forwards-filtering backwards-sampling algorithm
- </a>
- </li>
- </ul>
- </li>
- <li class="toctree-l1 has-children">
- <a class="reference internal" href="../lgssm/lgssm_index.html">
- Linear-Gaussian SSMs
- </a>
- <input class="toctree-checkbox" id="toctree-checkbox-3" name="toctree-checkbox-3" type="checkbox"/>
- <label for="toctree-checkbox-3">
- <i class="fas fa-chevron-down">
- </i>
- </label>
- <ul>
- <li class="toctree-l2">
- <a class="reference internal" href="../lgssm/kalman_filter.html">
- Kalman filtering
- </a>
- </li>
- <li class="toctree-l2">
- <a class="reference internal" href="../lgssm/kalman_smoother.html">
- Kalman (RTS) smoother
- </a>
- </li>
- <li class="toctree-l2">
- <a class="reference internal" href="../lgssm/kalman_parallel.html">
- Parallel Kalman Smoother
- </a>
- </li>
- <li class="toctree-l2">
- <a class="reference internal" href="../lgssm/kalman_sampling.html">
- Forwards-filtering backwards sampling
- </a>
- </li>
- </ul>
- </li>
- <li class="toctree-l1 has-children">
- <a class="reference internal" href="../extended/extended_index.html">
- Extended (linearized) methods
- </a>
- <input class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" type="checkbox"/>
- <label for="toctree-checkbox-4">
- <i class="fas fa-chevron-down">
- </i>
- </label>
- <ul>
- <li class="toctree-l2">
- <a class="reference internal" href="../extended/extended_filter.html">
- Extended Kalman filtering
- </a>
- </li>
- <li class="toctree-l2">
- <a class="reference internal" href="../extended/extended_smoother.html">
- Extended Kalman smoother
- </a>
- </li>
- <li class="toctree-l2">
- <a class="reference internal" href="../extended/extended_parallel.html">
- Parallel extended Kalman smoothing
- </a>
- </li>
- </ul>
- </li>
- <li class="toctree-l1 has-children">
- <a class="reference internal" href="../unscented/unscented_index.html">
- Unscented methods
- </a>
- <input class="toctree-checkbox" id="toctree-checkbox-5" name="toctree-checkbox-5" type="checkbox"/>
- <label for="toctree-checkbox-5">
- <i class="fas fa-chevron-down">
- </i>
- </label>
- <ul>
- <li class="toctree-l2">
- <a class="reference internal" href="../unscented/unscented_filter.html">
- Unscented filtering
- </a>
- </li>
- <li class="toctree-l2">
- <a class="reference internal" href="../unscented/unscented_smoother.html">
- Unscented smoothing
- </a>
- </li>
- </ul>
- </li>
- <li class="toctree-l1">
- <a class="reference internal" href="../quadrature/quadrature_index.html">
- Quadrature and cubature methods
- </a>
- </li>
- <li class="toctree-l1">
- <a class="reference internal" href="../postlin/postlin_index.html">
- Posterior linearization
- </a>
- </li>
- <li class="toctree-l1">
- <a class="reference internal" href="../adf/adf_index.html">
- Assumed Density Filtering
- </a>
- </li>
- <li class="toctree-l1">
- <a class="reference internal" href="../vi/vi_index.html">
- Variational inference
- </a>
- </li>
- <li class="toctree-l1">
- <a class="reference internal" href="../pf/pf_index.html">
- Particle filtering
- </a>
- </li>
- <li class="toctree-l1">
- <a class="reference internal" href="../smc/smc_index.html">
- Sequential Monte Carlo
- </a>
- </li>
- <li class="toctree-l1">
- <a class="reference internal" href="../learning/learning_index.html">
- Offline parameter estimation (learning)
- </a>
- </li>
- <li class="toctree-l1">
- <a class="reference internal" href="../tracking/tracking_index.html">
- Multi-target tracking
- </a>
- </li>
- <li class="toctree-l1">
- <a class="reference internal" href="../ensemble/ensemble_index.html">
- Data assimilation using Ensemble Kalman filter
- </a>
- </li>
- <li class="toctree-l1">
- <a class="reference internal" href="../bnp/bnp_index.html">
- Bayesian non-parametric SSMs
- </a>
- </li>
- <li class="toctree-l1">
- <a class="reference internal" href="../changepoint/changepoint_index.html">
- Changepoint detection
- </a>
- </li>
- <li class="toctree-l1">
- <a class="reference internal" href="../timeseries/timeseries_index.html">
- Timeseries forecasting
- </a>
- </li>
- <li class="toctree-l1">
- <a class="reference internal" href="../gp/gp_index.html">
- Markovian Gaussian processes
- </a>
- </li>
- <li class="toctree-l1">
- <a class="reference internal" href="../ode/ode_index.html">
- Differential equations and SSMs
- </a>
- </li>
- <li class="toctree-l1">
- <a class="reference internal" href="../control/control_index.html">
- Optimal control
- </a>
- </li>
- <li class="toctree-l1">
- <a class="reference internal" href="../../bib.html">
- Bibliography
- </a>
- </li>
- </ul>
- </div>
- </nav> <!-- To handle the deprecated key -->
- <div class="navbar_extra_footer">
- Powered by <a href="https://jupyterbook.org">Jupyter Book</a>
- </div>
- </div>
-
-
- <main class="col py-md-3 pl-md-4 bd-content overflow-auto" role="main">
-
- <div class="topbar container-xl fixed-top">
- <div class="topbar-contents row">
- <div class="col-12 col-md-3 bd-topbar-whitespace site-navigation show"></div>
- <div class="col pl-md-4 topbar-main">
-
- <button id="navbar-toggler" class="navbar-toggler ml-0" type="button" data-toggle="collapse"
- data-toggle="tooltip" data-placement="bottom" data-target=".site-navigation" aria-controls="navbar-menu"
- aria-expanded="true" aria-label="Toggle navigation" aria-controls="site-navigation"
- title="Toggle navigation" data-toggle="tooltip" data-placement="left">
- <i class="fas fa-bars"></i>
- <i class="fas fa-arrow-left"></i>
- <i class="fas fa-arrow-up"></i>
- </button>
-
-
- <div class="dropdown-buttons-trigger">
- <button id="dropdown-buttons-trigger" class="btn btn-secondary topbarbtn" aria-label="Download this page"><i
- class="fas fa-download"></i></button>
- <div class="dropdown-buttons">
- <!-- ipynb file if we had a myst markdown file -->
-
- <!-- Download raw file -->
- <a class="dropdown-buttons" href="../../_sources/chapters/ssm/lds.ipynb"><button type="button"
- class="btn btn-secondary topbarbtn" title="Download source file" data-toggle="tooltip"
- data-placement="left">.ipynb</button></a>
- <!-- Download PDF via print -->
- <button type="button" id="download-print" class="btn btn-secondary topbarbtn" title="Print to PDF"
- onclick="printPdf(this)" data-toggle="tooltip" data-placement="left">.pdf</button>
- </div>
- </div>
- <!-- Source interaction buttons -->
- <div class="dropdown-buttons-trigger">
- <button id="dropdown-buttons-trigger" class="btn btn-secondary topbarbtn"
- aria-label="Connect with source repository"><i class="fab fa-github"></i></button>
- <div class="dropdown-buttons sourcebuttons">
- <a class="repository-button"
- href="https://github.com/probml/ssm-book"><button type="button" class="btn btn-secondary topbarbtn"
- data-toggle="tooltip" data-placement="left" title="Source repository"><i
- class="fab fa-github"></i>repository</button></a>
- <a class="issues-button"
- href="https://github.com/probml/ssm-book/issues/new?title=Issue%20on%20page%20%2Fchapters/ssm/lds.html&body=Your%20issue%20content%20here."><button
- type="button" class="btn btn-secondary topbarbtn" data-toggle="tooltip" data-placement="left"
- title="Open an issue"><i class="fas fa-lightbulb"></i>open issue</button></a>
-
- </div>
- </div>
- <!-- Full screen (wrap in <a> to have style consistency -->
- <a class="full-screen-button"><button type="button" class="btn btn-secondary topbarbtn" data-toggle="tooltip"
- data-placement="bottom" onclick="toggleFullScreen()" aria-label="Fullscreen mode"
- title="Fullscreen mode"><i
- class="fas fa-expand"></i></button></a>
- <!-- Launch buttons -->
- <div class="dropdown-buttons-trigger">
- <button id="dropdown-buttons-trigger" class="btn btn-secondary topbarbtn"
- aria-label="Launch interactive content"><i class="fas fa-rocket"></i></button>
- <div class="dropdown-buttons">
-
- <a class="binder-button" href="https://mybinder.org/v2/gh/probml/ssm-book/main?urlpath=tree/chapters/ssm/lds.ipynb"><button type="button"
- class="btn btn-secondary topbarbtn" title="Launch Binder" data-toggle="tooltip"
- data-placement="left"><img class="binder-button-logo"
- src="../../_static/images/logo_binder.svg"
- alt="Interact on binder">Binder</button></a>
-
-
-
- <a class="colab-button" href="https://colab.research.google.com/github/probml/ssm-book/blob/main/chapters/ssm/lds.ipynb"><button type="button" class="btn btn-secondary topbarbtn"
- title="Launch Colab" data-toggle="tooltip" data-placement="left"><img class="colab-button-logo"
- src="../../_static/images/logo_colab.png"
- alt="Interact on Colab">Colab</button></a>
-
-
- </div>
- </div>
- </div>
- <!-- Table of contents -->
- <div class="d-none d-md-block col-md-2 bd-toc show noprint">
-
- <div class="tocsection onthispage pt-5 pb-3">
- <i class="fas fa-list"></i> Contents
- </div>
- <nav id="bd-toc-nav" aria-label="Page">
- <ul class="visible nav section-nav flex-column">
- <li class="toc-h2 nav-item toc-entry">
- <a class="reference internal nav-link" href="#example-tracking-a-2d-point">
- Example: tracking a 2d point
- </a>
- </li>
- </ul>
- </nav>
- </div>
- </div>
- </div>
- <div id="main-content" class="row">
- <div class="col-12 col-md-9 pl-md-3 pr-md-0">
- <!-- Table of contents that is only displayed when printing the page -->
- <div id="jb-print-docs-body" class="onlyprint">
- <h1>Linear Gaussian SSMs</h1>
- <!-- Table of contents -->
- <div id="print-main-content">
- <div id="jb-print-toc">
-
- <div>
- <h2> Contents </h2>
- </div>
- <nav aria-label="Page">
- <ul class="visible nav section-nav flex-column">
- <li class="toc-h2 nav-item toc-entry">
- <a class="reference internal nav-link" href="#example-tracking-a-2d-point">
- Example: tracking a 2d point
- </a>
- </li>
- </ul>
- </nav>
- </div>
- </div>
- </div>
-
- <div>
-
- <div class="cell docutils container">
- <div class="cell_input docutils container">
- <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1">### Import standard libraries</span>
- <span class="kn">import</span> <span class="nn">abc</span>
- <span class="kn">from</span> <span class="nn">dataclasses</span> <span class="kn">import</span> <span class="n">dataclass</span>
- <span class="kn">import</span> <span class="nn">functools</span>
- <span class="kn">from</span> <span class="nn">functools</span> <span class="kn">import</span> <span class="n">partial</span>
- <span class="kn">import</span> <span class="nn">itertools</span>
- <span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="nn">plt</span>
- <span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
- <span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Any</span><span class="p">,</span> <span class="n">Callable</span><span class="p">,</span> <span class="n">NamedTuple</span><span class="p">,</span> <span class="n">Optional</span><span class="p">,</span> <span class="n">Union</span><span class="p">,</span> <span class="n">Tuple</span>
- <span class="kn">import</span> <span class="nn">jax</span>
- <span class="kn">import</span> <span class="nn">jax.numpy</span> <span class="k">as</span> <span class="nn">jnp</span>
- <span class="kn">from</span> <span class="nn">jax</span> <span class="kn">import</span> <span class="n">lax</span><span class="p">,</span> <span class="n">vmap</span><span class="p">,</span> <span class="n">jit</span><span class="p">,</span> <span class="n">grad</span>
- <span class="c1">#from jax.scipy.special import logit</span>
- <span class="c1">#from jax.nn import softmax</span>
- <span class="kn">import</span> <span class="nn">jax.random</span> <span class="k">as</span> <span class="nn">jr</span>
- <span class="kn">import</span> <span class="nn">distrax</span>
- <span class="kn">import</span> <span class="nn">optax</span>
- <span class="kn">import</span> <span class="nn">jsl</span>
- <span class="kn">import</span> <span class="nn">ssm_jax</span>
- <span class="kn">import</span> <span class="nn">inspect</span>
- <span class="kn">import</span> <span class="nn">inspect</span> <span class="k">as</span> <span class="nn">py_inspect</span>
- <span class="kn">import</span> <span class="nn">rich</span>
- <span class="kn">from</span> <span class="nn">rich</span> <span class="kn">import</span> <span class="n">inspect</span> <span class="k">as</span> <span class="n">r_inspect</span>
- <span class="kn">from</span> <span class="nn">rich</span> <span class="kn">import</span> <span class="nb">print</span> <span class="k">as</span> <span class="n">r_print</span>
- <span class="k">def</span> <span class="nf">print_source</span><span class="p">(</span><span class="n">fname</span><span class="p">):</span>
- <span class="n">r_print</span><span class="p">(</span><span class="n">py_inspect</span><span class="o">.</span><span class="n">getsource</span><span class="p">(</span><span class="n">fname</span><span class="p">))</span>
- </pre></div>
- </div>
- </div>
- </div>
- <div class="tex2jax_ignore mathjax_ignore section" id="linear-gaussian-ssms">
- <span id="sec-lds-intro"></span><h1>Linear Gaussian SSMs<a class="headerlink" href="#linear-gaussian-ssms" title="Permalink to this headline">¶</a></h1>
- <p>Consider the state space model in
- <a class="reference internal" href="ssm_intro.html#equation-eq-ssm-ar">(1)</a>
- where we assume the observations are conditionally iid given the
- hidden states and inputs (i.e. there are no auto-regressive dependencies
- between the observables).
- We can rewrite this model as
- a stochastic <span class="math notranslate nohighlight">\(\keyword{nonlinear dynamical system}\)</span> or <span class="math notranslate nohighlight">\(\keyword{NLDS}\)</span>
- by defining the distribution of the next hidden state
- <span class="math notranslate nohighlight">\(\hidden_t \in \real^{\nhidden}\)</span>
- as a deterministic function of the past state
- <span class="math notranslate nohighlight">\(\hidden_{t-1}\)</span>,
- the input <span class="math notranslate nohighlight">\(\inputs_t \in \real^{\ninputs}\)</span>,
- and some random <span class="math notranslate nohighlight">\(\keyword{process noise}\)</span> <span class="math notranslate nohighlight">\(\transNoise_t \in \real^{\nhidden}\)</span></p>
- <div class="amsmath math notranslate nohighlight" id="equation-b48061b1-1d75-4952-be1e-9145adb38f90">
- <span class="eqno">(4)<a class="headerlink" href="#equation-b48061b1-1d75-4952-be1e-9145adb38f90" title="Permalink to this equation">¶</a></span>\[\begin{align}
- \hidden_t &= \dynamicsFn(\hidden_{t-1}, \inputs_t, \transNoise_t)
- \end{align}\]</div>
- <p>where <span class="math notranslate nohighlight">\(\transNoise_t\)</span> is drawn from the distribution such
- that the induced distribution
- on <span class="math notranslate nohighlight">\(\hidden_t\)</span> matches <span class="math notranslate nohighlight">\(p(\hidden_t|\hidden_{t-1}, \inputs_t)\)</span>.
- Similarly we can rewrite the observation distribution
- as a deterministic function of the hidden state
- plus <span class="math notranslate nohighlight">\(\keyword{observation noise}\)</span> <span class="math notranslate nohighlight">\(\obsNoise_t \in \real^{\nobs}\)</span>:</p>
- <div class="amsmath math notranslate nohighlight" id="equation-8503a723-5c54-4693-835d-f2ba58d0e341">
- <span class="eqno">(5)<a class="headerlink" href="#equation-8503a723-5c54-4693-835d-f2ba58d0e341" title="Permalink to this equation">¶</a></span>\[\begin{align}
- \obs_t &= \measurementFn(\hidden_{t}, \inputs_t, \obsNoise_t)
- \end{align}\]</div>
- <p>If we assume additive Gaussian noise,
- the model becomes</p>
- <div class="amsmath math notranslate nohighlight" id="equation-05b276c6-1300-4f5e-832c-6ef78b230ee5">
- <span class="eqno">(6)<a class="headerlink" href="#equation-05b276c6-1300-4f5e-832c-6ef78b230ee5" title="Permalink to this equation">¶</a></span>\[\begin{align}
- \hidden_t &= \dynamicsFn(\hidden_{t-1}, \inputs_t) + \transNoise_t \\
- \obs_t &= \measurementFn(\hidden_{t}, \inputs_t) + \obsNoise_t
- \end{align}\]</div>
- <p>where <span class="math notranslate nohighlight">\(\transNoise_t \sim \gauss(\vzero,\transCov_t)\)</span>
- and <span class="math notranslate nohighlight">\(\obsNoise_t \sim \gauss(\vzero,\obsCov_t)\)</span>.
- We will call these <span class="math notranslate nohighlight">\(\keyword{Gaussian SSMs}\)</span>.</p>
- <p>If we additionally assume
- the transition function <span class="math notranslate nohighlight">\(\dynamicsFn\)</span>
- and the observation function <span class="math notranslate nohighlight">\(\measurementFn\)</span> are both linear,
- then we can rewrite the model as follows:</p>
- <div class="amsmath math notranslate nohighlight" id="equation-48743a9b-4689-4d37-9b6e-639de4080d17">
- <span class="eqno">(7)<a class="headerlink" href="#equation-48743a9b-4689-4d37-9b6e-639de4080d17" title="Permalink to this equation">¶</a></span>\[\begin{align}
- p(\hidden_t|\hidden_{t-1},\inputs_t) &= \gauss(\hidden_t|\ldsDyn \hidden_{t-1}
- + \ldsDynIn \inputs_t, \transCov)
- \\
- p(\obs_t|\hidden_t,\inputs_t) &= \gauss(\obs_t|\ldsObs \hidden_{t}
- + \ldsObsIn \inputs_t, \obsCov)
- \end{align}\]</div>
- <p>This is called a
- <span class="math notranslate nohighlight">\(\keyword{linear-Gaussian state space model}\)</span>
- or <span class="math notranslate nohighlight">\(\keyword{LG-SSM}\)</span>;
- it is also called
- a <span class="math notranslate nohighlight">\(\keyword{linear dynamical system}\)</span> or <span class="math notranslate nohighlight">\(\keyword{LDS}\)</span>.
- We usually assume the parameters are independent of time, in which case
- the model is said to be time-invariant or homogeneous.</p>
- <div class="section" id="example-tracking-a-2d-point">
- <span id="sec-kalman-tracking"></span><span id="sec-tracking-lds"></span><h2>Example: tracking a 2d point<a class="headerlink" href="#example-tracking-a-2d-point" title="Permalink to this headline">¶</a></h2>
- <p>Consider an object moving in <span class="math notranslate nohighlight">\(\real^2\)</span>.
- Let the state be
- the position and velocity of the object,
- <span class="math notranslate nohighlight">\(\hidden_t =\begin{pmatrix} u_t & \dot{u}_t & v_t & \dot{v}_t \end{pmatrix}\)</span>.
- (We use <span class="math notranslate nohighlight">\(u\)</span> and <span class="math notranslate nohighlight">\(v\)</span> for the two coordinates,
- to avoid confusion with the state and observation variables.)
- If we use Euler discretization,
- the dynamics become</p>
- <div class="amsmath math notranslate nohighlight" id="equation-91ff5c5d-8e5f-4499-aefa-5879e12171e0">
- <span class="eqno">(8)<a class="headerlink" href="#equation-91ff5c5d-8e5f-4499-aefa-5879e12171e0" title="Permalink to this equation">¶</a></span>\[\begin{align}
- \underbrace{\begin{pmatrix} u_t\\ \dot{u}_t \\ v_t \\ \dot{v}_t \end{pmatrix}}_{\hidden_t}
- =
- \underbrace{
- \begin{pmatrix}
- 1 & 0 & \Delta & 0 \\
- 0 & 1 & 0 & \Delta\\
- 0 & 0 & 1 & 0 \\
- 0 & 0 & 0 & 1
- \end{pmatrix}
- }_{\ldsDyn}
- \underbrace{\begin{pmatrix} u_{t-1} \\ \dot{u}_{t-1} \\ v_{t-1} \\ \dot{v}_{t-1} \end{pmatrix}}_{\hidden_{t-1}}
- + \transNoise_t
- \end{align}\]</div>
- <p>where <span class="math notranslate nohighlight">\(\transNoise_t \sim \gauss(\vzero,\transCov)\)</span> is
- the process noise.
- We assume
- that the process noise is
- a white noise process added to the velocity components
- of the state, but not to the location,
- so <span class="math notranslate nohighlight">\(\transCov = \diag(0, q, 0, q)\)</span>.
- This is known as a random accelerations model.
- (See <span id="id1">[<a class="reference internal" href="../../bib.html#id18" title="Simo Sarkka. Bayesian Filtering and Smoothing. Cambridge University Press, 2013. URL: https://users.aalto.fi/~ssarkka/pub/cup_book_online_20131111.pdf.">Sar13</a>]</span> p60 for a more accurate way
- to convert the continuous time process to discrete time.)</p>
- <p>Now suppose that at each discrete time point we
- observe the location,
- corrupted by Gaussian noise.
- Thus the observation model becomes</p>
- <div class="amsmath math notranslate nohighlight" id="equation-57a3bfcc-a07e-4569-b6ea-c293d7f66be7">
- <span class="eqno">(9)<a class="headerlink" href="#equation-57a3bfcc-a07e-4569-b6ea-c293d7f66be7" title="Permalink to this equation">¶</a></span>\[\begin{align}
- \underbrace{\begin{pmatrix} \obs_{1,t} \\ \obs_{2,t} \end{pmatrix}}_{\obs_t}
- &=
- \underbrace{
- \begin{pmatrix}
- 1 & 0 & 0 & 0 \\
- 0 & 0 & 1 & 0
- \end{pmatrix}
- }_{\ldsObs}
-
- \underbrace{\begin{pmatrix} u_t\\ \dot{u}_t \\ v_t \\ \dot{v}_t \end{pmatrix}}_{\hidden_t}
- + \obsNoise_t
- \end{align}\]</div>
- <p>where <span class="math notranslate nohighlight">\(\obsNoise_t \sim \gauss(\vzero,\obsCov)\)</span> is the observation noise.
- We see that the observation matrix <span class="math notranslate nohighlight">\(\ldsObs\)</span> simply ``extracts’’ the
- relevant parts of the state vector.</p>
- <p>Suppose we sample a trajectory and corresponding set
- of noisy observations from this model,
- <span class="math notranslate nohighlight">\((\hidden_{1:T}, \obs_{1:T}) \sim p(\hidden,\obs|\params)\)</span>.
- (We use diagonal observation noise,
- <span class="math notranslate nohighlight">\(\obsCov = \diag(\sigma_1^2, \sigma_2^2)\)</span>.)
- The results are shown below.</p>
- <div class="cell docutils container">
- <div class="cell_input docutils container">
- <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">key</span> <span class="o">=</span> <span class="n">jax</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">PRNGKey</span><span class="p">(</span><span class="mi">314</span><span class="p">)</span>
- <span class="n">timesteps</span> <span class="o">=</span> <span class="mi">15</span>
- <span class="n">delta</span> <span class="o">=</span> <span class="mf">1.0</span>
- <span class="n">A</span> <span class="o">=</span> <span class="n">jnp</span><span class="o">.</span><span class="n">array</span><span class="p">([</span>
- <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">delta</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span>
- <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">delta</span><span class="p">],</span>
- <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span>
- <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span>
- <span class="p">])</span>
- <span class="n">C</span> <span class="o">=</span> <span class="n">jnp</span><span class="o">.</span><span class="n">array</span><span class="p">([</span>
- <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span>
- <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span>
- <span class="p">])</span>
- <span class="n">state_size</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">A</span><span class="o">.</span><span class="n">shape</span>
- <span class="n">observation_size</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">C</span><span class="o">.</span><span class="n">shape</span>
- <span class="n">Q</span> <span class="o">=</span> <span class="n">jnp</span><span class="o">.</span><span class="n">eye</span><span class="p">(</span><span class="n">state_size</span><span class="p">)</span> <span class="o">*</span> <span class="mf">0.001</span>
- <span class="n">R</span> <span class="o">=</span> <span class="n">jnp</span><span class="o">.</span><span class="n">eye</span><span class="p">(</span><span class="n">observation_size</span><span class="p">)</span> <span class="o">*</span> <span class="mf">1.0</span>
- <span class="c1"># Prior parameter distribution</span>
- <span class="n">mu0</span> <span class="o">=</span> <span class="n">jnp</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">8</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">])</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="nb">float</span><span class="p">)</span>
- <span class="n">Sigma0</span> <span class="o">=</span> <span class="n">jnp</span><span class="o">.</span><span class="n">eye</span><span class="p">(</span><span class="n">state_size</span><span class="p">)</span> <span class="o">*</span> <span class="mf">1.0</span>
- <span class="kn">from</span> <span class="nn">jsl.lds.kalman_filter</span> <span class="kn">import</span> <span class="n">LDS</span><span class="p">,</span> <span class="n">smooth</span><span class="p">,</span> <span class="nb">filter</span>
- <span class="n">lds</span> <span class="o">=</span> <span class="n">LDS</span><span class="p">(</span><span class="n">A</span><span class="p">,</span> <span class="n">C</span><span class="p">,</span> <span class="n">Q</span><span class="p">,</span> <span class="n">R</span><span class="p">,</span> <span class="n">mu0</span><span class="p">,</span> <span class="n">Sigma0</span><span class="p">)</span>
- <span class="nb">print</span><span class="p">(</span><span class="n">lds</span><span class="p">)</span>
- </pre></div>
- </div>
- </div>
- <div class="cell_output docutils container">
- <div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>WARNING:absl:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)
- </pre></div>
- </div>
- <div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>LDS(A=DeviceArray([[1., 0., 1., 0.],
- [0., 1., 0., 1.],
- [0., 0., 1., 0.],
- [0., 0., 0., 1.]], dtype=float32), C=DeviceArray([[1, 0, 0, 0],
- [0, 1, 0, 0]], dtype=int32), Q=DeviceArray([[0.001, 0. , 0. , 0. ],
- [0. , 0.001, 0. , 0. ],
- [0. , 0. , 0.001, 0. ],
- [0. , 0. , 0. , 0.001]], dtype=float32), R=DeviceArray([[1., 0.],
- [0., 1.]], dtype=float32), mu=DeviceArray([ 8., 10., 1., 0.], dtype=float32), Sigma=DeviceArray([[1., 0., 0., 0.],
- [0., 1., 0., 0.],
- [0., 0., 1., 0.],
- [0., 0., 0., 1.]], dtype=float32), state_offset=None, obs_offset=None, nstates=4, nobs=2)
- </pre></div>
- </div>
- </div>
- </div>
- <div class="cell docutils container">
- <div class="cell_input docutils container">
- <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">jsl.demos.plot_utils</span> <span class="kn">import</span> <span class="n">plot_ellipse</span>
- <span class="k">def</span> <span class="nf">plot_tracking_values</span><span class="p">(</span><span class="n">observed</span><span class="p">,</span> <span class="n">filtered</span><span class="p">,</span> <span class="n">cov_hist</span><span class="p">,</span> <span class="n">signal_label</span><span class="p">,</span> <span class="n">ax</span><span class="p">):</span>
- <span class="n">timesteps</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">observed</span><span class="o">.</span><span class="n">shape</span>
- <span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">observed</span><span class="p">[:,</span> <span class="mi">0</span><span class="p">],</span> <span class="n">observed</span><span class="p">[:,</span> <span class="mi">1</span><span class="p">],</span> <span class="n">marker</span><span class="o">=</span><span class="s2">"o"</span><span class="p">,</span> <span class="n">linewidth</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
- <span class="n">markerfacecolor</span><span class="o">=</span><span class="s2">"none"</span><span class="p">,</span> <span class="n">markeredgewidth</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s2">"observed"</span><span class="p">,</span> <span class="n">c</span><span class="o">=</span><span class="s2">"tab:green"</span><span class="p">)</span>
- <span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="o">*</span><span class="n">filtered</span><span class="p">[:,</span> <span class="p">:</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">T</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="n">signal_label</span><span class="p">,</span> <span class="n">c</span><span class="o">=</span><span class="s2">"tab:red"</span><span class="p">,</span> <span class="n">marker</span><span class="o">=</span><span class="s2">"x"</span><span class="p">,</span> <span class="n">linewidth</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
- <span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">timesteps</span><span class="p">,</span> <span class="mi">1</span><span class="p">):</span>
- <span class="n">covn</span> <span class="o">=</span> <span class="n">cov_hist</span><span class="p">[</span><span class="n">t</span><span class="p">][:</span><span class="mi">2</span><span class="p">,</span> <span class="p">:</span><span class="mi">2</span><span class="p">]</span>
- <span class="n">plot_ellipse</span><span class="p">(</span><span class="n">covn</span><span class="p">,</span> <span class="n">filtered</span><span class="p">[</span><span class="n">t</span><span class="p">,</span> <span class="p">:</span><span class="mi">2</span><span class="p">],</span> <span class="n">ax</span><span class="p">,</span> <span class="n">n_std</span><span class="o">=</span><span class="mf">2.0</span><span class="p">,</span> <span class="n">plot_center</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
- <span class="n">ax</span><span class="o">.</span><span class="n">axis</span><span class="p">(</span><span class="s2">"equal"</span><span class="p">)</span>
- <span class="n">ax</span><span class="o">.</span><span class="n">legend</span><span class="p">()</span>
- </pre></div>
- </div>
- </div>
- </div>
- <div class="cell docutils container">
- <div class="cell_input docutils container">
- <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">z_hist</span><span class="p">,</span> <span class="n">x_hist</span> <span class="o">=</span> <span class="n">lds</span><span class="o">.</span><span class="n">sample</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">timesteps</span><span class="p">)</span>
- <span class="n">fig_truth</span><span class="p">,</span> <span class="n">axs</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplots</span><span class="p">()</span>
- <span class="n">axs</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">x_hist</span><span class="p">[:,</span> <span class="mi">0</span><span class="p">],</span> <span class="n">x_hist</span><span class="p">[:,</span> <span class="mi">1</span><span class="p">],</span>
- <span class="n">marker</span><span class="o">=</span><span class="s2">"o"</span><span class="p">,</span> <span class="n">linewidth</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">markerfacecolor</span><span class="o">=</span><span class="s2">"none"</span><span class="p">,</span>
- <span class="n">markeredgewidth</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span>
- <span class="n">label</span><span class="o">=</span><span class="s2">"observed"</span><span class="p">,</span> <span class="n">c</span><span class="o">=</span><span class="s2">"tab:green"</span><span class="p">)</span>
- <span class="n">axs</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">z_hist</span><span class="p">[:,</span> <span class="mi">0</span><span class="p">],</span> <span class="n">z_hist</span><span class="p">[:,</span> <span class="mi">1</span><span class="p">],</span>
- <span class="n">linewidth</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s2">"truth"</span><span class="p">,</span>
- <span class="n">marker</span><span class="o">=</span><span class="s2">"s"</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mi">8</span><span class="p">)</span>
- <span class="n">axs</span><span class="o">.</span><span class="n">legend</span><span class="p">()</span>
- <span class="n">axs</span><span class="o">.</span><span class="n">axis</span><span class="p">(</span><span class="s2">"equal"</span><span class="p">)</span>
- </pre></div>
- </div>
- </div>
- <div class="cell_output docutils container">
- <div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>(7.24486608505249, 23.857812213897706, 8.042076778411865, 11.636079120635987)
- </pre></div>
- </div>
- <img alt="../../_images/lds_5_1.png" src="../../_images/lds_5_1.png" />
- </div>
- </div>
- <p>The main task is to infer the hidden states given the noisy
- observations, i.e., <span class="math notranslate nohighlight">\(p(\hidden_t|\obs_{1:t},\params)\)</span>
- or <span class="math notranslate nohighlight">\(p(\hidden_t|\obs_{1:T}, \params)\)</span> in the offline case.
- We discuss the topic of inference in <a class="reference internal" href="inference.html#sec-inference"><span class="std std-ref">States estimation (inference)</span></a>.
- We will usually represent this belief state by a Gaussian distribution,
- <span class="math notranslate nohighlight">\(p(\hidden_t|\obs_{1:s},\params) = \gauss(\hidden_t| \mean_{t|s}, \covMat_{t|s})\)</span>,
- where usually <span class="math notranslate nohighlight">\(s=t\)</span> or <span class="math notranslate nohighlight">\(s=T\)</span>.
- Sometimes we use information form,
- <span class="math notranslate nohighlight">\(p(\hidden_t|\obs_{1:s},\params) = \gaussInfo(\hidden_t|\precMean_{t|s}, \precMat_{t|s})\)</span>.</p>
- </div>
- </div>
- <script type="text/x-thebe-config">
- {
- requestKernel: true,
- binderOptions: {
- repo: "binder-examples/jupyter-stacks-datascience",
- ref: "master",
- },
- codeMirrorConfig: {
- theme: "abcdef",
- mode: "python"
- },
- kernelOptions: {
- kernelName: "python3",
- path: "./chapters/ssm"
- },
- predefinedOutput: true
- }
- </script>
- <script>kernelName = 'python3'</script>
- </div>
-
-
- <!-- Previous / next buttons -->
- <div class='prev-next-area'>
- <a class='left-prev' id="prev-link" href="hmm.html" title="previous page">
- <i class="fas fa-angle-left"></i>
- <div class="prev-next-info">
- <p class="prev-next-subtitle">previous</p>
- <p class="prev-next-title">Hidden Markov Models</p>
- </div>
- </a>
- <a class='right-next' id="next-link" href="nlds.html" title="next page">
- <div class="prev-next-info">
- <p class="prev-next-subtitle">next</p>
- <p class="prev-next-title">Nonlinear Gaussian SSMs</p>
- </div>
- <i class="fas fa-angle-right"></i>
- </a>
- </div>
-
- </div>
- </div>
- <footer class="footer">
- <p>
-
- By Kevin Murphy, Scott Linderman, et al.<br/>
-
- © Copyright 2021.<br/>
- </p>
- </footer>
- </main>
- </div>
- </div>
-
- <script src="../../_static/js/index.be7d3bbb2ef33a8344ce.js"></script>
- </body>
- </html>
|