ssm.html 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>What are State Space Models? &#8212; State Space Models: A Modern Approach</title>
  7. <link href="../../_static/css/theme.css" rel="stylesheet">
  8. <link href="../../_static/css/index.ff1ffe594081f20da1ef19478df9384b.css" rel="stylesheet">
  9. <link rel="stylesheet"
  10. href="../../_static/vendor/fontawesome/5.13.0/css/all.min.css">
  11. <link rel="preload" as="font" type="font/woff2" crossorigin
  12. href="../../_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff2">
  13. <link rel="preload" as="font" type="font/woff2" crossorigin
  14. href="../../_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2">
  15. <link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
  16. <link rel="stylesheet" type="text/css" href="../../_static/sphinx-book-theme.css?digest=c3fdc42140077d1ad13ad2f1588a4309" />
  17. <link rel="stylesheet" type="text/css" href="../../_static/togglebutton.css" />
  18. <link rel="stylesheet" type="text/css" href="../../_static/copybutton.css" />
  19. <link rel="stylesheet" type="text/css" href="../../_static/mystnb.css" />
  20. <link rel="stylesheet" type="text/css" href="../../_static/sphinx-thebe.css" />
  21. <link rel="stylesheet" type="text/css" href="../../_static/panels-main.c949a650a448cc0ae9fd3441c0e17fb0.css" />
  22. <link rel="stylesheet" type="text/css" href="../../_static/panels-variables.06eb56fa6e07937060861dad626602ad.css" />
  23. <link rel="preload" as="script" href="../../_static/js/index.be7d3bbb2ef33a8344ce.js">
  24. <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
  25. <script src="../../_static/jquery.js"></script>
  26. <script src="../../_static/underscore.js"></script>
  27. <script src="../../_static/doctools.js"></script>
  28. <script src="../../_static/clipboard.min.js"></script>
  29. <script src="../../_static/copybutton.js"></script>
  30. <script>let toggleHintShow = 'Click to show';</script>
  31. <script>let toggleHintHide = 'Click to hide';</script>
  32. <script>let toggleOpenOnPrint = 'true';</script>
  33. <script src="../../_static/togglebutton.js"></script>
  34. <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>
  35. <script src="../../_static/sphinx-book-theme.d59cb220de22ca1c485ebbdc042f0030.js"></script>
  36. <script>const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"
  37. const thebe_selector = ".thebe,.cell"
  38. const thebe_selector_input = "pre"
  39. const thebe_selector_output = ".output, .cell_output"
  40. </script>
  41. <script async="async" src="../../_static/sphinx-thebe.js"></script>
  42. <script>window.MathJax = {"options": {"processHtmlClass": "tex2jax_process|mathjax_process|math|output_area"}}</script>
  43. <script defer="defer" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
  44. <link rel="index" title="Index" href="../../genindex.html" />
  45. <link rel="search" title="Search" href="../../search.html" />
  46. <link rel="next" title="Inference in discrete SSMs" href="../hmm/hmm_index.html" />
  47. <link rel="prev" title="Scratchpad" href="../scratch.html" />
  48. <meta name="viewport" content="width=device-width, initial-scale=1" />
  49. <meta name="docsearch:language" content="None">
  50. <!-- Google Analytics -->
  51. </head>
  52. <body data-spy="scroll" data-target="#bd-toc-nav" data-offset="80">
  53. <div class="container-fluid" id="banner"></div>
  54. <div class="container-xl">
  55. <div class="row">
  56. <div class="col-12 col-md-3 bd-sidebar site-navigation show" id="site-navigation">
  57. <div class="navbar-brand-box">
  58. <a class="navbar-brand text-wrap" href="../../index.html">
  59. <h1 class="site-logo" id="site-title">State Space Models: A Modern Approach</h1>
  60. </a>
  61. </div><form class="bd-search d-flex align-items-center" action="../../search.html" method="get">
  62. <i class="icon fas fa-search"></i>
  63. <input type="search" class="form-control" name="q" id="search-input" placeholder="Search this book..." aria-label="Search this book..." autocomplete="off" >
  64. </form><nav class="bd-links" id="bd-docs-nav" aria-label="Main">
  65. <div class="bd-toc-item active">
  66. <ul class="nav bd-sidenav">
  67. <li class="toctree-l1">
  68. <a class="reference internal" href="../../root.html">
  69. State Space Models: A Modern Approach
  70. </a>
  71. </li>
  72. </ul>
  73. <ul class="current nav bd-sidenav">
  74. <li class="toctree-l1">
  75. <a class="reference internal" href="../scratch.html">
  76. Scratchpad
  77. </a>
  78. </li>
  79. <li class="toctree-l1 current active">
  80. <a class="current reference internal" href="#">
  81. What are State Space Models?
  82. </a>
  83. </li>
  84. <li class="toctree-l1 has-children">
  85. <a class="reference internal" href="../hmm/hmm_index.html">
  86. Inference in discrete SSMs
  87. </a>
  88. <input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/>
  89. <label for="toctree-checkbox-1">
  90. <i class="fas fa-chevron-down">
  91. </i>
  92. </label>
  93. <ul>
  94. <li class="toctree-l2">
  95. <a class="reference internal" href="../hmm/hmm.html">
  96. Hidden Markov Models
  97. </a>
  98. </li>
  99. <li class="toctree-l2">
  100. <a class="reference internal" href="../hmm/hmm_filter.html">
  101. HMM filtering (forwards algorithm)
  102. </a>
  103. </li>
  104. <li class="toctree-l2">
  105. <a class="reference internal" href="../hmm/hmm_smoother.html">
  106. HMM smoothing (forwards-backwards algorithm)
  107. </a>
  108. </li>
  109. <li class="toctree-l2">
  110. <a class="reference internal" href="../hmm/hmm_viterbi.html">
  111. Viterbi algorithm
  112. </a>
  113. </li>
  114. <li class="toctree-l2">
  115. <a class="reference internal" href="../hmm/hmm_parallel.html">
  116. Parallel HMM smoothing
  117. </a>
  118. </li>
  119. <li class="toctree-l2">
  120. <a class="reference internal" href="../hmm/hmm_sampling.html">
  121. Forwards-filtering backwards-sampling algorithm
  122. </a>
  123. </li>
  124. </ul>
  125. </li>
  126. <li class="toctree-l1 has-children">
  127. <a class="reference internal" href="../lgssm/lgssm_index.html">
  128. Inference in linear-Gaussian SSMs
  129. </a>
  130. <input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/>
  131. <label for="toctree-checkbox-2">
  132. <i class="fas fa-chevron-down">
  133. </i>
  134. </label>
  135. <ul>
  136. <li class="toctree-l2">
  137. <a class="reference internal" href="../lgssm/kalman_filter.html">
  138. Kalman filtering
  139. </a>
  140. </li>
  141. <li class="toctree-l2">
  142. <a class="reference internal" href="../lgssm/kalman_smoother.html">
  143. Kalman (RTS) smoother
  144. </a>
  145. </li>
  146. <li class="toctree-l2">
  147. <a class="reference internal" href="../lgssm/kalman_parallel.html">
  148. Parallel Kalman Smoother
  149. </a>
  150. </li>
  151. <li class="toctree-l2">
  152. <a class="reference internal" href="../lgssm/kalman_sampling.html">
  153. Forwards-filtering backwards sampling
  154. </a>
  155. </li>
  156. </ul>
  157. </li>
  158. <li class="toctree-l1 has-children">
  159. <a class="reference internal" href="../extended/extended_index.html">
  160. Extended (linearized) methods
  161. </a>
  162. <input class="toctree-checkbox" id="toctree-checkbox-3" name="toctree-checkbox-3" type="checkbox"/>
  163. <label for="toctree-checkbox-3">
  164. <i class="fas fa-chevron-down">
  165. </i>
  166. </label>
  167. <ul>
  168. <li class="toctree-l2">
  169. <a class="reference internal" href="../extended/extended_filter.html">
  170. Extended Kalman filtering
  171. </a>
  172. </li>
  173. <li class="toctree-l2">
  174. <a class="reference internal" href="../extended/extended_smoother.html">
  175. Extended Kalman smoother
  176. </a>
  177. </li>
  178. <li class="toctree-l2">
  179. <a class="reference internal" href="../extended/extended_parallel.html">
  180. Parallel extended Kalman smoothing
  181. </a>
  182. </li>
  183. </ul>
  184. </li>
  185. <li class="toctree-l1 has-children">
  186. <a class="reference internal" href="../unscented/unscented_index.html">
  187. Unscented methods
  188. </a>
  189. <input class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" type="checkbox"/>
  190. <label for="toctree-checkbox-4">
  191. <i class="fas fa-chevron-down">
  192. </i>
  193. </label>
  194. <ul>
  195. <li class="toctree-l2">
  196. <a class="reference internal" href="../unscented/unscented_filter.html">
  197. Unscented filtering
  198. </a>
  199. </li>
  200. <li class="toctree-l2">
  201. <a class="reference internal" href="../unscented/unscented_smoother.html">
  202. Unscented smoothing
  203. </a>
  204. </li>
  205. </ul>
  206. </li>
  207. <li class="toctree-l1">
  208. <a class="reference internal" href="../quadrature/quadrature_index.html">
  209. Quadrature and cubature methods
  210. </a>
  211. </li>
  212. <li class="toctree-l1">
  213. <a class="reference internal" href="../postlin/postlin_index.html">
  214. Posterior linearization
  215. </a>
  216. </li>
  217. <li class="toctree-l1">
  218. <a class="reference internal" href="../adf/adf_index.html">
  219. Assumed Density Filtering
  220. </a>
  221. </li>
  222. <li class="toctree-l1">
  223. <a class="reference internal" href="../vi/vi_index.html">
  224. Variational inference
  225. </a>
  226. </li>
  227. <li class="toctree-l1">
  228. <a class="reference internal" href="../pf/pf_index.html">
  229. Particle filtering
  230. </a>
  231. </li>
  232. <li class="toctree-l1">
  233. <a class="reference internal" href="../smc/smc_index.html">
  234. Sequential Monte Carlo
  235. </a>
  236. </li>
  237. <li class="toctree-l1 has-children">
  238. <a class="reference internal" href="../learning/learning_index.html">
  239. Offline parameter estimation (learning)
  240. </a>
  241. <input class="toctree-checkbox" id="toctree-checkbox-5" name="toctree-checkbox-5" type="checkbox"/>
  242. <label for="toctree-checkbox-5">
  243. <i class="fas fa-chevron-down">
  244. </i>
  245. </label>
  246. <ul>
  247. <li class="toctree-l2">
  248. <a class="reference internal" href="../learning/em.html">
  249. Expectation Maximization (EM)
  250. </a>
  251. </li>
  252. <li class="toctree-l2">
  253. <a class="reference internal" href="../learning/sgd.html">
  254. Stochastic Gradient Descent (SGD)
  255. </a>
  256. </li>
  257. <li class="toctree-l2">
  258. <a class="reference internal" href="../learning/vb.html">
  259. Variational Bayes (VB)
  260. </a>
  261. </li>
  262. <li class="toctree-l2">
  263. <a class="reference internal" href="../learning/mcmc.html">
  264. Markov Chain Monte Carlo (MCMC)
  265. </a>
  266. </li>
  267. </ul>
  268. </li>
  269. <li class="toctree-l1">
  270. <a class="reference internal" href="../tracking/tracking_index.html">
  271. Multi-target tracking
  272. </a>
  273. </li>
  274. <li class="toctree-l1">
  275. <a class="reference internal" href="../ensemble/ensemble_index.html">
  276. Data assimilation using Ensemble Kalman filter
  277. </a>
  278. </li>
  279. <li class="toctree-l1">
  280. <a class="reference internal" href="../bnp/bnp_index.html">
  281. Bayesian non-parametric SSMs
  282. </a>
  283. </li>
  284. <li class="toctree-l1">
  285. <a class="reference internal" href="../changepoint/changepoint_index.html">
  286. Changepoint detection
  287. </a>
  288. </li>
  289. <li class="toctree-l1">
  290. <a class="reference internal" href="../timeseries/timeseries_index.html">
  291. Timeseries forecasting
  292. </a>
  293. </li>
  294. <li class="toctree-l1">
  295. <a class="reference internal" href="../gp/gp_index.html">
  296. Markovian Gaussian processes
  297. </a>
  298. </li>
  299. <li class="toctree-l1">
  300. <a class="reference internal" href="../ode/ode_index.html">
  301. Differential equations and SSMs
  302. </a>
  303. </li>
  304. <li class="toctree-l1">
  305. <a class="reference internal" href="../control/control_index.html">
  306. Optimal control
  307. </a>
  308. </li>
  309. <li class="toctree-l1">
  310. <a class="reference internal" href="../../bib.html">
  311. Bibliography
  312. </a>
  313. </li>
  314. </ul>
  315. </div>
  316. </nav> <!-- To handle the deprecated key -->
  317. <div class="navbar_extra_footer">
  318. Powered by <a href="https://jupyterbook.org">Jupyter Book</a>
  319. </div>
  320. </div>
  321. <main class="col py-md-3 pl-md-4 bd-content overflow-auto" role="main">
  322. <div class="topbar container-xl fixed-top">
  323. <div class="topbar-contents row">
  324. <div class="col-12 col-md-3 bd-topbar-whitespace site-navigation show"></div>
  325. <div class="col pl-md-4 topbar-main">
  326. <button id="navbar-toggler" class="navbar-toggler ml-0" type="button" data-toggle="collapse"
  327. data-toggle="tooltip" data-placement="bottom" data-target=".site-navigation" aria-controls="navbar-menu"
  328. aria-expanded="true" aria-label="Toggle navigation" aria-controls="site-navigation"
  329. title="Toggle navigation" data-toggle="tooltip" data-placement="left">
  330. <i class="fas fa-bars"></i>
  331. <i class="fas fa-arrow-left"></i>
  332. <i class="fas fa-arrow-up"></i>
  333. </button>
  334. <div class="dropdown-buttons-trigger">
  335. <button id="dropdown-buttons-trigger" class="btn btn-secondary topbarbtn" aria-label="Download this page"><i
  336. class="fas fa-download"></i></button>
  337. <div class="dropdown-buttons">
  338. <!-- ipynb file if we had a myst markdown file -->
  339. <!-- Download raw file -->
  340. <a class="dropdown-buttons" href="../../_sources/chapters/ssm/ssm.ipynb"><button type="button"
  341. class="btn btn-secondary topbarbtn" title="Download source file" data-toggle="tooltip"
  342. data-placement="left">.ipynb</button></a>
  343. <!-- Download PDF via print -->
  344. <button type="button" id="download-print" class="btn btn-secondary topbarbtn" title="Print to PDF"
  345. onclick="printPdf(this)" data-toggle="tooltip" data-placement="left">.pdf</button>
  346. </div>
  347. </div>
  348. <!-- Source interaction buttons -->
  349. <div class="dropdown-buttons-trigger">
  350. <button id="dropdown-buttons-trigger" class="btn btn-secondary topbarbtn"
  351. aria-label="Connect with source repository"><i class="fab fa-github"></i></button>
  352. <div class="dropdown-buttons sourcebuttons">
  353. <a class="repository-button"
  354. href="https://github.com/probml/ssm-book"><button type="button" class="btn btn-secondary topbarbtn"
  355. data-toggle="tooltip" data-placement="left" title="Source repository"><i
  356. class="fab fa-github"></i>repository</button></a>
  357. <a class="issues-button"
  358. href="https://github.com/probml/ssm-book/issues/new?title=Issue%20on%20page%20%2Fchapters/ssm/ssm.html&body=Your%20issue%20content%20here."><button
  359. type="button" class="btn btn-secondary topbarbtn" data-toggle="tooltip" data-placement="left"
  360. title="Open an issue"><i class="fas fa-lightbulb"></i>open issue</button></a>
  361. </div>
  362. </div>
  363. <!-- Full screen (wrap in <a> to have style consistency -->
  364. <a class="full-screen-button"><button type="button" class="btn btn-secondary topbarbtn" data-toggle="tooltip"
  365. data-placement="bottom" onclick="toggleFullScreen()" aria-label="Fullscreen mode"
  366. title="Fullscreen mode"><i
  367. class="fas fa-expand"></i></button></a>
  368. <!-- Launch buttons -->
  369. <div class="dropdown-buttons-trigger">
  370. <button id="dropdown-buttons-trigger" class="btn btn-secondary topbarbtn"
  371. aria-label="Launch interactive content"><i class="fas fa-rocket"></i></button>
  372. <div class="dropdown-buttons">
  373. <a class="binder-button" href="https://mybinder.org/v2/gh/probml/ssm-book/main?urlpath=tree/chapters/ssm/ssm.ipynb"><button type="button"
  374. class="btn btn-secondary topbarbtn" title="Launch Binder" data-toggle="tooltip"
  375. data-placement="left"><img class="binder-button-logo"
  376. src="../../_static/images/logo_binder.svg"
  377. alt="Interact on binder">Binder</button></a>
  378. <a class="colab-button" href="https://colab.research.google.com/github/probml/ssm-book/blob/main/chapters/ssm/ssm.ipynb"><button type="button" class="btn btn-secondary topbarbtn"
  379. title="Launch Colab" data-toggle="tooltip" data-placement="left"><img class="colab-button-logo"
  380. src="../../_static/images/logo_colab.png"
  381. alt="Interact on Colab">Colab</button></a>
  382. </div>
  383. </div>
  384. </div>
  385. <!-- Table of contents -->
  386. <div class="d-none d-md-block col-md-2 bd-toc show noprint">
  387. <div class="tocsection onthispage pt-5 pb-3">
  388. <i class="fas fa-list"></i> Contents
  389. </div>
  390. <nav id="bd-toc-nav" aria-label="Page">
  391. <ul class="visible nav section-nav flex-column">
  392. <li class="toc-h1 nav-item toc-entry">
  393. <a class="reference internal nav-link" href="#">
  394. What are State Space Models?
  395. </a>
  396. </li>
  397. <li class="toc-h1 nav-item toc-entry">
  398. <a class="reference internal nav-link" href="#hidden-markov-models">
  399. Hidden Markov Models
  400. </a>
  401. <ul class="visible nav section-nav flex-column">
  402. <li class="toc-h2 nav-item toc-entry">
  403. <a class="reference internal nav-link" href="#example-casino-hmm">
  404. Example: Casino HMM
  405. </a>
  406. </li>
  407. </ul>
  408. </li>
  409. </ul>
  410. </nav>
  411. </div>
  412. </div>
  413. </div>
  414. <div id="main-content" class="row">
  415. <div class="col-12 col-md-9 pl-md-3 pr-md-0">
  416. <!-- Table of contents that is only displayed when printing the page -->
  417. <div id="jb-print-docs-body" class="onlyprint">
  418. <h1>What are State Space Models?</h1>
  419. <!-- Table of contents -->
  420. <div id="print-main-content">
  421. <div id="jb-print-toc">
  422. <div>
  423. <h2> Contents </h2>
  424. </div>
  425. <nav aria-label="Page">
  426. <ul class="visible nav section-nav flex-column">
  427. <li class="toc-h1 nav-item toc-entry">
  428. <a class="reference internal nav-link" href="#">
  429. What are State Space Models?
  430. </a>
  431. </li>
  432. <li class="toc-h1 nav-item toc-entry">
  433. <a class="reference internal nav-link" href="#hidden-markov-models">
  434. Hidden Markov Models
  435. </a>
  436. <ul class="visible nav section-nav flex-column">
  437. <li class="toc-h2 nav-item toc-entry">
  438. <a class="reference internal nav-link" href="#example-casino-hmm">
  439. Example: Casino HMM
  440. </a>
  441. </li>
  442. </ul>
  443. </li>
  444. </ul>
  445. </nav>
  446. </div>
  447. </div>
  448. </div>
  449. <div>
  450. <div class="cell docutils container">
  451. <div class="cell_input docutils container">
  452. <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># meta-data does not work yet in VScode</span>
  453. <span class="c1"># https://github.com/microsoft/vscode-jupyter/issues/1121</span>
  454. <span class="p">{</span>
  455. <span class="s2">&quot;tags&quot;</span><span class="p">:</span> <span class="p">[</span>
  456. <span class="s2">&quot;hide-cell&quot;</span>
  457. <span class="p">]</span>
  458. <span class="p">}</span>
  459. <span class="c1">### Install necessary libraries</span>
  460. <span class="k">try</span><span class="p">:</span>
  461. <span class="kn">import</span> <span class="nn">jax</span>
  462. <span class="k">except</span><span class="p">:</span>
  463. <span class="c1"># For cuda version, see https://github.com/google/jax#installation</span>
  464. <span class="o">%</span><span class="k">pip</span> install --upgrade &quot;jax[cpu]&quot;
  465. <span class="kn">import</span> <span class="nn">jax</span>
  466. <span class="k">try</span><span class="p">:</span>
  467. <span class="kn">import</span> <span class="nn">jsl</span>
  468. <span class="k">except</span><span class="p">:</span>
  469. <span class="o">%</span><span class="k">pip</span> install git+https://github.com/probml/jsl
  470. <span class="kn">import</span> <span class="nn">jsl</span>
  471. <span class="k">try</span><span class="p">:</span>
  472. <span class="kn">import</span> <span class="nn">rich</span>
  473. <span class="k">except</span><span class="p">:</span>
  474. <span class="o">%</span><span class="k">pip</span> install rich
  475. <span class="kn">import</span> <span class="nn">rich</span>
  476. </pre></div>
  477. </div>
  478. </div>
  479. </div>
  480. <div class="cell docutils container">
  481. <div class="cell_input docutils container">
  482. <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
  483. <span class="s2">&quot;tags&quot;</span><span class="p">:</span> <span class="p">[</span>
  484. <span class="s2">&quot;hide-cell&quot;</span>
  485. <span class="p">]</span>
  486. <span class="p">}</span>
  487. <span class="c1">### Import standard libraries</span>
  488. <span class="kn">import</span> <span class="nn">abc</span>
  489. <span class="kn">from</span> <span class="nn">dataclasses</span> <span class="kn">import</span> <span class="n">dataclass</span>
  490. <span class="kn">import</span> <span class="nn">functools</span>
  491. <span class="kn">import</span> <span class="nn">itertools</span>
  492. <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>
  493. <span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="nn">plt</span>
  494. <span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
  495. <span class="kn">import</span> <span class="nn">jax</span>
  496. <span class="kn">import</span> <span class="nn">jax.numpy</span> <span class="k">as</span> <span class="nn">jnp</span>
  497. <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>
  498. <span class="kn">from</span> <span class="nn">jax.scipy.special</span> <span class="kn">import</span> <span class="n">logit</span>
  499. <span class="kn">from</span> <span class="nn">jax.nn</span> <span class="kn">import</span> <span class="n">softmax</span>
  500. <span class="kn">from</span> <span class="nn">functools</span> <span class="kn">import</span> <span class="n">partial</span>
  501. <span class="kn">from</span> <span class="nn">jax.random</span> <span class="kn">import</span> <span class="n">PRNGKey</span><span class="p">,</span> <span class="n">split</span>
  502. <span class="kn">import</span> <span class="nn">inspect</span>
  503. <span class="kn">import</span> <span class="nn">inspect</span> <span class="k">as</span> <span class="nn">py_inspect</span>
  504. <span class="kn">import</span> <span class="nn">rich</span>
  505. <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>
  506. <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>
  507. <span class="k">def</span> <span class="nf">print_source</span><span class="p">(</span><span class="n">fname</span><span class="p">):</span>
  508. <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>
  509. </pre></div>
  510. </div>
  511. </div>
  512. </div>
  513. <div class="math notranslate nohighlight">
  514. \[ \begin{align}\begin{aligned}\newcommand\floor[1]{\lfloor#1\rfloor}\\\newcommand{\real}{\mathbb{R}}\\% Numbers
  515. \newcommand{\vzero}{\boldsymbol{0}}
  516. \newcommand{\vone}{\boldsymbol{1}}\\% Greek https://www.latex-tutorial.com/symbols/greek-alphabet/
  517. \newcommand{\valpha}{\boldsymbol{\alpha}}
  518. \newcommand{\vbeta}{\boldsymbol{\beta}}
  519. \newcommand{\vchi}{\boldsymbol{\chi}}
  520. \newcommand{\vdelta}{\boldsymbol{\delta}}
  521. \newcommand{\vDelta}{\boldsymbol{\Delta}}
  522. \newcommand{\vepsilon}{\boldsymbol{\epsilon}}
  523. \newcommand{\vzeta}{\boldsymbol{\zeta}}
  524. \newcommand{\vXi}{\boldsymbol{\Xi}}
  525. \newcommand{\vell}{\boldsymbol{\ell}}
  526. \newcommand{\veta}{\boldsymbol{\eta}}
  527. %\newcommand{\vEta}{\boldsymbol{\Eta}}
  528. \newcommand{\vgamma}{\boldsymbol{\gamma}}
  529. \newcommand{\vGamma}{\boldsymbol{\Gamma}}
  530. \newcommand{\vmu}{\boldsymbol{\mu}}
  531. \newcommand{\vmut}{\boldsymbol{\tilde{\mu}}}
  532. \newcommand{\vnu}{\boldsymbol{\nu}}
  533. \newcommand{\vkappa}{\boldsymbol{\kappa}}
  534. \newcommand{\vlambda}{\boldsymbol{\lambda}}
  535. \newcommand{\vLambda}{\boldsymbol{\Lambda}}
  536. \newcommand{\vLambdaBar}{\overline{\vLambda}}
  537. %\newcommand{\vnu}{\boldsymbol{\nu}}
  538. \newcommand{\vomega}{\boldsymbol{\omega}}
  539. \newcommand{\vOmega}{\boldsymbol{\Omega}}
  540. \newcommand{\vphi}{\boldsymbol{\phi}}
  541. \newcommand{\vvarphi}{\boldsymbol{\varphi}}
  542. \newcommand{\vPhi}{\boldsymbol{\Phi}}
  543. \newcommand{\vpi}{\boldsymbol{\pi}}
  544. \newcommand{\vPi}{\boldsymbol{\Pi}}
  545. \newcommand{\vpsi}{\boldsymbol{\psi}}
  546. \newcommand{\vPsi}{\boldsymbol{\Psi}}
  547. \newcommand{\vrho}{\boldsymbol{\rho}}
  548. \newcommand{\vtheta}{\boldsymbol{\theta}}
  549. \newcommand{\vthetat}{\boldsymbol{\tilde{\theta}}}
  550. \newcommand{\vTheta}{\boldsymbol{\Theta}}
  551. \newcommand{\vsigma}{\boldsymbol{\sigma}}
  552. \newcommand{\vSigma}{\boldsymbol{\Sigma}}
  553. \newcommand{\vSigmat}{\boldsymbol{\tilde{\Sigma}}}
  554. \newcommand{\vsigmoid}{\vsigma}
  555. \newcommand{\vtau}{\boldsymbol{\tau}}
  556. \newcommand{\vxi}{\boldsymbol{\xi}}\\
  557. % Lower Roman (Vectors)
  558. \newcommand{\va}{\mathbf{a}}
  559. \newcommand{\vb}{\mathbf{b}}
  560. \newcommand{\vBt}{\mathbf{\tilde{B}}}
  561. \newcommand{\vc}{\mathbf{c}}
  562. \newcommand{\vct}{\mathbf{\tilde{c}}}
  563. \newcommand{\vd}{\mathbf{d}}
  564. \newcommand{\ve}{\mathbf{e}}
  565. \newcommand{\vf}{\mathbf{f}}
  566. \newcommand{\vg}{\mathbf{g}}
  567. \newcommand{\vh}{\mathbf{h}}
  568. %\newcommand{\myvh}{\mathbf{h}}
  569. \newcommand{\vi}{\mathbf{i}}
  570. \newcommand{\vj}{\mathbf{j}}
  571. \newcommand{\vk}{\mathbf{k}}
  572. \newcommand{\vl}{\mathbf{l}}
  573. \newcommand{\vm}{\mathbf{m}}
  574. \newcommand{\vn}{\mathbf{n}}
  575. \newcommand{\vo}{\mathbf{o}}
  576. \newcommand{\vp}{\mathbf{p}}
  577. \newcommand{\vq}{\mathbf{q}}
  578. \newcommand{\vr}{\mathbf{r}}
  579. \newcommand{\vs}{\mathbf{s}}
  580. \newcommand{\vt}{\mathbf{t}}
  581. \newcommand{\vu}{\mathbf{u}}
  582. \newcommand{\vv}{\mathbf{v}}
  583. \newcommand{\vw}{\mathbf{w}}
  584. \newcommand{\vws}{\vw_s}
  585. \newcommand{\vwt}{\mathbf{\tilde{w}}}
  586. \newcommand{\vWt}{\mathbf{\tilde{W}}}
  587. \newcommand{\vwh}{\hat{\vw}}
  588. \newcommand{\vx}{\mathbf{x}}
  589. %\newcommand{\vx}{\mathbf{x}}
  590. \newcommand{\vxt}{\mathbf{\tilde{x}}}
  591. \newcommand{\vy}{\mathbf{y}}
  592. \newcommand{\vyt}{\mathbf{\tilde{y}}}
  593. \newcommand{\vz}{\mathbf{z}}
  594. %\newcommand{\vzt}{\mathbf{\tilde{z}}}\\
  595. % Upper Roman (Matrices)
  596. \newcommand{\vA}{\mathbf{A}}
  597. \newcommand{\vB}{\mathbf{B}}
  598. \newcommand{\vC}{\mathbf{C}}
  599. \newcommand{\vD}{\mathbf{D}}
  600. \newcommand{\vE}{\mathbf{E}}
  601. \newcommand{\vF}{\mathbf{F}}
  602. \newcommand{\vG}{\mathbf{G}}
  603. \newcommand{\vH}{\mathbf{H}}
  604. \newcommand{\vI}{\mathbf{I}}
  605. \newcommand{\vJ}{\mathbf{J}}
  606. \newcommand{\vK}{\mathbf{K}}
  607. \newcommand{\vL}{\mathbf{L}}
  608. \newcommand{\vM}{\mathbf{M}}
  609. \newcommand{\vMt}{\mathbf{\tilde{M}}}
  610. \newcommand{\vN}{\mathbf{N}}
  611. \newcommand{\vO}{\mathbf{O}}
  612. \newcommand{\vP}{\mathbf{P}}
  613. \newcommand{\vQ}{\mathbf{Q}}
  614. \newcommand{\vR}{\mathbf{R}}
  615. \newcommand{\vS}{\mathbf{S}}
  616. \newcommand{\vT}{\mathbf{T}}
  617. \newcommand{\vU}{\mathbf{U}}
  618. \newcommand{\vV}{\mathbf{V}}
  619. \newcommand{\vW}{\mathbf{W}}
  620. \newcommand{\vX}{\mathbf{X}}
  621. %\newcommand{\vXs}{\vX_{\vs}}
  622. \newcommand{\vXs}{\vX_{s}}
  623. \newcommand{\vXt}{\mathbf{\tilde{X}}}
  624. \newcommand{\vY}{\mathbf{Y}}
  625. \newcommand{\vZ}{\mathbf{Z}}
  626. \newcommand{\vZt}{\mathbf{\tilde{Z}}}
  627. \newcommand{\vzt}{\mathbf{\tilde{z}}}\\
  628. %%%%
  629. \newcommand{\hidden}{\vz}
  630. \newcommand{\obs}{\vy}
  631. \newcommand{\inputs}{\vu}
  632. \newcommand{\input}{\inputs}\\\newcommand{\hmmTrans}{\vA}
  633. \newcommand{\hmmObs}{\vB}
  634. \newcommand{\hmmInit}{\vpi}
  635. \newcommand{\hmmhid}{\hidden}
  636. \newcommand{\hmmobs}{\obs}\\\newcommand{\ldsDyn}{\vA}
  637. \newcommand{\ldsObs}{\vC}
  638. \newcommand{\ldsDynIn}{\vB}
  639. \newcommand{\ldsObsIn}{\vD}
  640. \newcommand{\ldsDynNoise}{\vQ}
  641. \newcommand{\ldsObsNoise}{\vR}\\\newcommand{\ssmDyn}{f}
  642. \newcommand{\ssmObs}{h}\end{aligned}\end{align} \]</div>
  643. <div class="tex2jax_ignore mathjax_ignore section" id="what-are-state-space-models">
  644. <span id="sec-ssm-intro"></span><h1>What are State Space Models?<a class="headerlink" href="#what-are-state-space-models" title="Permalink to this headline">¶</a></h1>
  645. <p>A state space model or SSM
  646. is a partially observed Markov model,
  647. in which the hidden state, <span class="math notranslate nohighlight">\(\hidden_t\)</span>,
  648. evolves over time according to a Markov process,
  649. possibly conditional on external inputs or controls <span class="math notranslate nohighlight">\(\input_t\)</span>,
  650. and each hidden state generates some
  651. observations <span class="math notranslate nohighlight">\(\obs_t\)</span> at each time step.
  652. (In this book, we mostly focus on discrete time systems,
  653. although we consider the continuous-time case in XXX.)
  654. We get to see the observations, but not the hidden state.
  655. Our main goal is to infer the hidden state given the observations.
  656. However, we can also use the model to predict future observations,
  657. by first predicting future hidden states, and then predicting
  658. what observations they might generate.
  659. By using a hidden state <span class="math notranslate nohighlight">\(\hidden_t\)</span>
  660. to represent the past observations, <span class="math notranslate nohighlight">\(\obs_{1:t-1}\)</span>,
  661. the model can have ``infinite’’ memory,
  662. unlike a standard Markov model.</p>
  663. <p>Formally we can define an SSM
  664. as the following joint distribution:</p>
  665. <div class="math notranslate nohighlight" id="equation-ssmfull">
  666. <span class="eqno">(2)<a class="headerlink" href="#equation-ssmfull" title="Permalink to this equation">¶</a></span>\[p(\hmmobs_{1:T},\hmmhid_{1:T}|\inputs_{1:T})
  667. = \left[ p(\hmmhid_1|\inputs_1) \prod_{t=2}^{T}
  668. p(\hmmhid_t|\hmmhid_{t-1},\inputs_t) \right]
  669. \left[ \prod_{t=1}^T p(\hmmobs_t|\hmmhid_t, \inputs_t, \hmmobs_{t-1}) \right]\]</div>
  670. <p>where <span class="math notranslate nohighlight">\(p(\hmmhid_t|\hmmhid_{t-1},\inputs_t)\)</span> is the
  671. transition model,
  672. <span class="math notranslate nohighlight">\(p(\hmmobs_t|\hmmhid_t, \inputs_t, \hmmobs_{t-1})\)</span> is the
  673. observation model,
  674. and <span class="math notranslate nohighlight">\(\inputs_{t}\)</span> is an optional input or action.
  675. See <a class="reference internal" href="#ssm-ar"><span class="std std-numref">Figure 3</span></a>
  676. for an illustration of the corresponding graphical model.</p>
  677. <div class="figure align-default" id="ssm-ar">
  678. <a class="reference internal image-reference" href="../../_images/SSM-AR-inputs.png"><img alt="../../_images/SSM-AR-inputs.png" src="../../_images/SSM-AR-inputs.png" style="width: 152.0px; height: 165.0px;" /></a>
  679. <p class="caption"><span class="caption-number">Fig. 3 </span><span class="caption-text">Illustration of an SSM as a graphical model.</span><a class="headerlink" href="#ssm-ar" title="Permalink to this image">¶</a></p>
  680. </div>
  681. <p>We often consider a simpler setting in which there
  682. are no external inputs,
  683. and the observations are conditionally independent of each other
  684. (rather than having Markovian dependencies) given the hidden state.
  685. In this case the joint simplifies to</p>
  686. <div class="math notranslate nohighlight" id="equation-ssmsimplified">
  687. <span class="eqno">(3)<a class="headerlink" href="#equation-ssmsimplified" title="Permalink to this equation">¶</a></span>\[p(\hmmobs_{1:T},\hmmhid_{1:T})
  688. = \left[ p(\hmmhid_1) \prod_{t=2}^{T}
  689. p(\hmmhid_t|\hmmhid_{t-1}) \right]
  690. \left[ \prod_{t=1}^T p(\hmmobs_t|\hmmhid_t \right]\]</div>
  691. <p>See <a class="reference internal" href="#ssm-simplified"><span class="std std-numref">Figure 4</span></a>
  692. for an illustration of the corresponding graphical model.
  693. Compare <a class="reference internal" href="#equation-ssmfull">(2)</a> and <a class="reference internal" href="#equation-ssmsimplified">(3)</a>.</p>
  694. <div class="figure align-default" id="ssm-simplified">
  695. <a class="reference internal image-reference" href="../../_images/SSM-simplified.png"><img alt="../../_images/SSM-simplified.png" src="../../_images/SSM-simplified.png" style="width: 136.0px; height: 98.0px;" /></a>
  696. <p class="caption"><span class="caption-number">Fig. 4 </span><span class="caption-text">Illustration of a simplified SSM.</span><a class="headerlink" href="#ssm-simplified" title="Permalink to this image">¶</a></p>
  697. </div>
  698. </div>
  699. <div class="tex2jax_ignore mathjax_ignore section" id="hidden-markov-models">
  700. <span id="sec-hmm-intro"></span><h1>Hidden Markov Models<a class="headerlink" href="#hidden-markov-models" title="Permalink to this headline">¶</a></h1>
  701. <p>In this section, we discuss the
  702. hidden Markov model or HMM,
  703. which is a state space model in which the hidden states
  704. are discrete, so <span class="math notranslate nohighlight">\(\hmmhid_t \in \{1,\ldots, K\}\)</span>.
  705. The observations may be discrete,
  706. <span class="math notranslate nohighlight">\(\hmmobs_t \in \{1,\ldots, C\}\)</span>,
  707. or continuous,
  708. <span class="math notranslate nohighlight">\(\hmmobs_t \in \real^D\)</span>,
  709. or some combination,
  710. as we illustrate below.
  711. More details can be found in e.g.,
  712. <span id="id1">[<a class="reference internal" href="../../bib.html#id34" title="O. Cappe, E. Moulines, and T. Ryden. Inference in Hidden Markov Models. Springer, 2005.">CMR05</a>, <a class="reference internal" href="../../bib.html#id33" title="A. Fraser. Hidden Markov Models and Dynamical Systems. SIAM Press, 2008.">Fra08</a>, <a class="reference internal" href="../../bib.html#id32" title="L. R. Rabiner. A tutorial on Hidden Markov Models and selected applications in speech recognition. Proc. of the IEEE, 77(2):257–286, 1989.">Rab89</a>]</span>.
  713. For an interactive introduction,
  714. see <a class="reference external" href="https://nipunbatra.github.io/hmm/">https://nipunbatra.github.io/hmm/</a>.</p>
  715. <div class="section" id="example-casino-hmm">
  716. <h2>Example: Casino HMM<a class="headerlink" href="#example-casino-hmm" title="Permalink to this headline">¶</a></h2>
  717. <p>To illustrate HMMs with categorical observation model,
  718. we consider the “Ocassionally dishonest casino” model from <span id="id2">[<a class="reference internal" href="../../bib.html#id3" title="R. Durbin, S. Eddy, A. Krogh, and G. Mitchison. Biological Sequence Analysis: Probabilistic Models of Proteins and Nucleic Acids. Cambridge University Press, 1998.">DEKM98</a>]</span>.
  719. There are 2 hidden states, representing whether the dice being used in the casino is fair or loaded.
  720. Each state defines a distribution over the 6 possible observations.</p>
  721. <p>The transition model is denoted by</p>
  722. <div class="math notranslate nohighlight">
  723. \[p(z_t=j|z_{t-1}=i) = \hmmTrans_{ij}\]</div>
  724. <p>Here the <span class="math notranslate nohighlight">\(i\)</span>’th row of <span class="math notranslate nohighlight">\(\vA\)</span> corresponds to the outgoing distribution from state <span class="math notranslate nohighlight">\(i\)</span>.
  725. This is a row stochastic matrix,
  726. meaning each row sums to one.
  727. We can visualize
  728. the non-zero entries in the transition matrix by creating a state transition diagram,
  729. as shown in <a class="reference internal" href="#casino-fig"><span class="std std-ref">Illustration of the casino HMM.</span></a>.</p>
  730. <div class="figure align-default" id="casino-fig">
  731. <a class="reference internal image-reference" href="../../_images/casino.png"><img alt="../../_images/casino.png" src="../../_images/casino.png" style="width: 208.5px; height: 142.5px;" /></a>
  732. <p class="caption"><span class="caption-number">Fig. 5 </span><span class="caption-text">Illustration of the casino HMM.</span><a class="headerlink" href="#casino-fig" title="Permalink to this image">¶</a></p>
  733. </div>
  734. <p>The observation model
  735. <span class="math notranslate nohighlight">\(p(\obs_t|\hiddden_t=j)\)</span> has the form</p>
  736. <div class="math notranslate nohighlight">
  737. \[p(\obs_t=k|\hidden_t=j) = \hmmObs_{jk} \]</div>
  738. <p>This is represented by the histograms associated with each
  739. state in <a class="reference internal" href="#casino-fig"><span class="std std-ref">Illustration of the casino HMM.</span></a>.</p>
  740. <p>Finally,
  741. the initial state distribution is denoted by</p>
  742. <div class="math notranslate nohighlight">
  743. \[p(z_1=j) = \hmmInit_j\]</div>
  744. <p>Collectively we denote all the parameters by <span class="math notranslate nohighlight">\(\vtheta=(\hmmTrans, \hmmObs, \hmmInit)\)</span>.</p>
  745. <p>Now let us implement this model code.</p>
  746. <div class="cell docutils container">
  747. <div class="cell_input docutils container">
  748. <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># state transition matrix</span>
  749. <span class="n">A</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span>
  750. <span class="p">[</span><span class="mf">0.95</span><span class="p">,</span> <span class="mf">0.05</span><span class="p">],</span>
  751. <span class="p">[</span><span class="mf">0.10</span><span class="p">,</span> <span class="mf">0.90</span><span class="p">]</span>
  752. <span class="p">])</span>
  753. <span class="c1"># observation matrix</span>
  754. <span class="n">B</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span>
  755. <span class="p">[</span><span class="mi">1</span><span class="o">/</span><span class="mi">6</span><span class="p">,</span> <span class="mi">1</span><span class="o">/</span><span class="mi">6</span><span class="p">,</span> <span class="mi">1</span><span class="o">/</span><span class="mi">6</span><span class="p">,</span> <span class="mi">1</span><span class="o">/</span><span class="mi">6</span><span class="p">,</span> <span class="mi">1</span><span class="o">/</span><span class="mi">6</span><span class="p">,</span> <span class="mi">1</span><span class="o">/</span><span class="mi">6</span><span class="p">],</span> <span class="c1"># fair die</span>
  756. <span class="p">[</span><span class="mi">1</span><span class="o">/</span><span class="mi">10</span><span class="p">,</span> <span class="mi">1</span><span class="o">/</span><span class="mi">10</span><span class="p">,</span> <span class="mi">1</span><span class="o">/</span><span class="mi">10</span><span class="p">,</span> <span class="mi">1</span><span class="o">/</span><span class="mi">10</span><span class="p">,</span> <span class="mi">1</span><span class="o">/</span><span class="mi">10</span><span class="p">,</span> <span class="mi">5</span><span class="o">/</span><span class="mi">10</span><span class="p">]</span> <span class="c1"># loaded die</span>
  757. <span class="p">])</span>
  758. <span class="n">pi</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">])</span>
  759. <span class="p">(</span><span class="n">nstates</span><span class="p">,</span> <span class="n">nobs</span><span class="p">)</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">shape</span><span class="p">(</span><span class="n">B</span><span class="p">)</span>
  760. </pre></div>
  761. </div>
  762. </div>
  763. </div>
  764. </div>
  765. </div>
  766. <script type="text/x-thebe-config">
  767. {
  768. requestKernel: true,
  769. binderOptions: {
  770. repo: "binder-examples/jupyter-stacks-datascience",
  771. ref: "master",
  772. },
  773. codeMirrorConfig: {
  774. theme: "abcdef",
  775. mode: "python"
  776. },
  777. kernelOptions: {
  778. kernelName: "python3",
  779. path: "./chapters/ssm"
  780. },
  781. predefinedOutput: true
  782. }
  783. </script>
  784. <script>kernelName = 'python3'</script>
  785. </div>
  786. <!-- Previous / next buttons -->
  787. <div class='prev-next-area'>
  788. <a class='left-prev' id="prev-link" href="../scratch.html" title="previous page">
  789. <i class="fas fa-angle-left"></i>
  790. <div class="prev-next-info">
  791. <p class="prev-next-subtitle">previous</p>
  792. <p class="prev-next-title">Scratchpad</p>
  793. </div>
  794. </a>
  795. <a class='right-next' id="next-link" href="../hmm/hmm_index.html" title="next page">
  796. <div class="prev-next-info">
  797. <p class="prev-next-subtitle">next</p>
  798. <p class="prev-next-title">Inference in discrete SSMs</p>
  799. </div>
  800. <i class="fas fa-angle-right"></i>
  801. </a>
  802. </div>
  803. </div>
  804. </div>
  805. <footer class="footer">
  806. <p>
  807. By Kevin Murphy, Scott Linderman, et al.<br/>
  808. &copy; Copyright 2021.<br/>
  809. </p>
  810. </footer>
  811. </main>
  812. </div>
  813. </div>
  814. <script src="../../_static/js/index.be7d3bbb2ef33a8344ce.js"></script>
  815. </body>
  816. </html>