Skip to content

Commit 722b169

Browse files
committed
Not adding or removing semicolons
1 parent df70347 commit 722b169

File tree

6 files changed

+35
-35
lines changed

6 files changed

+35
-35
lines changed

Prologue/Prologue.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
"def css_styling():\n",
193193
" styles = open(\"../styles/custom.css\", \"r\").read()\n",
194194
" return HTML(styles)\n",
195-
"css_styling();"
195+
"css_styling()"
196196
],
197197
"language": "python",
198198
"metadata": {},

sandbox/ABCtests.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"cell_type": "code",
1919
"collapsed": false,
2020
"input": [
21-
"import pymc as pm;"
21+
"import pymc as pm"
2222
],
2323
"language": "python",
2424
"metadata": {},
@@ -40,7 +40,7 @@
4040
" if np.array_equal(fake_obs, obs):\n",
4141
" return uni\n",
4242
" else:\n",
43-
" return None;"
43+
" return None"
4444
],
4545
"language": "python",
4646
"metadata": {},
@@ -51,7 +51,7 @@
5151
"cell_type": "code",
5252
"collapsed": false,
5353
"input": [
54-
"mcmc = pm.MCMC([uni, fake_obs, accept]);"
54+
"mcmc = pm.MCMC([uni, fake_obs, accept])"
5555
],
5656
"language": "python",
5757
"metadata": {},
@@ -62,7 +62,7 @@
6262
"cell_type": "code",
6363
"collapsed": false,
6464
"input": [
65-
"mcmc.sample(10000);"
65+
"mcmc.sample(10000)"
6666
],
6767
"language": "python",
6868
"metadata": {},
@@ -89,7 +89,7 @@
8989
"cell_type": "code",
9090
"collapsed": false,
9191
"input": [
92-
"samples = mcmc.trace('accept')[:];"
92+
"samples = mcmc.trace('accept')[:]"
9393
],
9494
"language": "python",
9595
"metadata": {},
@@ -100,7 +100,7 @@
100100
"cell_type": "code",
101101
"collapsed": false,
102102
"input": [
103-
"hist(samples[samples > 0]);"
103+
"hist(samples[samples > 0])"
104104
],
105105
"language": "python",
106106
"metadata": {},
@@ -127,7 +127,7 @@
127127
"cell_type": "code",
128128
"collapsed": false,
129129
"input": [
130-
"samples[:1000];"
130+
"samples[:1000]"
131131
],
132132
"language": "python",
133133
"metadata": {},

