|
17 | 17 | "cell_type": "markdown",
|
18 | 18 | "metadata": {},
|
19 | 19 | "source": [
|
20 |
| - "In this notebook, we will show how it is possible to update the priors as new data becomes available." |
| 20 | + "In this notebook, we will show how, in principle, it is possible to update the priors as new data becomes available.\n", |
| 21 | + "\n", |
| 22 | + "`````{admonition} Words of Caution\n", |
| 23 | + ":class: warning\n", |
| 24 | + "This example provides a very nice usage example for the {class}`~pymc.Interpolated` class, as we will see below. However, this might not be a good idea to do in practice, not only for the posterior -> kde part, but mostly because Interpolated distributions used as priors are **unidimensional** and **uncorrelated**. So even if a perfect fit *marginally* they don't really incorporate all the information we have from the previous posterior into the model, especially when posterior variables are correlated. See a nice discussion about the subject in the blog post [Some dimensionality devils](https://oriolabrilpla.cat/en/blog/posts/2022/too-eager-reduction.html#univariate-priors) by [Oriol Abril](https://oriolabrilpla.cat/en/).\n", |
| 25 | + "``````" |
21 | 26 | ]
|
22 | 27 | },
|
23 | 28 | {
|
|
376 | 381 | "What is interesting to note is that the posterior distributions for our parameters tend to get centered on their true value (vertical lines), and the distribution gets thiner and thiner. This means that we get more confident each time, and the (false) belief we had at the beginning gets flushed away by the new data we incorporate."
|
377 | 382 | ]
|
378 | 383 | },
|
| 384 | + { |
| 385 | + "cell_type": "markdown", |
| 386 | + "metadata": {}, |
| 387 | + "source": [ |
| 388 | + "``````{admonition} Not silver bullet\n", |
| 389 | + ":class: warning\n", |
| 390 | + "Observe that, despite the fact that the iterations seems improving, toms of them look actually a bit sketchy as the MC error can creep in.\n", |
| 391 | + "``````" |
| 392 | + ] |
| 393 | + }, |
| 394 | + { |
| 395 | + "cell_type": "markdown", |
| 396 | + "metadata": {}, |
| 397 | + "source": [ |
| 398 | + "``````{admonition} An alternative approach\n", |
| 399 | + ":class: tip\n", |
| 400 | + "There is an alternative way in `pymc-experimental` trough the function {func}`~pymc_experimental/utils/prior.prior_from_idata` that does something similar. This function:\n", |
| 401 | + "> Creates a prior from posterior using MvNormal approximation.\n", |
| 402 | + "> The approximation uses MvNormal distribution. Keep in mind that this function will only work well for unimodal\n", |
| 403 | + "> posteriors and will fail when complicated interactions happen. Moreover, if a retrieved variable is constrained, you\n", |
| 404 | + "> should specify a transform for the variable, e.g.\n", |
| 405 | + "> {func}`~pymc.distributions.transforms.log` for standard deviation posterior.\n", |
| 406 | + "``````" |
| 407 | + ] |
| 408 | + }, |
379 | 409 | {
|
380 | 410 | "cell_type": "code",
|
381 | 411 | "execution_count": 10,
|
|
0 commit comments