Skip to content

Commit 8a8ba09

Browse files
author
Scott Hendrickson
committed
Added a couple of changes from the discussion
1 parent 8ee1a94 commit 8a8ba09

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

bandit-algorithms-101/bandit-algorithms-101.ipynb

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
"outputs": [],
182182
"source": [
183183
"# 1 arm\n",
184-
"payoff = [0,1]\n",
184+
"payoff = [-0.1,0.5]\n",
185185
"a = np.bincount(binomial(1,0.5,100))\n",
186186
"print np.dot(a, payoff)"
187187
]
@@ -342,21 +342,13 @@
342342
"means = [0.1, 0.1, 0.9]\n",
343343
"reward = np.zeros(trials)\n",
344344
"for m in means:\n",
345+
" # equal rewards of 1 or 0\n",
345346
" reward += binomial(1,m,trials)\n",
346347
"df = pd.DataFrame({\"reward\":reward, \"fair_reward\":binomial(3,0.5,trials)})\n",
347348
"df.hist()\n",
348349
"plt.show()"
349350
]
350351
},
351-
{
352-
"cell_type": "markdown",
353-
"metadata": {},
354-
"source": [
355-
"### Wait what?\n",
356-
"\n",
357-
"* 4 vs. 3?"
358-
]
359-
},
360352
{
361353
"cell_type": "markdown",
362354
"metadata": {},
@@ -546,6 +538,17 @@
546538
"ggplot(aes(x=\"T\",y=\"Reward\", color=\"Sim\"), data=a) + geom_line()"
547539
]
548540
},
541+
{
542+
"cell_type": "code",
543+
"execution_count": null,
544+
"metadata": {
545+
"collapsed": false
546+
},
547+
"outputs": [],
548+
"source": [
549+
"ggplot(aes(x=\"T\",y=\"CumulativeReward\", color=\"Sim\"), data=a) + geom_line()"
550+
]
551+
},
549552
{
550553
"cell_type": "markdown",
551554
"metadata": {},
@@ -621,15 +624,6 @@
621624
"source": [
622625
"The end"
623626
]
624-
},
625-
{
626-
"cell_type": "code",
627-
"execution_count": null,
628-
"metadata": {
629-
"collapsed": true
630-
},
631-
"outputs": [],
632-
"source": []
633627
}
634628
],
635629
"metadata": {

0 commit comments

Comments
 (0)