|
320 | 320 | " trace = pm.sample(ndraws, tune=nburn, discard_tuned_samples=True)\n",
|
321 | 321 | "\n",
|
322 | 322 | "# plot the traces\n",
|
323 |
| - "_ = pm.traceplot(trace, lines={\"m\": mtrue, \"c\": ctrue})\n", |
| 323 | + "_ = az.plot_trace(trace, lines={\"m\": mtrue, \"c\": ctrue})\n", |
324 | 324 | "\n",
|
325 | 325 | "# put the chains in an array (for later!)\n",
|
326 | 326 | "samples_pymc3 = np.vstack((trace[\"m\"], trace[\"c\"])).T"
|
|
616 | 616 | " trace = pm.sample(ndraws, tune=nburn, discard_tuned_samples=True)\n",
|
617 | 617 | "\n",
|
618 | 618 | "# plot the traces\n",
|
619 |
| - "_ = pm.traceplot(trace, lines={\"m\": mtrue, \"c\": ctrue})\n", |
| 619 | + "_ = az.plot_trace(trace, lines={\"m\": mtrue, \"c\": ctrue})\n", |
620 | 620 | "\n",
|
621 | 621 | "# put the chains in an array (for later!)\n",
|
622 | 622 | "samples_pymc3_2 = np.vstack((trace[\"m\"], trace[\"c\"])).T"
|
|
644 | 644 | " theta = tt.as_tensor_variable([m, c])\n",
|
645 | 645 | "\n",
|
646 | 646 | " # use a Normal distribution\n",
|
647 |
| - " pm.Normal(\"likelihood\", mu=(m * x + c), sd=sigma, observed=data)\n", |
| 647 | + " pm.Normal(\"likelihood\", mu=(m * x + c), sigma=sigma, observed=data)\n", |
648 | 648 | "\n",
|
649 | 649 | " trace = pm.sample(ndraws, tune=nburn, discard_tuned_samples=True)\n",
|
650 | 650 | "\n",
|
651 | 651 | "# plot the traces\n",
|
652 |
| - "_ = pm.traceplot(trace, lines={\"m\": mtrue, \"c\": ctrue})\n", |
| 652 | + "_ = az.plot_trace(trace, lines={\"m\": mtrue, \"c\": ctrue})\n", |
653 | 653 | "\n",
|
654 | 654 | "# put the chains in an array (for later!)\n",
|
655 | 655 | "samples_pymc3_3 = np.vstack((trace[\"m\"], trace[\"c\"])).T"
|
|
832 | 832 | "name": "python",
|
833 | 833 | "nbconvert_exporter": "python",
|
834 | 834 | "pygments_lexer": "ipython3",
|
835 |
| - "version": "3.8.2" |
| 835 | + "version": "3.8.5" |
836 | 836 | }
|
837 | 837 | },
|
838 | 838 | "nbformat": 4,
|
|
0 commit comments