sandbox/CommitDataForChapter1.ipynb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"from requests import get\n",
2222
"response = get('https://api.github.com/repos/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/stats/commit_activity').json()\n",
2323
"weekly_totals = np.array(map(lambda x: x['total'], response))\n",
24-
"weekly_totals = weekly_totals[np.where(weekly_totals)[0]] # gives me 52 weeks, but project started < 1 year ago so it backwards fills with 0s;"
24+
"weekly_totals = weekly_totals[np.where(weekly_totals)[0]] # gives me 52 weeks, but project started < 1 year ago so it backwards fills with 0s"
2525
],
2626
"language": "python",
2727
"metadata": {},
@@ -35,9 +35,9 @@
3535
"count_data = weekly_totals\n",
3636
"n_count_data = len(weekly_totals)\n",
3737
"\n",
38-
"plt.bar(range(n_count_data), weekly_totals)\n",
38+
"plt.bar(range(n_count_data), weekly_totals);\n",
3939
"print weekly_totals\n",
40-
"print n_count_data;"
40+
"print n_count_data"
4141
],
4242
"language": "python",
4343
"metadata": {},
@@ -71,7 +71,7 @@
7171
"lambda_1 = pm.Exponential(\"lambda_1\", alpha)\n",
7272
"lambda_2 = pm.Exponential(\"lambda_2\", alpha)\n",
7373
"\n",
74-
"tau = pm.DiscreteUniform(\"tau\", lower=0, upper=n_count_data);"
74+
"tau = pm.DiscreteUniform(\"tau\", lower=0, upper=n_count_data)"
7575
],
7676
"language": "python",
7777
"metadata": {},
@@ -87,7 +87,7 @@
8787
" out = np.zeros(n_count_data)\n",
8888
" out[:tau] = lambda_1 # lambda before tau is lambda1\n",
8989
" out[tau:] = lambda_2 # lambda after tau is lambda2\n",
90-
" return out;"
90+
" return out"
9191
],
9292
"language": "python",
9393
"metadata": {},
@@ -100,7 +100,7 @@
100100
"input": [
101101
"observation = pm.Poisson(\"obs\", lambda_, value=count_data, observed=True)\n",
102102
"\n",
103-
"model = pm.Model([observation, lambda_1, lambda_2, tau]);"
103+
"model = pm.Model([observation, lambda_1, lambda_2, tau])"
104104
],
105105
"language": "python",
106106
"metadata": {},
@@ -113,7 +113,7 @@
113113
"input": [
114114
"# Mysterious code to be explained in Chapter 3.\n",
115115
"mcmc = pm.MCMC(model)\n",
116-
"mcmc.sample(40000, 10000, 1);"
116+
"mcmc.sample(40000, 10000, 1)"
117117
],
118118
"language": "python",
119119
"metadata": {},
@@ -142,7 +142,7 @@
142142
"input": [
143143
"lambda_1_samples = mcmc.trace('lambda_1')[:]\n",
144144
"lambda_2_samples = mcmc.trace('lambda_2')[:]\n",
145-
"tau_samples = mcmc.trace('tau')[:];"
145+
"tau_samples = mcmc.trace('tau')[:]"
146146
],
147147
"language": "python",
148148
"metadata": {},
@@ -188,7 +188,7 @@
188188
"plt.legend(loc=\"upper left\")\n",
189189
"plt.ylim([0, .75])\n",
190190
"plt.xlabel(\"$\\tau$ (in days)\")\n",
191-
"plt.ylabel(\"probability\");"
191+
"plt.ylabel(\"probability\")"
192192
],
193193
"language": "python",
194194
"metadata": {},
@@ -211,7 +211,7 @@
211211
"cell_type": "code",
212212
"collapsed": false,
213213
"input": [
214-
"n_count_data;"
214+
"n_count_data"
215215
],
216216
"language": "python",
217217
"metadata": {},
@@ -230,7 +230,7 @@
230230
"cell_type": "code",
231231
"collapsed": false,
232232
"input": [
233-
"lambda_2_samples;"
233+
"lambda_2_samples"
234234
],
235235
"language": "python",
236236
"metadata": {},

sandbox/GithubUsers.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"print ids[:10]\n",
3131
"print\n",
3232
"print \"Number of unique ids found: \", ids.shape[0]\n",
33-
"print \"Largest user id: \", ids.max();"
33+
"print \"Largest user id: \", ids.max()"
3434
],
3535
"language": "python",
3636
"metadata": {},
@@ -87,7 +87,7 @@
8787
"input": [
8888
"figsize(12.5, 3)\n",
8989
"plt.hist(ids, bins=45, alpha=0.9)\n",
90-
"plt.title(\"Histogram of %d Github User ids\" % ids.shape[0])\n",
90+
"plt.title(\"Histogram of %d Github User ids\" % ids.shape[0]);\n",
9191
"plt.xlabel(\"User id\")\n",
9292
"plt.ylabel(\"Frequency\");"
9393
],
@@ -144,7 +144,7 @@
144144
"\n",
145145
"# code to be examplained in Chp. 3.\n",
146146
"mcmc = pm.MCMC([upper_bound, obs])\n",
147-
"mcmc.sample(100000, 45000);"
147+
"mcmc.sample(100000, 45000)"
148148
],
149149
"language": "python",
150150
"metadata": {},
@@ -176,7 +176,7 @@
176176
"hist(samples, bins=100,\n",
177177
" label=\"Uniform prior\",\n",
178178
" normed=True, alpha=0.8,\n",
179-
" histtype=\"stepfilled\", color=\"#7A68A6\")\n",
179+
" histtype=\"stepfilled\", color=\"#7A68A6\");\n",
180180
"\n",
181181
"quantiles_mean = np.append(mquantiles(samples, [0.05, 0.5, 0.95]), samples.mean())\n",
182182
"print \"Quantiles: \", quantiles_mean[:3]\n",

