|
10 | 10 | "\n", |
11 | 11 | "This notebook shows how to \"fit\" a linear Gaussian SSM — i.e., estimate the parameters and infer the latent states — using either expectation-maximization (EM) or stochastic gradient descent (SGD) on the negative log marginal likelihood of the data. \n", |
12 | 12 | "\n", |
13 | | - "Here, we work with simulate noisy data from an LG-SSM with known parameters, and then we see how well we can recover the true parameters and states given the observations. The model is,\n", |
| 13 | + "Here, we work with simulated noisy data from an LG-SSM with known parameters, and then we see how well we can recover the true parameters and states given the observations. The model is,\n", |
14 | 14 | "\\begin{align*}\n", |
15 | | - "z_{t+1} \\mid z_t, \\theta &\\sim \\mathrm{N}(F z_t, Q) \\\\\n", |
16 | | - "y_t \\mid z_t, \\theta &\\sim \\mathrm{N}(H z_t, R)\n", |
| 15 | + "z_{t+1} \\mid z_t, \\theta &\\sim \\mathcal{N}(F z_t, Q) \\\\\n", |
| 16 | + "y_t \\mid z_t, \\theta &\\sim \\mathcal{N}(H z_t, R)\n", |
17 | 17 | "\\end{align*}\n", |
18 | | - "where $z_{1:T}$ are the latent states, $y_{1:T}$ are the emissions, and $\\theta = (F, Q, H, R)$ are the model parameters. In particular, $F$ is the dynamics matrix and $H$ is the emission matrix. For our simulation, we use 2-dimensional latent states, $z_t \\in \\mathbb{R}^2$, and 10-dimensional emissions, $y_t \\in \\mathbb{R}^10$. \n", |
| 18 | + "where $z_{1:T}$ are the latent states, $y_{1:T}$ are the emissions, and $\\theta = (F, Q, H, R)$ are the model parameters. In particular, $F$ is the dynamics matrix and $H$ is the emission matrix. For our simulation, we use 2-dimensional latent states, $z_t \\in \\mathbb{R}^2$, and 10-dimensional emissions, $y_t \\in \\mathbb{R}^{10}$. \n", |
19 | 19 | "\n", |
20 | | - "We fit the model to estimate parameters, $\\hat{\\theta}$, using either EM or SGD, as shown below. Once we have estimated the paraemeters, we can also infer the latent states given those parameters.\n" |
| 20 | + "We fit the model to estimate parameters, $\\hat{\\theta}$, using either EM or SGD, as shown below. Once we have estimated the parameters, we can also infer the latent states given those parameters.\n" |
21 | 21 | ] |
22 | 22 | }, |
23 | 23 | { |
|
542 | 542 | "sgd_params, sgd_param_props = model.initialize(\n", |
543 | 543 | " init_key, dynamics_weights=true_A, dynamics_covariance=true_Sigma)\n", |
544 | 544 | "\n", |
545 | | - "print(f\"freeing the dynamics matrix to:\\n {sgd_params.dynamics.weights}\")\n", |
| 545 | + "print(f\"freezing the dynamics matrix to:\\n {sgd_params.dynamics.weights}\")\n", |
546 | 546 | "sgd_param_props.dynamics.weights.trainable = False\n", |
547 | 547 | "sgd_param_props.dynamics.cov.trainable = False\n", |
548 | 548 | "\n", |
|
0 commit comments