Skip to content

Commit 9b6d3ac

Browse files
committed
Not adding or removing semicolons
1 parent 837a382 commit 9b6d3ac

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

Chapter6_Priorities/Priors.ipynb

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@
457457
"\n",
458458
" self.bb_score = np.r_[self.bb_score, bb_score]\n",
459459
" self.choices = np.r_[self.choices, choices]\n",
460-
" return;"
460+
" return"
461461
],
462462
"language": "python",
463463
"metadata": {},
@@ -498,7 +498,7 @@
498498
" plt.title(\"Posteriors After %d pull\" % bayesian_strategy.N +\n",
499499
" \"s\" * (bayesian_strategy.N > 1))\n",
500500
" plt.autoscale(tight=True)\n",
501-
" return;"
501+
" return"
502502
],
503503
"language": "python",
504504
"metadata": {},
@@ -521,7 +521,7 @@
521521
" plot_priors(bayesian_strat, hidden_prob)\n",
522522
" # plt.legend()\n",
523523
" plt.autoscale(tight=True)\n",
524-
"plt.tight_layout();"
524+
"plt.tight_layout()"
525525
],
526526
"language": "python",
527527
"metadata": {},
@@ -555,7 +555,7 @@
555555
"from IPython.core.display import HTML\n",
556556
"\n",
557557
"# try executing the below command twice if the first time doesn't work\n",
558-
"HTML(filename=\"BanditsD3.html\");"
558+
"HTML(filename=\"BanditsD3.html\")"
559559
],
560560
"language": "python",
561561
"metadata": {},
@@ -719,7 +719,7 @@
719719
" random_choice]\n",
720720
"algos = []\n",
721721
"for strat in strategies:\n",
722-
" algos.append(GeneralBanditStrat(bandits, strat));"
722+
" algos.append(GeneralBanditStrat(bandits, strat))"
723723
],
724724
"language": "python",
725725
"metadata": {},
@@ -741,7 +741,7 @@
741741
"\n",
742742
"plt.title(\"Total Regret of Bayesian Bandits Strategy vs. Random guessing\")\n",
743743
"plt.xlabel(\"Number of pulls\")\n",
744-
"plt.ylabel(\"Regret after $n$ pulls\")\n",
744+
"plt.ylabel(\"Regret after $n$ pulls\");\n",
745745
"plt.legend(loc=\"upper left\");"
746746
],
747747
"language": "python",
@@ -795,7 +795,7 @@
795795
"\n",
796796
"plt.title(\"Expected Total Regret of Multi-armed Bandit strategies\")\n",
797797
"plt.xlabel(\"Number of pulls\")\n",
798-
"plt.ylabel(\"Exepected Total Regret \\n after $n$ pulls\")\n",
798+
"plt.ylabel(\"Exepected Total Regret \\n after $n$ pulls\");\n",
799799
"plt.legend(loc=\"upper left\");"
800800
],
801801
"language": "python",
@@ -850,8 +850,8 @@
850850
"plt.legend([pl1, pl2, pl3],\n",
851851
" [\"Upper Credible Bound\", \"Bayesian Bandit\", \"UCB-Bayes\"],\n",
852852
" loc=\"upper left\")\n",
853-
"plt.ylabel(\"Exepected Total Regret \\n after $\\log{n}$ pulls\")\n",
854-
"plt.title(\"log-scale of above\")\n",
853+
"plt.ylabel(\"Exepected Total Regret \\n after $\\log{n}$ pulls\");\n",
854+
"plt.title(\"log-scale of above\");\n",
855855
"plt.ylabel(\"Exepected Total Regret \\n after $\\log{n}$ pulls\");"
856856
],
857857
"language": "python",
@@ -926,7 +926,7 @@
926926
" bayesian_strat.sample_bandits(i)\n",
927927
" plot_priors(bayesian_strat, hidden_prob, lw=2, alpha=0.0, plt_vlines=False)\n",
928928
" # plt.legend()\n",
929-
" plt.xlim(0, 0.5);"
929+
" plt.xlim(0, 0.5)"
930930
],
931931
"language": "python",
932932
"metadata": {},
@@ -1044,7 +1044,7 @@
10441044
" plt.title(name + \" prior\")\n",
10451045
" plt.vlines(0, 0, y.max(), \"k\", \"--\", linewidth=0.5)\n",
10461046
" plt.xlim(-0.15, 0.15)\n",
1047-
"plt.tight_layout();"
1047+
"plt.tight_layout()"
10481048
],
10491049
"language": "python",
10501050
"metadata": {},
@@ -1081,7 +1081,7 @@
10811081
"prior_std = np.array([x[1] for x in expert_prior_params.values()])\n",
10821082
"\n",
10831083
"inv_cov_matrix = pm.Wishart(\"inv_cov_matrix\", n_observations, np.diag(prior_std ** 2))\n",
1084-
"mu = pm.Normal(\"returns\", prior_mu, 1, size=4);"
1084+
"mu = pm.Normal(\"returns\", prior_mu, 1, size=4)"
10851085
],
10861086
"language": "python",
10871087
"metadata": {},
@@ -1122,7 +1122,7 @@
11221122
" _previous_day = np.roll(stock_closes[stock], -1)\n",
11231123
" stock_returns[stock] = ((stock_closes[stock] - _previous_day) / _previous_day)[:n_observations]\n",
11241124
"\n",
1125-
"dates = map(lambda x: datetime.datetime.strptime(x, \"%Y-%m-%d\"), x[1:n_observations + 1, 0]);"
1125+
"dates = map(lambda x: datetime.datetime.strptime(x, \"%Y-%m-%d\"), x[1:n_observations + 1, 0])"
11261126
],
11271127
"language": "python",
11281128
"metadata": {},
@@ -1141,7 +1141,7 @@
11411141
"\n",
11421142
"plt.xticks(np.arange(100)[::-8],\n",
11431143
" map(lambda x: datetime.datetime.strftime(x, \"%Y-%m-%d\"), dates[::8]),\n",
1144-
" rotation=60)\n",
1144+
" rotation=60);\n",
11451145
"\n",
11461146
"plt.legend(loc=\"upper left\")\n",
11471147
"plt.title(\"Return space\")\n",
@@ -1210,7 +1210,7 @@
12101210
"model = pm.Model([obs, mu, inv_cov_matrix])\n",
12111211
"mcmc = pm.MCMC()\n",
12121212
"\n",
1213-
"mcmc.sample(150000, 100000, 3);"
1213+
"mcmc.sample(150000, 100000, 3)"
12141214
],
12151215
"language": "python",
12161216
"metadata": {},
@@ -1292,7 +1292,7 @@
12921292
" plt.xlim(-0.15, 0.15)\n",
12931293
"\n",
12941294
"plt.suptitle(\"Posterior distribution of daily stock returns\")\n",
1295-
"plt.tight_layout();"
1295+
"plt.tight_layout()"
12961296
],
12971297
"language": "python",
12981298
"metadata": {},
@@ -1346,7 +1346,7 @@
13461346
"plt.subplot(1, 2, 2)\n",
13471347
"plt.bar(np.arange(4), np.sqrt(np.diag(mean_covariance_matrix)),\n",
13481348
" color=\"#348ABD\", alpha=0.7)\n",
1349-
"plt.xticks(np.arange(4) + 0.5, stock_returns.keys())\n",
1349+
"plt.xticks(np.arange(4) + 0.5, stock_returns.keys());\n",
13501350
"plt.title(\"(mean posterior) variances of daily stock returns\")\n",
13511351
"\n",
13521352
"plt.tight_layout();"
@@ -1566,7 +1566,7 @@
15661566
" plt.fill_between(x, 0, y2, color=\"#A60628\", alpha=0.15)\n",
15671567
" plt.legend(title=\"N=%d\" % N)\n",
15681568
" plt.vlines(p, 0.0, 7.5, linestyles=\"--\", linewidth=1)\n",
1569-
" #plt.ylim( 0, 10)#;"
1569+
" #plt.ylim( 0, 10)#"
15701570
],
15711571
"language": "python",
15721572
"metadata": {},
@@ -1718,7 +1718,7 @@
17181718
"def css_styling():\n",
17191719
" styles = open(\"../styles/custom.css\", \"r\").read()\n",
17201720
" return HTML(styles)\n",
1721-
"css_styling();"
1721+
"css_styling()"
17221722
],
17231723
"language": "python",
17241724
"metadata": {},

0 commit comments

Comments
 (0)