Skip to content

Commit d3fd0cb

Browse files
committed
Several visual fixes
1 parent eca5ce4 commit d3fd0cb

File tree

2 files changed

+110
-217
lines changed

2 files changed

+110
-217
lines changed

examples/case_studies/bayesian_workflow.ipynb

Lines changed: 103 additions & 205 deletions
Large diffs are not rendered by default.

examples/case_studies/bayesian_workflow.myst.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,6 @@ pz.maxent(dist, lower=0.1, upper=20, mass=0.95);
287287
px.histogram(x=dist.rvs(1000), nbins=20, title="Gamma Distribution Samples")
288288
```
289289

290-
```{code-cell} ipython3
291-
gamma_samples = pm.draw(pm.Gamma.dist(alpha=2, beta=0.2), 1000)
292-
px.histogram(x=gamma_samples, nbins=20, title="Gamma Distribution Samples")
293-
```
294-
295290
```{code-cell} ipython3
296291
t = df_country.select("days_since_100").to_numpy().flatten()
297292
confirmed = df_country.select("confirmed").to_numpy().flatten()
@@ -338,7 +333,7 @@ fig.update_layout(
338333
yaxis=dict(range=[-100, 1000]),
339334
xaxis=dict(range=[0, 10]),
340335
template="plotly_white",
341-
)
336+
);
342337
```
343338

344339
:::{admonition} Progress!
@@ -451,15 +446,15 @@ Before trusting our results, we must verify that the sampler has converged prope
451446
:::
452447

453448
```{code-cell} ipython3
454-
az.plot_trace(trace_exp3, var_names=["a", "b", "alpha"])
449+
az.plot_trace(trace_exp3, var_names=["a", "b", "alpha"]);
455450
```
456451

457452
```{code-cell} ipython3
458453
az.summary(trace_exp3, var_names=["a", "b", "alpha"])
459454
```
460455

461456
```{code-cell} ipython3
462-
az.plot_energy(trace_exp3)
457+
az.plot_energy(trace_exp3);
463458
```
464459

465460
:::{admonition} Convergence Checklist
@@ -558,7 +553,7 @@ for i, (name, trace) in enumerate(results.items()):
558553
ax.set_xlabel("Growth rate (b)")
559554
ax.set_ylabel("Density")
560555
ax.set_title("Sensitivity to Prior Choice")
561-
ax.legend()
556+
ax.legend();
562557
```
563558

564559
:::{admonition} Sensitivity Analysis Results
@@ -870,7 +865,7 @@ with logistic_model:
870865
```
871866

872867
```{code-cell} ipython3
873-
az.plot_trace(trace_logistic)
868+
az.plot_trace(trace_logistic);
874869
```
875870

876871
```{code-cell} ipython3
@@ -967,7 +962,7 @@ with model_exp4:
967962
with logistic_model:
968963
pm.compute_log_likelihood(trace_logistic)
969964
970-
az.plot_compare(az.compare({"exp4": trace_exp4_full, "logistic": trace_logistic}))
965+
az.plot_compare(az.compare({"exp4": trace_exp4_full, "logistic": trace_logistic}));
971966
```
972967

973968
As you can see, the logistic model provides a much better fit to the data.
@@ -1031,7 +1026,7 @@ with logistic_model_us:
10311026
```
10321027

10331028
```{code-cell} ipython3
1034-
az.plot_trace(trace_logistic_us)
1029+
az.plot_trace(trace_logistic_us);
10351030
```
10361031

10371032
```{code-cell} ipython3

0 commit comments

Comments
 (0)