|
213 | 213 | " y=1.02,\n", |
214 | 214 | " fontsize=14)\n", |
215 | 215 | "\n", |
216 | | - "plt.tight_layout();" |
| 216 | + "plt.tight_layout()" |
217 | 217 | ], |
218 | 218 | "language": "python", |
219 | 219 | "metadata": {}, |
|
293 | 293 | "plt.ylim(0, 1)\n", |
294 | 294 | "plt.xlabel(\"Prior, $P(A) = p$\")\n", |
295 | 295 | "plt.ylabel(\"Posterior, $P(A|X)$, with $P(A) = p$\")\n", |
296 | | - "plt.title(\"Are there bugs in my code?\");" |
| 296 | + "plt.title(\"Are there bugs in my code?\")" |
297 | 297 | ], |
298 | 298 | "language": "python", |
299 | 299 | "metadata": {}, |
|
438 | 438 | "plt.ylabel(\"probability of $k$\")\n", |
439 | 439 | "plt.xlabel(\"$k$\")\n", |
440 | 440 | "plt.title(\"Probability mass function of a Poisson random variable; differing \\\n", |
441 | | - "$\\lambda$ values\");" |
| 441 | + "$\\lambda$ values\")" |
442 | 442 | ], |
443 | 443 | "language": "python", |
444 | 444 | "metadata": {}, |
|
647 | 647 | "lambda_1 = pm.Exponential(\"lambda_1\", alpha)\n", |
648 | 648 | "lambda_2 = pm.Exponential(\"lambda_2\", alpha)\n", |
649 | 649 | "\n", |
650 | | - "tau = pm.DiscreteUniform(\"tau\", lower=0, upper=n_count_data);" |
| 650 | + "tau = pm.DiscreteUniform(\"tau\", lower=0, upper=n_count_data)" |
651 | 651 | ], |
652 | 652 | "language": "python", |
653 | 653 | "metadata": {}, |
|
665 | 665 | "cell_type": "code", |
666 | 666 | "collapsed": false, |
667 | 667 | "input": [ |
668 | | - "print \"Random output:\", tau.random(), tau.random(), tau.random();" |
| 668 | + "print \"Random output:\", tau.random(), tau.random(), tau.random()" |
669 | 669 | ], |
670 | 670 | "language": "python", |
671 | 671 | "metadata": {}, |
|
689 | 689 | " out = np.zeros(n_count_data)\n", |
690 | 690 | " out[:tau] = lambda_1 # lambda before tau is lambda1\n", |
691 | 691 | " out[tau:] = lambda_2 # lambda after (and including) tau is lambda2\n", |
692 | | - " return out;" |
| 692 | + " return out" |
693 | 693 | ], |
694 | 694 | "language": "python", |
695 | 695 | "metadata": {}, |
|
711 | 711 | "input": [ |
712 | 712 | "observation = pm.Poisson(\"obs\", lambda_, value=count_data, observed=True)\n", |
713 | 713 | "\n", |
714 | | - "model = pm.Model([observation, lambda_1, lambda_2, tau]);" |
| 714 | + "model = pm.Model([observation, lambda_1, lambda_2, tau])" |
715 | 715 | ], |
716 | 716 | "language": "python", |
717 | 717 | "metadata": {}, |
|
733 | 733 | "input": [ |
734 | 734 | "# Mysterious code to be explained in Chapter 3.\n", |
735 | 735 | "mcmc = pm.MCMC(model)\n", |
736 | | - "mcmc.sample(40000, 10000, 1);" |
| 736 | + "mcmc.sample(40000, 10000, 1)" |
737 | 737 | ], |
738 | 738 | "language": "python", |
739 | 739 | "metadata": {}, |
|
762 | 762 | "input": [ |
763 | 763 | "lambda_1_samples = mcmc.trace('lambda_1')[:]\n", |
764 | 764 | "lambda_2_samples = mcmc.trace('lambda_2')[:]\n", |
765 | | - "tau_samples = mcmc.trace('tau')[:];" |
| 765 | + "tau_samples = mcmc.trace('tau')[:]" |
766 | 766 | ], |
767 | 767 | "language": "python", |
768 | 768 | "metadata": {}, |
|
923 | 923 | "cell_type": "code", |
924 | 924 | "collapsed": false, |
925 | 925 | "input": [ |
926 | | - "# type your code here.;" |
| 926 | + "# type your code here." |
927 | 927 | ], |
928 | 928 | "language": "python", |
929 | 929 | "metadata": {}, |
|
941 | 941 | "cell_type": "code", |
942 | 942 | "collapsed": false, |
943 | 943 | "input": [ |
944 | | - "# type your code here.;" |
| 944 | + "# type your code here." |
945 | 945 | ], |
946 | 946 | "language": "python", |
947 | 947 | "metadata": {}, |
|
959 | 959 | "cell_type": "code", |
960 | 960 | "collapsed": false, |
961 | 961 | "input": [ |
962 | | - "# type your code here.;" |
| 962 | + "# type your code here." |
963 | 963 | ], |
964 | 964 | "language": "python", |
965 | 965 | "metadata": {}, |
|
992 | 992 | "def css_styling():\n", |
993 | 993 | " styles = open(\"../styles/custom.css\", \"r\").read()\n", |
994 | 994 | " return HTML(styles)\n", |
995 | | - "css_styling();" |
| 995 | + "css_styling()" |
996 | 996 | ], |
997 | 997 | "language": "python", |
998 | 998 | "metadata": {}, |
|
0 commit comments