|
504 | 504 | " fnew = gp.conditional(\"fnew\", Xnew)\n",
|
505 | 505 | "\n",
|
506 | 506 | "with model:\n",
|
507 |
| - " ppc = pm.sample_posterior_predictive(tr, 200, var_names=['fnew'])" |
| 507 | + " ppc = pm.sample_posterior_predictive(tr, 200, var_names=[\"fnew\"])" |
508 | 508 | ]
|
509 | 509 | },
|
510 | 510 | {
|
|
540 | 540 | " Xnew[:, 0], Xnew[:, 1], s=30, c=np.mean(ppc[\"fnew\"], axis=0), marker=\"s\", norm=norm, cmap=cmap\n",
|
541 | 541 | ")\n",
|
542 | 542 | "plt.ylabel(\"x2\"), plt.xlabel(\"x1\")\n",
|
543 |
| - "plt.title(\n", |
544 |
| - " \"observed data 'y' (circles) with mean of conditional, or predicted, samples (squares)\"\n", |
545 |
| - ");" |
| 543 | + "plt.title(\"observed data 'y' (circles) with mean of conditional, or predicted, samples (squares)\");" |
546 | 544 | ]
|
547 | 545 | },
|
548 | 546 | {
|
|
573 | 571 | }
|
574 | 572 | ],
|
575 | 573 | "source": [
|
576 |
| - "fig, axs = plt.subplots(2,2, figsize=(24, 16))\n", |
577 |
| - "axs = axs.ravel()\n", |
| 574 | + "fig, axs = plt.subplots(2, 2, figsize=(24, 16))\n", |
| 575 | + "axs = axs.ravel()\n", |
578 | 576 | "\n",
|
579 | 577 | "for i, ax in enumerate(axs):\n",
|
580 |
| - " ax.axis('off') \n", |
| 578 | + " ax.axis(\"off\")\n", |
581 | 579 | " ax.scatter(X[:, 0], X[:, 1], s=20, c=y, marker=\"o\", norm=norm, cmap=cmap)\n",
|
582 | 580 | " ax.scatter(Xnew[:, 0], Xnew[:, 1], s=20, c=ppc[\"fnew\"][i], marker=\"s\", norm=norm, cmap=cmap)\n",
|
583 | 581 | " ax.set_title(f\"Sample {i+1}\", fontsize=24)"
|
|
0 commit comments