sandbox/SpaceShuttleBayesFactor.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"plt.ylabel(\"Damage Incident?\")\n",
4646
"plt.xlabel(\"Outside temperature (Farhenhit)\")\n",
4747
"plt.title(\"(Artificial) Defects of the Space Shuttle O-Rings vs \\\n",
48-
"temperature\");"
48+
"temperature\")"
4949
],
5050
"language": "python",
5151
"metadata": {},
@@ -87,7 +87,7 @@
8787
"p_hat = logistic(temperature, beta_hat, alpha_hat)\n",
8888
"print \"estimates of probability at observed temperature, defects: \"\n",
8989
"print np.array(zip(p_hat, temperature, D))[:3, :]\n",
90-
"print \"...\";"
90+
"print \"...\""
9191
],
9292
"language": "python",
9393
"metadata": {},
@@ -140,7 +140,7 @@
140140
"print p_hat\n",
141141
"_product = p_hat ** (D) * (1 - p_hat) ** (1 - D)\n",
142142
"prob_given_model_1 = _product.prod()\n",
143-
"print \"probability of observations, model 1: %.10f\" % prob_given_model_1;"
143+
"print \"probability of observations, model 1: %.10f\" % prob_given_model_1"
144144
],
145145
"language": "python",
146146
"metadata": {},
@@ -198,7 +198,7 @@
198198
"print \"estimates of probability at observed temperature, defects: \"\n",
199199
"print np.array(zip(p_hat, temperature, D))[:3, :]\n",
200200
"print\n",
201-
"print \"Notice the probability is constant for all temperatures?\";"
201+
"print \"Notice the probability is constant for all temperatures?\""
202202
],
203203
"language": "python",
204204
"metadata": {},
@@ -224,7 +224,7 @@
224224
"\n",
225225
"_product = p_hat ** (D) * (1 - p_hat) ** (1 - D)\n",
226226
"prob_given_model_2 = _product.prod()\n",
227-
"print \"probability of observations, model 2: %.10f\" % prob_given_model_2;"
227+
"print \"probability of observations, model 2: %.10f\" % prob_given_model_2"
228228
],
229229
"language": "python",
230230
"metadata": {},
@@ -246,7 +246,7 @@
246246
"cell_type": "code",
247247
"collapsed": false,
248248
"input": [
249-
"print \"Bayes factor = %.3f\" % (prob_given_model_1 / prob_given_model_2);"
249+
"print \"Bayes factor = %.3f\" % (prob_given_model_1 / prob_given_model_2)"
250250
],
251251
"language": "python",
252252
"metadata": {},
@@ -292,7 +292,7 @@
292292
"prob_given_model_2 = _product.prod(axis=1).mean()\n",
293293
"print \"expected prob. of obs., given model 2: %.10f\" % prob_given_model_2\n",
294294
"print\n",
295-
"print \"Bayes factor: %.3f\" % (prob_given_model_1 / prob_given_model_2);"
295+
"print \"Bayes factor: %.3f\" % (prob_given_model_1 / prob_given_model_2)"
296296
],
297297
"language": "python",
298298
"metadata": {},

sandbox/Sum of Gaussian Distributions + noise.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"pl.plot(wavelength, profile1, color='red', linestyle='dashed', label=\"1\")\n",
4343
"pl.plot(wavelength, profile2, color='green', linestyle='dashed', label=\"2\")\n",
4444
"pl.title(\"Feature One and Two\")\n",
45-
"pl.legend();"
45+
"pl.legend()"
4646
],
4747
"language": "python",
4848
"metadata": {},
@@ -96,7 +96,7 @@
9696
" return profile_1 + profile_2\n",
9797
"\n",
9898
"\n",
99-
"observations = pm.Normal(\"obs\", mean, std_deviation, value=combined, observed=True);"
99+
"observations = pm.Normal(\"obs\", mean, std_deviation, value=combined, observed=True)"
100100
],
101101
"language": "python",
102102
"metadata": {},
@@ -116,7 +116,7 @@
116116
" std_deviation])\n",
117117
"\n",
118118
"map_ = pm.MAP(model)\n",
119-
"map_.fit();"
119+
"map_.fit()"
120120
],
121121
"language": "python",
122122
"metadata": {},
@@ -128,7 +128,7 @@
128128
"collapsed": false,
129129
"input": [
130130
"mcmc = pm.MCMC(model)\n",
131-
"mcmc.sample(70000, 60000);"
131+
"mcmc.sample(70000, 60000)"
132132
],
133133
"language": "python",
134134
"metadata": {},
@@ -155,7 +155,7 @@
155155
"cell_type": "code",
156156
"collapsed": false,
157157
"input": [
158-
"mcplot(mcmc);"
158+
"mcplot(mcmc)"
159159
],
160160
"language": "python",
161161
"metadata": {},

0 commit comments

Comments
 (0)