mirror of https://github.com/jlizier/jidt
Updates to python code for Scissors-Paper-Rock activity in course
This commit is contained in:
parent
832a4ddd2d
commit
48abba230c
|
|
@ -7,7 +7,7 @@
|
|||
"source": [
|
||||
"# Scissors Paper Rock data analysis (modules 3 and 4)\n",
|
||||
"\n",
|
||||
"_Author_: Julio Correa, Joseph Lizier, 2020-; based on the original Matlab tutorials.\n",
|
||||
"_Copyright © 2020-, Julio Correa, Joseph T. Lizier; based on the original Matlab tutorials. Distributed under GNU General Public License v3_\n",
|
||||
"\n",
|
||||
"We will analyse the uncertainties and information contents of some sample Scissors-Paper-Rock gameplay.\n",
|
||||
"\n",
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
"source": [
|
||||
"For now though, let's get things working and start to explore the data set.\n",
|
||||
"\n",
|
||||
"1. Please download a copy of the *data set* (following instructions on canvas). Unzip them to any convenient location on your computer. You can also download the solution code, though I trust you not to go straight to it until you've had an attempt at the task first!\n",
|
||||
"1. Please download a copy of the *data set* (following instructions on the Module 3 page). Unzip them to any convenient location on your computer.\n",
|
||||
"2. Open the folder where the gameplay data set is stored. Open any file in a text editor, which includes the data for a game between two named players. The file contains each iteration of the game on one line, with $\\{0,1,2\\}$ encoding the player's selections amongst _{scissors,paper,rock}_.\n",
|
||||
"3. Set the appropriate paths in the code below for the following:<br/>\n",
|
||||
" For the `simpleinfotheory` scripts, make sure you haved gathered the new functions you wrote into your `simpleinfotheory.py` script, and make sure it is referencable from here (you may need to change the folder referenced below) before you run the import line in the next cell:"
|
||||
|
|
@ -59,13 +59,13 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Set path for where your Scissors-Paper-Rock data files are stored:\n",
|
||||
"sprutils.setDataPath(\"YOUR_PATH_GOES_HERE\")\n",
|
||||
"# CHANGE THIS to where your Scissors-Paper-Rock data files are stored:\n",
|
||||
"sprutils.setDataPath(\"../ScissorsPaperRock-SampleData\")\n",
|
||||
"\n",
|
||||
"# Set the path for where your Matlab entropy scripts are from the previous modules\n",
|
||||
"# CHANGE THIS path to where your Matlab entropy scripts are from the previous modules\n",
|
||||
"# (if you are confident that they are working, or else the completed code solutions).\n",
|
||||
"import sys\n",
|
||||
"sys.path.append('YOUR_PATH_GOES_HERE')\n",
|
||||
"sys.path.append('../../Module01-Entropy/PythonSimpleFunctions/completed/')\n",
|
||||
"import simpleinfotheory"
|
||||
]
|
||||
},
|
||||
|
|
@ -201,8 +201,7 @@
|
|||
"id": "327ad1b5-d51c-4373-a775-967ac36cde17",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"2. Call the script for a few different players, e.g. `computeEntropyForPlayer('Joe')`, and compare.\n",
|
||||
"3. Now call it using all players' data at once, in a single calculation: `computeEntropyForPlayer('*')`. What implicit assumption(s) are we making when we analyse the data in this way? What question is it asking of the data?"
|
||||
"2. Call the script for a few different players, e.g. `computeEntropyForPlayer('Joe')`, and compare."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -213,6 +212,22 @@
|
|||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "9081c988-b1b3-4164-8f4b-80fb2bc5a409",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"3. Now call it using all players' data at once, in a single calculation: `computeEntropyForPlayer('*')`. What implicit assumption(s) are we making when we analyse the data in this way? What question is it asking of the data?"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "f2e1e64d-64e8-484c-b704-e9f750f362a9",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d4ad5c13-ba52-4fe9-83ff-1eded1c2f081",
|
||||
|
|
@ -298,7 +313,7 @@
|
|||
"id": "5b5ba6f7-48aa-4479-91f5-71c9d75402ce",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"5. Call the script to see the entropies of each player, the plots and correlation analyses on how this related to performance. Whose moves was there most uncertainty about? Did this correlate to wins? What about losses? Does this match your hypothesis?"
|
||||
"5. Call the function to see the entropies of each player, the plots and correlation analyses on how this related to performance. Whose moves was there most uncertainty about? Did this correlate to wins? What about losses? Does this match your hypothesis?"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -314,7 +329,7 @@
|
|||
"id": "14fc5575-32be-494c-88a3-2ea2a241fdf8",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"7. _Challenge_: are these correlation values statistically significant? Look up theory on how to compute whether a correlation value is statistically significant. To add this to the code above, you can check out the other return values from the `stats.pearson()` or `stats.spearmanr()` correlation functions.\n",
|
||||
"6. _Challenge_: are these correlation values statistically significant? Look up theory on how to compute whether a correlation value is statistically significant. To add this to the code above, you can check out the other return values from the `stats.pearson()` or `stats.spearmanr()` correlation functions.\n",
|
||||
"\n",
|
||||
"We will continue to investigate relationships between variables in this data set once we have learned about the mutual information."
|
||||
]
|
||||
|
|
@ -414,8 +429,7 @@
|
|||
"id": "ebd57e5f-11f8-47e7-97df-b8b698570f36",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"2. Call the script for a few different players, e.g. `computeConditionalEntropyForPlayer('Joe')`, and compare.\n",
|
||||
"3. Now call it to compute the conditional entropy using samples for all players' data in the one calculation: `computeConditionalEntropyForPlayer('*')`. What implicit assumption are we making when we analyse the data in this way?"
|
||||
"2. Call the script for a few different players, e.g. `computeConditionalEntropyForPlayer('Joe')`, and compare."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -426,6 +440,22 @@
|
|||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "f147a17f-f803-43f8-9823-d8fb68511586",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"3. Now call it to compute the conditional entropy using samples for all players' data in the one calculation: `computeConditionalEntropyForPlayer('*')`. What implicit assumption are we making when we analyse the data in this way?"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "6b131665-f837-4d3f-97be-9a513ebbf09b",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "0d1a270a-1258-498b-ab13-e93e8ecba317",
|
||||
|
|
@ -513,7 +543,7 @@
|
|||
"id": "db7d11fd-a292-4b38-8509-d3b274f0b52e",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"5. Call the script to see the conditional entropies of each player, the plots and correlation analyses on how this related to performance. Whose was most (conditionally) uncertainty? Did this correlate to wins? What about losses? Does this match your hypothesis?"
|
||||
"5. Call the function to see the conditional entropies of each player, the plots and correlation analyses on how this related to performance. Whose was most (conditionally) uncertainty? Did this correlate to wins? What about losses? Does this match your hypothesis?"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -632,8 +662,7 @@
|
|||
"id": "46adc1ee-3d73-4622-b131-4b547b918892",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"2. Call the script for a few different players, e.g. `computeMutualInformationForPlayer('Joe', True)`, and compare.\n",
|
||||
"3. Now call it to compute the mutual information using samples for all players' data in the one calculation: `computeMutualInformationForPlayer('*', True)`. What implicit assumption are we making when we analyse the data in this way?"
|
||||
"2. Call the script for a few different players, e.g. `computeMutualInformationForPlayer('Joe', True)`, and compare."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -644,6 +673,22 @@
|
|||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "c47c9ddc-7f9c-4cd9-9d13-1712817a728a",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"3. Now call it to compute the mutual information using samples for all players' data in the one calculation: `computeMutualInformationForPlayer('*', True)`. What implicit assumption are we making when we analyse the data in this way?"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "ebcdfcf7-13c5-4702-8a5d-927c7ee8755a",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "5f9a5afc-5da3-4cad-9449-934cac0e6792",
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
"source": [
|
||||
"# Scissors Paper Rock data analysis (modules 3 and 4)\n",
|
||||
"\n",
|
||||
"_Author_: Julio Correa, Joseph Lizier, 2020-; based on the original Matlab tutorials.\n",
|
||||
"_Copyright © 2020-, Julio Correa, Joseph T. Lizier; based on the original Matlab tutorials. Distributed under GNU General Public License v3_\n",
|
||||
"\n",
|
||||
"We will analyse the uncertainties and information contents of some sample Scissors-Paper-Rock gameplay.\n",
|
||||
"\n",
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
"source": [
|
||||
"For now though, let's get things working and start to explore the data set.\n",
|
||||
"\n",
|
||||
"1. Please download a copy of the *data set* (following instructions on canvas). Unzip them to any convenient location on your computer. You can also download the solution code, though I trust you not to go straight to it until you've had an attempt at the task first!\n",
|
||||
"1. Please download a copy of the relevant *data set* (following instructions on the Module 3 page). Unzip them to any convenient location on your computer.\n",
|
||||
"2. Open the folder where the gameplay data set is stored. Open any file in a text editor, which includes the data for a game between two named players. The file contains each iteration of the game on one line, with $\\{0,1,2\\}$ encoding the player's selections amongst _{scissors,paper,rock}_.\n",
|
||||
"3. Set the appropriate paths in the code below for the following:<br/>\n",
|
||||
" For the `simpleinfotheory` scripts, make sure you haved gathered the new functions you wrote into your `simpleinfotheory.py` script, and make sure it is referencable from here (you may need to change the folder referenced below) before you run the import line in the next cell:"
|
||||
|
|
@ -60,12 +60,12 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"# Set path for where your Scissors-Paper-Rock data files are stored:\n",
|
||||
"sprutils.setDataPath(\"../../../Data/ScissorsPaperRock-AllYears/CSYS5030-ScissorsPaperRockData-Sample\")\n",
|
||||
"sprutils.setDataPath(\"../ScissorsPaperRock-SampleData\")\n",
|
||||
"\n",
|
||||
"# Set the path for where your Matlab entropy scripts are from the previous modules\n",
|
||||
"# (if you are confident that they are working, or else the completed code solutions).\n",
|
||||
"import sys\n",
|
||||
"sys.path.append('../../Module1-Entropy/PythonCode/completed/')\n",
|
||||
"sys.path.append('../../Module01-Entropy/PythonSimpleFunctions/completed/')\n",
|
||||
"import simpleinfotheory"
|
||||
]
|
||||
},
|
||||
|
|
@ -566,8 +566,7 @@
|
|||
"id": "327ad1b5-d51c-4373-a775-967ac36cde17",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"2. Call the script for a few different players, e.g. `computeEntropyForPlayer('Joe')`, and compare.\n",
|
||||
"3. Now call it using all players' data at once, in a single calculation: `computeEntropyForPlayer('*')`. What implicit assumption(s) are we making when we analyse the data in this way? What question is it asking of the data?"
|
||||
"2. Call the script for a few different players, e.g. `computeEntropyForPlayer('Joe')`, and compare."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -579,7 +578,7 @@
|
|||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(1.5733842558479327, 0.36666666666666664, 0.36666666666666664, 300)"
|
||||
"(1.5729262036887497, 0.4, 0.425, 40)"
|
||||
]
|
||||
},
|
||||
"execution_count": 7,
|
||||
|
|
@ -588,7 +587,35 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"computeEntropyForPlayer(players[0])\n",
|
||||
"computeEntropyForPlayer(players[0])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a132fa56-42a1-4470-8967-599508700e92",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"3. Now call it using all players' data at once, in a single calculation: `computeEntropyForPlayer('*')`. What implicit assumption(s) are we making when we analyse the data in this way? What question is it asking of the data?"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"id": "66720ba1-f13c-4d53-800a-b272a9d9489d",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(1.5733842558479327, 0.36666666666666664, 0.36666666666666664, 300)"
|
||||
]
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"computeEntropyForPlayer('*')"
|
||||
]
|
||||
},
|
||||
|
|
@ -604,7 +631,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": 9,
|
||||
"id": "e84ac281-ec3a-4de7-8f40-8151e65d35d1",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
|
|
@ -676,12 +703,12 @@
|
|||
"id": "5b5ba6f7-48aa-4479-91f5-71c9d75402ce",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"5. Call the script to see the entropies of each player, the plots and correlation analyses on how this related to performance. Whose moves was there most uncertainty about? Did this correlate to wins? What about losses? Does this match your hypothesis?"
|
||||
"5. Call the function to see the entropies of each player, the plots and correlation analyses on how this related to performance. Whose moves was there most uncertainty about? Did this correlate to wins? What about losses? Does this match your hypothesis?"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 10,
|
||||
"id": "c8387951-f475-48ca-ba13-d873bc009368",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
|
|
@ -710,7 +737,7 @@
|
|||
" array([0.425, 0.425, 0.35 , 0.275, 0.425, 0.28 , 0.4 ]))"
|
||||
]
|
||||
},
|
||||
"execution_count": 9,
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
|
|
@ -744,7 +771,7 @@
|
|||
"id": "14fc5575-32be-494c-88a3-2ea2a241fdf8",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"7. _Challenge_: are these correlation values statistically significant? Look up theory on how to compute whether a correlation value is statistically significant. To add this to the code above, you can check out the other return values from the `stats.pearson()` or `stats.spearmanr()` correlation functions.\n",
|
||||
"6. _Challenge_: are these correlation values statistically significant? Look up theory on how to compute whether a correlation value is statistically significant. To add this to the code above, you can check out the other return values from the `stats.pearson()` or `stats.spearmanr()` correlation functions.\n",
|
||||
"\n",
|
||||
"We will continue to investigate relationships between variables in this data set once we have learned about the mutual information."
|
||||
]
|
||||
|
|
@ -772,7 +799,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 11,
|
||||
"id": "12ecef23-76f6-4416-9dfa-9674e45ec5b7",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
|
|
@ -844,13 +871,12 @@
|
|||
"id": "ebd57e5f-11f8-47e7-97df-b8b698570f36",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"2. Call the script for a few different players, e.g. `computeConditionalEntropyForPlayer('Joe')`, and compare.\n",
|
||||
"3. Now call it to compute the conditional entropy using samples for all players' data in the one calculation: `computeConditionalEntropyForPlayer('*')`. What implicit assumption are we making when we analyse the data in this way?"
|
||||
"2. Call the script for a few different players, e.g. `computeConditionalEntropyForPlayer('Joe')`, and compare."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 12,
|
||||
"id": "0175f515-e9e4-4a23-9720-819164641a91",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
|
|
@ -858,7 +884,42 @@
|
|||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Conditional entropy for Player1 over 38 iterations: 1.5188\n",
|
||||
"Conditional entropy for Player1 over 38 iterations: 1.5188\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(1.518784923363066, 0.42105263157894735, 0.39473684210526316, 38)"
|
||||
]
|
||||
},
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"computeConditionalEntropyForPlayer(players[0], True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "afd8bfc2-7df1-4e35-8514-50f3139f6dd5",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"3. Now call it to compute the conditional entropy using samples for all players' data in the one calculation: `computeConditionalEntropyForPlayer('*')`. What implicit assumption are we making when we analyse the data in this way?"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"id": "f2c31640-a9d6-4064-87bd-bd0a7f73eed6",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Conditional entropy for * over 290 iterations: 1.5602\n"
|
||||
]
|
||||
},
|
||||
|
|
@ -868,13 +929,12 @@
|
|||
"(1.5601520681645509, 0.36551724137931035, 0.36551724137931035, 290)"
|
||||
]
|
||||
},
|
||||
"execution_count": 11,
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"computeConditionalEntropyForPlayer(players[0], True)\n",
|
||||
"computeConditionalEntropyForPlayer('*', True)"
|
||||
]
|
||||
},
|
||||
|
|
@ -891,7 +951,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": 14,
|
||||
"id": "30c27c2a-a8b2-4808-ae9e-42a2c6e5a621",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
|
|
@ -969,7 +1029,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"execution_count": 15,
|
||||
"id": "2ee18289-7e48-4a4d-a1b1-d80838b7d0a3",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
|
|
@ -1000,7 +1060,7 @@
|
|||
" 0.26530612, 0.40816327]))"
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
|
|
@ -1055,7 +1115,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": 16,
|
||||
"id": "32b3f184-a71e-42ea-b248-c13102c553a5",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
|
|
@ -1137,13 +1197,12 @@
|
|||
"id": "46adc1ee-3d73-4622-b131-4b547b918892",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"2. Call the script for a few different players, e.g. `computeMutualInformationForPlayer('Joe', True)`, and compare.\n",
|
||||
"3. Now call it to compute the mutual information using samples for all players' data in the one calculation: `computeMutualInformationForPlayer('*', True)`. What implicit assumption are we making when we analyse the data in this way?"
|
||||
"2. Call the script for a few different players, e.g. `computeMutualInformationForPlayer('Joe', True)`, and compare."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"execution_count": 17,
|
||||
"id": "da0e86fa-73b0-41d1-b4d1-eda9bb3019de",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
|
|
@ -1152,7 +1211,43 @@
|
|||
"output_type": "stream",
|
||||
"text": [
|
||||
"MI for Player1 over 38 iterations: 0.0591 bits\n",
|
||||
"MI for Player1 over 38 iterations: 0.1230 bits\n",
|
||||
"MI for Player1 over 38 iterations: 0.1230 bits\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(0.12304366201220818, 0.42105263157894735, 0.39473684210526316, 38)"
|
||||
]
|
||||
},
|
||||
"execution_count": 17,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"computeMutualInformationForPlayer(players[0], True, True)\n",
|
||||
"computeMutualInformationForPlayer(players[0], False, True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "630f3494-285f-4c5c-8e0b-d1c72f1de15b",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"3. Now call it to compute the mutual information using samples for all players' data in the one calculation: `computeMutualInformationForPlayer('*', True)`. What implicit assumption are we making when we analyse the data in this way?"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"id": "314eb265-0e4b-425f-ba97-e53f67de259b",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"MI for * over 290 iterations: 0.0161 bits\n",
|
||||
"MI for * over 290 iterations: 0.0197 bits\n"
|
||||
]
|
||||
|
|
@ -1163,14 +1258,12 @@
|
|||
"(0.01965213650181097, 0.36551724137931035, 0.36551724137931035, 290)"
|
||||
]
|
||||
},
|
||||
"execution_count": 15,
|
||||
"execution_count": 18,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"computeMutualInformationForPlayer(players[0], True, True)\n",
|
||||
"computeMutualInformationForPlayer(players[0], False, True)\n",
|
||||
"computeMutualInformationForPlayer('*', True, True)\n",
|
||||
"computeMutualInformationForPlayer('*', False, True)"
|
||||
]
|
||||
|
|
@ -1188,7 +1281,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"execution_count": 19,
|
||||
"id": "cc376fbd-6c8e-431e-ba33-a7cb03003072",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
|
|
@ -1265,12 +1358,12 @@
|
|||
"id": "2ca15ace-a27e-4c09-b0f7-6467659cb9bd",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"5. Call the script to see the mutual information of each player, the plots and correlation analyses on how this related to performance. Do this for MI from the players' own previous move (pass argument `fromSelf=True`) and from their opponent (pass argument `fromSelf=False`). Who reflected the most information in their moves? Did this correlate to wins? What about losses? Does this match your hypothesis?"
|
||||
"5. Call the function to see the mutual information of each player, the plots and correlation analyses on how this related to performance. Do this for MI from the players' own previous move (pass argument `fromSelf=True`) and from their opponent (pass argument `fromSelf=False`). Who reflected the most information in their moves? Did this correlate to wins? What about losses? Does this match your hypothesis?"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"execution_count": 20,
|
||||
"id": "7a2b2b7f-4b2c-4ca0-8c47-9466e3456bc6",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
|
|
@ -1310,7 +1403,7 @@
|
|||
" 0.26530612, 0.40816327]))"
|
||||
]
|
||||
},
|
||||
"execution_count": 17,
|
||||
"execution_count": 20,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue