Add files via upload
This commit is contained in:
parent
c6cc03ddf9
commit
ad9fa3e3fa
@ -2249,7 +2249,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"A table and a plot will give a feel for the `util` function. Notice the characteristics concave-down shape of the plot."
|
"A table and a plot will give a feel for the `util` function. Notice the characterisitc concave-down shape of the plot."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -3094,7 +3094,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.5.3"
|
"version": "3.7.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
@ -485,7 +485,7 @@
|
|||||||
"- $A$, $B$: the cutoff values they choose: the lower bound of the range of first numbers they will accept.\n",
|
"- $A$, $B$: the cutoff values they choose: the lower bound of the range of first numbers they will accept.\n",
|
||||||
"- $a$, $b$: the actual random numbers that appear on the screen.\n",
|
"- $a$, $b$: the actual random numbers that appear on the screen.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"For example, if player** A** chooses a cutoff of $A$ = 0.6, that means that** A** would accept any first number greater than 0.6, and reject any number below that cutoff. The question is: What cutoff, $A$, should player** A** choose to maximize the chance of winning, that is, maximize P($a$ > $b$)?\n",
|
"For example, if player **A** chooses a cutoff of $A$ = 0.6, that means that **A** would accept any first number greater than 0.6, and reject any number below that cutoff. The question is: What cutoff, $A$, should player **A** choose to maximize the chance of winning, that is, maximize P($a$ > $b$)?\n",
|
||||||
"\n",
|
"\n",
|
||||||
"First, simulate the number that a player with a given cutoff gets (note that `random.random()` returns a float sampled uniformly from the interval [0..1]):"
|
"First, simulate the number that a player with a given cutoff gets (note that `random.random()` returns a float sampled uniformly from the interval [0..1]):"
|
||||||
]
|
]
|
||||||
@ -630,11 +630,11 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"## The Hot New Game Show Problem: Exact Calculation\n",
|
"## The Hot New Game Show Problem: Exact Calculation\n",
|
||||||
"\n",
|
"\n",
|
||||||
"More promising is the possibility of making `Pwin(A, B)` an exact calculation. But before we get to `Pwin(A, B)`, let's solve a simpler problem: assume that both players** A** and** B** have chosen a cutoff, and have each received a number above the cutoff. What is the probability that** A** gets the higher number? We'll call this `Phigher(A, B)`. We can think of this as a two-dimensional sample space of points in the ($a$, $b$) plane, where$a$ ranges from the cutoff $A$ to 1 and $b$ ranges from the cutoff B to 1. Here is a diagram of that two-dimensional sample space, with the cutoffs $A$=0.5 and $B$=0.6:\n",
|
"More promising is the possibility of making `Pwin(A, B)` an exact calculation. But before we get to `Pwin(A, B)`, let's solve a simpler problem: assume that both players **A** and **B** have chosen a cutoff, and have each received a number above the cutoff. What is the probability that **A** gets the higher number? We'll call this `Phigher(A, B)`. We can think of this as a two-dimensional sample space of points in the ($a$, $b$) plane, where$a$ ranges from the cutoff $A$ to 1 and $b$ ranges from the cutoff B to 1. Here is a diagram of that two-dimensional sample space, with the cutoffs $A$=0.5 and $B$=0.6:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"<img src=\"http://norvig.com/ipython/probability2da.jpg\" width=413>\n",
|
"<img src=\"http://norvig.com/ipython/probability2da.jpg\" width=413>\n",
|
||||||
"\n",
|
"\n",
|
||||||
"The total area of the sample space is 0.5 × 0.4 = 0.20, and in general it is (1 - $A$) · (1 - $B$). What about the favorable cases, where** A** beats** B**? That corresponds to the shaded triangle below:\n",
|
"The total area of the sample space is 0.5 × 0.4 = 0.20, and in general it is (1 - $A$) · (1 - $B$). What about the favorable cases, where **A** beats **B**? That corresponds to the shaded triangle below:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"<img src=\"http://norvig.com/ipython/probability2d.jpg\" width=413>\n",
|
"<img src=\"http://norvig.com/ipython/probability2d.jpg\" width=413>\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -694,16 +694,16 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"We're now ready to tackle the full game. There are four cases to consider, depending on whether** A** and** B** gets a first number that is above or below their cutoff choices:\n",
|
"We're now ready to tackle the full game. There are four cases to consider, depending on whether **A** and **B** gets a first number that is above or below their cutoff choices:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"| first $a$ | first $b$ | P($a$, $b$) | P(A wins | $a$, $b$) | Comment |\n",
|
"| first $a$ | first $b$ | P($a$, $b$) | P(A wins│ $a$, $b$) | Comment |\n",
|
||||||
"|:-----:|:-----:| ----------- | ------------- | ------------ |\n",
|
"|:-----:|:-----:| ----------- | ------------- | ------------ |\n",
|
||||||
"|$a$ > $A$ | $b$ > $B$ | (1 - $A$) · (1 - $B$) | Phigher(*A*, $B$) | Both above cutoff; both keep first numbers |\n",
|
"|$a$ > $A$ | $b$ > $B$ | (1 - $A$) · (1 - $B$) | Phigher(*A*, $B$) | Both above cutoff; both keep first numbers |\n",
|
||||||
"|$a$ < $A$ | $b$ < $B$ | $A$ · $B$ | Phigher(0, 0) | Both below cutoff, both get new numbers from [0..1] |\n",
|
"|$a$ < $A$ | $b$ < $B$ | $A$ · $B$ | Phigher(0, 0) | Both below cutoff, both get new numbers from [0..1] |\n",
|
||||||
"|$a$ > $A$ | $b$ < $B$ | (1 - $A$) · $B$ | Phigher(*A*, 0) |** A** keeps number;** B** gets new number from [0..1] |\n",
|
"|$a$ > $A$ | $b$ < $B$ | (1 - $A$) · $B$ | Phigher($A$, 0) | **A** keeps number; **B** gets new number from [0..1] |\n",
|
||||||
"|$a$ < $A$ | $b$ > $B$ | $A$ · (1 - $B$) | Phigher(0, $B$) |** A** gets new number from [0..1];** B** keeps number |\n",
|
"|$a$ < $A$ | $b$ > $B$ | $A$ · (1 - $B$) | Phigher(0, $B$) | **A** gets new number from [0..1]; **B** keeps number |\n",
|
||||||
"\n",
|
"\n",
|
||||||
"For example, the first row of this table says that the event of both first numbers being above their respective cutoffs has probability (1 - $A$) · (1 - $B$), and if this does occur, then the probability of** A** winning is Phigher(*A*, $B$).\n",
|
"For example, the first row of this table says that the event of both first numbers being above their respective cutoffs has probability (1 - $A$) · (1 - $B$), and if this does occur, then the probability of **A** winning is Phigher(*A*, $B$).\n",
|
||||||
"We're ready to replace the old simulation-based `Pwin` with a new calculation-based version:"
|
"We're ready to replace the old simulation-based `Pwin` with a new calculation-based version:"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -936,7 +936,7 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"What does this [Pringle of Probability](http://fivethirtyeight.com/features/should-you-shoot-free-throws-underhand/) show us? The highest win percentage for** A**, the peak of the surface, occurs when $A$ is around 0.5 and $B$ is 0 or 1. We can confirm that, finding the maximum `Pwin(A, B)` for many different cutoff values of `A` and `B`:"
|
"What does this [Pringle of Probability](http://fivethirtyeight.com/features/should-you-shoot-free-throws-underhand/) show us? The highest win percentage for **A**, the peak of the surface, occurs when $A$ is around 0.5 and $B$ is 0 or 1. We can confirm that, finding the maximum `Pwin(A, B)` for many different cutoff values of `A` and `B`:"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1004,7 +1004,7 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"And what if we run it the other way around, where** B** chooses a cutoff first, and then** A** responds?"
|
"And what if we run it the other way around, where **B** chooses a cutoff first, and then **A** responds?"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1033,7 +1033,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"In both cases, the rational choice for both players is a cutoff of 0.618034, which corresponds to the \"saddle point\" in the middle of the plot. This is a *stable equilibrium*; consider fixing $B$ = 0.618034, \n",
|
"In both cases, the rational choice for both players is a cutoff of 0.618034, which corresponds to the \"saddle point\" in the middle of the plot. This is a *stable equilibrium*; consider fixing $B$ = 0.618034, \n",
|
||||||
"and notice that if $A$ changes to any other value, we slip off the saddle to the right or left, resulting in a worse win probability for** A**. Similarly, if we fix $A$ = 0.618034, then if $B$ changes to another value, we ride up the saddle to a higher win percentage for** A**, which is worse for** B**. So neither player will want to move from the saddle point.\n",
|
"and notice that if $A$ changes to any other value, we slip off the saddle to the right or left, resulting in a worse win probability for **A**. Similarly, if we fix $A$ = 0.618034, then if $B$ changes to another value, we ride up the saddle to a higher win percentage for **A**, which is worse for **B**. So neither player will want to move from the saddle point.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"The moral for continuous spaces is the same as for discrete spaces: be careful about defining your sample space; measure carefully, and let your code take care of the rest."
|
"The moral for continuous spaces is the same as for discrete spaces: be careful about defining your sample space; measure carefully, and let your code take care of the rest."
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user