|
295 | 295 | & =-\int q(\theta)\log\frac{\frac{p(\theta,Y)}{p(Y)}}{q(\theta)} d\theta\\ |
296 | 296 | & =-\int q(\theta)\log\frac{p(\theta,Y)}{p(\theta)q(Y)} d\theta\\ |
297 | 297 | & =-\int q(\theta)\left[\log\frac{p(\theta,Y)}{q(\theta)}-\log p(Y)\right] d\theta\\ |
298 | | - & =-\int q(\theta)\log\frac{p(\theta,Y)}{q(\theta)}+\int d\theta q(\theta)\log p(Y) d\theta\\ |
299 | | - & =-\int q(\theta)\log\frac{p(\theta,Y)}{q(\theta)}+\log p(Y) d\theta\\ |
| 298 | + & =-\int q(\theta)\log\frac{p(\theta,Y)}{q(\theta)}+\int q(\theta)\log p(Y) d\theta\\ |
| 299 | + & =-\int q(\theta)\log\frac{p(\theta,Y)}{q(\theta)} d\theta+\log p(Y)\\ |
300 | 300 | \log p(Y)&=D_{KL}(q(\theta;\phi)\;\|\;p(\theta\mid Y))+\int q_{\phi}(\theta)\log\frac{p(\theta,Y)}{q_{\phi}(\theta)} d\theta |
301 | 301 | \end{aligned} |
302 | 302 | $$ |
@@ -563,14 +563,14 @@ The above graphs show that sampling seems to work well with both distributions. |
563 | 563 | Now let's see how well things work with von Mises distributions. |
564 | 564 |
|
565 | 565 | ```{code-cell} ipython3 |
566 | | -# shifted von Mises |
567 | 566 | --- |
568 | 567 | mystnb: |
569 | 568 | figure: |
570 | 569 | caption: | |
571 | 570 | Shifted von Mises distribution |
572 | 571 | name: fig_vonmises_dist |
573 | 572 | --- |
| 573 | +# shifted von Mises |
574 | 574 | exampleVM = BayesianInference(param=10, name_dist="vonMises") |
575 | 575 | exampleVM.show_prior(size=100000, bins=20) |
576 | 576 | ``` |
@@ -815,8 +815,8 @@ BayesianInferencePlot(true_theta, num_list, BETA).MCMC_plot( |
815 | 815 | mystnb: |
816 | 816 | figure: |
817 | 817 | caption: | |
818 | | - SVI density with Beta guide |
819 | | - name: fig_svi_beta |
| 818 | + SVI density with Beta prior and Beta guide |
| 819 | + name: fig_svi_beta_beta |
820 | 820 | --- |
821 | 821 |
|
822 | 822 | BayesianInferencePlot(true_theta, num_list, BETA).SVI_plot( |
@@ -1061,14 +1061,14 @@ BayesianInferencePlot(true_theta, num_list, example_CLASS).SVI_plot( |
1061 | 1061 | ``` |
1062 | 1062 |
|
1063 | 1063 | ```{code-cell} ipython3 |
1064 | | -# von Mises |
1065 | 1064 | --- |
1066 | 1065 | mystnb: |
1067 | 1066 | figure: |
1068 | 1067 | caption: | |
1069 | 1068 | SVI density with von Mises prior and Beta guide |
1070 | 1069 | name: fig_svi_vonmises_beta |
1071 | 1070 | --- |
| 1071 | +# von Mises |
1072 | 1072 | example_CLASS = VONMISES |
1073 | 1073 | print( |
1074 | 1074 | f"=======INFO=======\nParameters: {example_CLASS.param}\nPrior Dist: {example_CLASS.name_dist}" |
|
0 commit comments