Skip to content

Commit c9636cf

Browse files
committed
Not adding or removing semicolons
1 parent 4fa4310 commit c9636cf

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

Chapter7_BayesianMachineLearning/DontOverfit.ipynb

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"url = \"https://dl.dropbox.com/s/lnly9gw8pb1xhir/overfitting.zip\"\n",
3434
"\n",
3535
"\n",
36-
"results = requests.get(url);"
36+
"results = requests.get(url)"
3737
],
3838
"language": "python",
3939
"metadata": {},
@@ -46,7 +46,7 @@
4646
"input": [
4747
"import StringIO\n",
4848
"z = zipfile.ZipFile(StringIO.StringIO(results.content))\n",
49-
"# z.extractall();;"
49+
"# z.extractall()"
5050
],
5151
"language": "python",
5252
"metadata": {},
@@ -57,7 +57,7 @@
5757
"cell_type": "code",
5858
"collapsed": false,
5959
"input": [
60-
"z.extractall();"
60+
"z.extractall()"
6161
],
6262
"language": "python",
6363
"metadata": {},
@@ -68,7 +68,7 @@
6868
"cell_type": "code",
6969
"collapsed": false,
7070
"input": [
71-
"z.namelist();"
71+
"z.namelist()"
7272
],
7373
"language": "python",
7474
"metadata": {},
@@ -88,7 +88,7 @@
8888
"collapsed": false,
8989
"input": [
9090
"d = z.open('overfitting.csv')\n",
91-
"d.readline();"
91+
"d.readline()"
9292
],
9393
"language": "python",
9494
"metadata": {},
@@ -107,7 +107,7 @@
107107
"cell_type": "code",
108108
"collapsed": false,
109109
"input": [
110-
"import numpy as np;"
110+
"import numpy as np"
111111
],
112112
"language": "python",
113113
"metadata": {},
@@ -118,7 +118,7 @@
118118
"cell_type": "code",
119119
"collapsed": false,
120120
"input": [
121-
"M = np.fromstring(d.read(), sep=\",\");"
121+
"M = np.fromstring(d.read(), sep=\",\")"
122122
],
123123
"language": "python",
124124
"metadata": {},
@@ -129,7 +129,7 @@
129129
"cell_type": "code",
130130
"collapsed": false,
131131
"input": [
132-
"len(d.read());"
132+
"len(d.read())"
133133
],
134134
"language": "python",
135135
"metadata": {},
@@ -167,7 +167,7 @@
167167
"cell_type": "code",
168168
"collapsed": false,
169169
"input": [
170-
"data = np.loadtxt(\"overfitting.csv\", delimiter=\",\", skiprows=1);"
170+
"data = np.loadtxt(\"overfitting.csv\", delimiter=\",\", skiprows=1)"
171171
],
172172
"language": "python",
173173
"metadata": {},
@@ -193,7 +193,7 @@
193193
"\n",
194194
"\"\"\"\n",
195195
"\n",
196-
"data.shape;"
196+
"data.shape"
197197
],
198198
"language": "python",
199199
"metadata": {},
@@ -242,7 +242,7 @@
242242
"testing_labels = data[ix_testing, 2]\n",
243243
"\n",
244244
"print \"training:\", training_data.shape, training_labels.shape\n",
245-
"print \"testing: \", testing_data.shape, testing_labels.shape;"
245+
"print \"testing: \", testing_data.shape, testing_labels.shape"
246246
],
247247
"language": "python",
248248
"metadata": {},
@@ -278,7 +278,7 @@
278278
"cell_type": "code",
279279
"collapsed": false,
280280
"input": [
281-
"figsize(12, 4);"
281+
"figsize(12, 4)"
282282
],
283283
"language": "python",
284284
"metadata": {},
@@ -290,7 +290,7 @@
290290
"collapsed": false,
291291
"input": [
292292
"hist(training_data.flatten())\n",
293-
"print training_data.shape[0] * training_data.shape[1];"
293+
"print training_data.shape[0] * training_data.shape[1]"
294294
],
295295
"language": "python",
296296
"metadata": {},
@@ -322,7 +322,7 @@
322322
"input": [
323323
"import pymc as pm\n",
324324
"\n",
325-
"to_include = pm.Bernoulli(\"to_include\", 0.5, size=200);"
325+
"to_include = pm.Bernoulli(\"to_include\", 0.5, size=200)"
326326
],
327327
"language": "python",
328328
"metadata": {},
@@ -333,7 +333,7 @@
333333
"cell_type": "code",
334334
"collapsed": false,
335335
"input": [
336-
"coef = pm.Uniform(\"coefs\", 0, 1, size=200);"
336+
"coef = pm.Uniform(\"coefs\", 0, 1, size=200)"
337337
],
338338
"language": "python",
339339
"metadata": {},
@@ -347,7 +347,7 @@
347347
"@pm.deterministic\n",
348348
"def Z(coef=coef, to_include=to_include, data=training_data):\n",
349349
" ym = np.dot(to_include * training_data, coef)\n",
350-
" return ym - ym.mean();"
350+
" return ym - ym.mean()"
351351
],
352352
"language": "python",
353353
"metadata": {},
@@ -360,7 +360,7 @@
360360
"input": [
361361
"@pm.deterministic\n",
362362
"def T(z=Z):\n",
363-
" return 0.45 * (np.sign(z) + 1.1);"
363+
" return 0.45 * (np.sign(z) + 1.1)"
364364
],
365365
"language": "python",
366366
"metadata": {},
@@ -375,7 +375,7 @@
375375
"\n",
376376
"model = pm.Model([to_include, coef, Z, T, obs])\n",
377377
"map_ = pm.MAP(model)\n",
378-
"map_.fit();"
378+
"map_.fit()"
379379
],
380380
"language": "python",
381381
"metadata": {},
@@ -394,7 +394,7 @@
394394
"cell_type": "code",
395395
"collapsed": false,
396396
"input": [
397-
"mcmc = pm.MCMC(model);"
397+
"mcmc = pm.MCMC(model)"
398398
],
399399
"language": "python",
400400
"metadata": {},
@@ -405,7 +405,7 @@
405405
"cell_type": "code",
406406
"collapsed": false,
407407
"input": [
408-
"mcmc.sample(100000, 90000, 1);"
408+
"mcmc.sample(100000, 90000, 1)"
409409
],
410410
"language": "python",
411411
"metadata": {},
@@ -432,7 +432,7 @@
432432
"cell_type": "code",
433433
"collapsed": false,
434434
"input": [
435-
"(np.round(T.value) == training_labels).mean();"
435+
"(np.round(T.value) == training_labels).mean()"
436436
],
437437
"language": "python",
438438
"metadata": {},
@@ -452,7 +452,7 @@
452452
"collapsed": false,
453453
"input": [
454454
"t_trace = mcmc.trace(\"T\")[:]\n",
455-
"(np.round(t_trace[-500:-400, :]).mean(axis=0) == training_labels).mean();"
455+
"(np.round(t_trace[-500:-400, :]).mean(axis=0) == training_labels).mean()"
456456
],
457457
"language": "python",
458458
"metadata": {},
@@ -471,7 +471,7 @@
471471
"cell_type": "code",
472472
"collapsed": false,
473473
"input": [
474-
"t_mean = np.round(t_trace).mean(axis=1);"
474+
"t_mean = np.round(t_trace).mean(axis=1)"
475475
],
476476
"language": "python",
477477
"metadata": {},
@@ -483,7 +483,7 @@
483483
"collapsed": false,
484484
"input": [
485485
"imshow(t_trace[-10000:, :], aspect=\"auto\")\n",
486-
"colorbar();"
486+
"colorbar()"
487487
],
488488
"language": "python",
489489
"metadata": {},
@@ -508,7 +508,7 @@
508508
"input": [
509509
"figsize(23, 8)\n",
510510
"coef_trace = mcmc.trace(\"coefs\")[:]\n",
511-
"imshow(coef_trace[-10000:, :], aspect=\"auto\", cmap=pyplot.cm.RdBu, interpolation=\"none\");"
511+
"imshow(coef_trace[-10000:, :], aspect=\"auto\", cmap=pyplot.cm.RdBu, interpolation=\"none\")"
512512
],
513513
"language": "python",
514514
"metadata": {},
@@ -531,7 +531,7 @@
531531
"cell_type": "code",
532532
"collapsed": false,
533533
"input": [
534-
"include_trace = mcmc.trace(\"to_include\")[:];"
534+
"include_trace = mcmc.trace(\"to_include\")[:]"
535535
],
536536
"language": "python",
537537
"metadata": {},
@@ -543,7 +543,7 @@
543543
"collapsed": false,
544544
"input": [
545545
"figsize(23, 8)\n",
546-
"imshow(include_trace[-10000:, :], aspect=\"auto\", interpolation=\"none\");"
546+
"imshow(include_trace[-10000:, :], aspect=\"auto\", interpolation=\"none\")"
547547
],
548548
"language": "python",
549549
"metadata": {},

Chapter7_BayesianMachineLearning/MachineLearning.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"def css_styling():\n",
7373
" styles = open(\"../styles/custom.css\", \"r\").read()\n",
7474
" return HTML(styles)\n",
75-
"css_styling();"
75+
"css_styling()"
7676
],
7777
"language": "python",
7878
"metadata": {},

0 commit comments

Comments
 (0)