366 lines
62 KiB
Plaintext
366 lines
62 KiB
Plaintext
|
{
|
|||
|
"cells": [
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"# MAT-204:00010 - Probability\n",
|
|||
|
"Author: Thanawin Pattanaphol - Date: 23th December 2024 - Description: Basic probability calculations"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"## Importing Libraries"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 1,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"ename": "ModuleNotFoundError",
|
|||
|
"evalue": "No module named 'pandas'",
|
|||
|
"output_type": "error",
|
|||
|
"traceback": [
|
|||
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
|||
|
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
|
|||
|
"Cell \u001b[0;32mIn[1], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mpandas\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mpd\u001b[39;00m \n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib_venn\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m venn3\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m pyplot \u001b[38;5;28;01mas\u001b[39;00m plt \n",
|
|||
|
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'pandas'"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"import pandas as pd \n",
|
|||
|
"from matplotlib_venn import venn3\n",
|
|||
|
"from matplotlib import pyplot as plt \n",
|
|||
|
"\n",
|
|||
|
"Dat = pd.read_csv('DataLoL.csv')\n",
|
|||
|
"\n",
|
|||
|
"num_games = len(Dat)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"## Questions"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"#### Probability: Blue Team wins"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Probability that Blue Team wins is: 0.4990383642069035\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"# Calculating the probability by diving the amount of games that blue won\n",
|
|||
|
"# dividing it by the amount of total games\n",
|
|||
|
"# Thus: p = Number of time an event occurs / Total nmumber of possible events\n",
|
|||
|
"prob_blue_wins = len(Dat[Dat['blueWins'] == 1]) / num_games\n",
|
|||
|
"print(\"Probability that Blue Team wins:\", prob_blue_wins)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"#### Probability: Blue Team wins and kills the dragon"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Probability that Blue Team wins and kills the dragon is: 0.23200728818706348\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"# Doing a similar calculation with the difference being\n",
|
|||
|
"# the number of time an event occurs now only counts\n",
|
|||
|
"# the number of times blue team wins and kills the dragon\n",
|
|||
|
"\n",
|
|||
|
"prob_blue_wins_dragons = len(Dat[(Dat['blueWins'] == 1) & (Dat['blueDragons'] == 1)]) / num_games\n",
|
|||
|
"print(\"Probability that Blue Team wins and kills the dragon:\", prob_blue_wins_dragons)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"#### Probability: Blue Team wins and kills the herald"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Probability that Blue Team wins and kills the herald is: 0.11185342646016803\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"# Similar calculation but with the number of events that\n",
|
|||
|
"# team blue wins and kills the herald\n",
|
|||
|
"\n",
|
|||
|
"prob_blue_wins_heralds = len(Dat[(Dat['blueWins'] == 1) & (Dat['blueHeralds'] == 1)]) / num_games\n",
|
|||
|
"print(\"Probability that Blue Team wins and kills the herald:\", prob_blue_wins_heralds)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"#### Count: All possible cases (Venn Diagram)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZQAAAGFCAYAAADaTwWeAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZ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5tXXVGLj6oMVR+oZ2H9Qso8ZUaXUpAkUMaitxeefFLOLcljsYCT7grFlIPtY9XncfOKM0bKIosgh0tBYWrFVE6oPUEWSuaYBMpotbfrYRLJn/5ocUDC66C72kZYteY6juEKud284o6RHMO2L2blUB3MqZnDrOpZ2FU5qSMXJFBGo7MTnnhCX2si8kraptBd56bXUTgXCmGXi1fcccts1zJSfqefE2pPYHL55GHcW4yFBMpIdXfD449LyyQPRUtcdJSnLD3gPloRl4tXPAnLr1U5kvpAPYsbF+N3+o0uJW9JoIxEMAiPPaaf9S3yRiG2Sg4l6nTyiidJTMnfUHHanCysX8i0imlGl5KXJFCGq69PDxNZ/Z5XCrlVcigxp5NXvEnyb/7XYA2BBhY3Lsbn9BldSl6RQBmOcFgPk2DQ6EpEhmgKdNd7CTqltflBcYeDV31pwhZatDkaLpuLxY2LmVg60ehS8oYEytFEIvqYiUwNzhsJr4P2ccqITkUsNAmHg1e9aUJKfocKwLSKaZzUcJLMBMsACZQjiUb12VydnUZXIjKkr9pDpz86ptMRC0Xc4WClL5XXA/X9StwlnD7xdCq8FUaXYmkSKIcTj+th0t5udCUiA9KqQud4NyFbYQ+8j1TI7WaVO99HVHQ2xcapE06luazZ6FIsSwLlUBIJ+PvfobXV6EpEBqQcKm0
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"# Declaring variable for each set\n",
|
|||
|
"# Loop through the whole games dataset and if the item-\n",
|
|||
|
"# -matches the condition, add it to the set for that\n",
|
|||
|
"# condition list\n",
|
|||
|
"\n",
|
|||
|
"game_blue_wins, game_blue_dragon, game_blue_herald = set()\n",
|
|||
|
"\n",
|
|||
|
"for game in range(num_games):\n",
|
|||
|
" if(Dat['blueWins'][game] == 1):\n",
|
|||
|
" game_blue_wins.add(game)\n",
|
|||
|
" if(Dat['blueDragons'][game] == 1):\n",
|
|||
|
" game_blue_dragon.add(game)\n",
|
|||
|
" if(Dat['blueHeralds'][game] == 1):\n",
|
|||
|
" game_blue_herald.add(game)\n",
|
|||
|
"\n",
|
|||
|
"venn3([game_blue_wins, game_blue_dragon, game_blue_herald], ('A', 'B', 'C'))\n",
|
|||
|
"\n",
|
|||
|
"plt.show()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"#### Probability: Each possible events (Venn Diagram)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZQAAAGFCAYAAADaTwWeAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABO20lEQVR4nO3dd3xb9b3/8dc52pIt7xHbCY6z7OxAQiChKZCUTRmFQktL4QKX9nfvhXuhUFpa7u2gpZdC14XSQhltQylQKFBKSgibBAgJYYTsvbyHbGtL5/eHYifGduIh6ZwjfZ6Phx9OZNn62Jb1Pt+taJqmIYQQQoySqncBQgghMoMEihBCiKSQQBFCCJEUEihCCCGSQgJFCCFEUkigCCGESAoJFCGEEEkhgSKEECIpJFCEEEIkhQSKEEKIpJBAEUIIkRQSKEIIIZJCAkUIIURSSKAIIYRICgkUIYQQSSGBIoQQIikkUIQQQiSFBIoQQoikkEARQgiRFBIoQgghkkICRQghRFJIoAghhEgKCRQhhBBJIYGio3vvvRdFUZg/f77epQghxKgpmqZpeheRrRYuXMj+/fvZuXMnW7ZsYeLEiXqXJIQQIyYtFJ3s2LGDlStXcvfdd1NSUsLSpUv1LkkIIU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CTpLnHR6g2N6nTEbBGxWVnpiWf0QH2PHHsOp44/lfKccr1LMTUJlMFEIvD889DYqHclIgk0BVrHueiyylTv4Qg4HLzpCmVBpICqqCwYu4CpJVP1LsW0JFAGEo0mFi3W1+tdiUiCuFWlaZyNoHRxjUi728U79uw
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"# Setting the variable for each section of the venn diagram\n",
|
|||
|
"# Use these values to calculate its probability by\n",
|
|||
|
"# diving with the total amount of games\n",
|
|||
|
"# Produce venn diagram of the values\n",
|
|||
|
"\n",
|
|||
|
"count_a = 2055\n",
|
|||
|
"count_b = 1096\n",
|
|||
|
"count_c = 564\n",
|
|||
|
"\n",
|
|||
|
"count_ab = 1770\n",
|
|||
|
"count_ac = 583\n",
|
|||
|
"count_bc = 188\n",
|
|||
|
"\n",
|
|||
|
"count_abc = 522\n",
|
|||
|
"\n",
|
|||
|
"p_a = round(2055 / num_games, 3)\n",
|
|||
|
"p_b = round(1096 / num_games, 3)\n",
|
|||
|
"p_c = round(564 / num_games, 3)\n",
|
|||
|
"\n",
|
|||
|
"p_ab = round(1770 / num_games, 3)\n",
|
|||
|
"p_ac = round(583 / num_games, 3)\n",
|
|||
|
"p_bc = round(188 / num_games, 3)\n",
|
|||
|
"\n",
|
|||
|
"p_abc = round(522 / num_games, 3)\n",
|
|||
|
"\n",
|
|||
|
"venn = venn3(subsets=(p_a, p_b, p_ab, p_c, p_ac, p_bc, p_abc), set_labels=('A', 'B', 'C'))"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"#### Probability: Blue Team does not manage to do any of the events (Outer White Section)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Probabilty that Blue Team loses, doesn't kill dragons and heralds: 0.3138981678307521\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"# Calculate the total amount of the games in the venn diagram\n",
|
|||
|
"# Find the complement of (A ∪ B ∪ C)\n",
|
|||
|
"\n",
|
|||
|
"count_all = count_a + count_b + count_c + count_ab + count_abc + count_ac + count_bc\n",
|
|||
|
"did_not_win_all = num_games - p_all_wins\n",
|
|||
|
"\n",
|
|||
|
"print(\"Probabilty that Blue Team loses, doesn't kill dragons and heralds:\", did_not_win_all / num_games)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"#### Probability: Blue Team wins and kills dragon and herald"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Probability that blue team wins, kills dragon and herald: 0.053\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"# The probability of this event is essentially the intersection of\n",
|
|||
|
"# A (Blue Team Wins), B (Kills Dragon) and C (Kills Herald)\n",
|
|||
|
"\n",
|
|||
|
"print(\"Probability that blue team wins, kills dragon and herald:\", p_abc)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"#### Probability: Blue Team does not win but kills dragon and the herald "
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Probability that blue team kills dragon and the herald but does not win: 0.019\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"# Same with above but only with the intersection between\n",
|
|||
|
"# B (Kills Dragon) and C (Kills Herald)\n",
|
|||
|
"\n",
|
|||
|
"print(\"Probability that blue team does not win but kills dragon and the herald :\", p_bc)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"#### Probability: Blue Team wins but does not kill dragon and herald. "
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Probability that blue team wins without killing the graon and the herald: 0.208\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"# Same with above but only with the A section (Blue Team wins)\n",
|
|||
|
"\n",
|
|||
|
"print(\"Probability that blue team wins without killing the dragon and the herald:\", p_a)"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"metadata": {
|
|||
|
"kernelspec": {
|
|||
|
"display_name": "Python 3",
|
|||
|
"language": "python",
|
|||
|
"name": "python3"
|
|||
|
},
|
|||
|
"language_info": {
|
|||
|
"codemirror_mode": {
|
|||
|
"name": "ipython",
|
|||
|
"version": 3
|
|||
|
},
|
|||
|
"file_extension": ".py",
|
|||
|
"mimetype": "text/x-python",
|
|||
|
"name": "python",
|
|||
|
"nbconvert_exporter": "python",
|
|||
|
"pygments_lexer": "ipython3",
|
|||
|
"version": "3.12.3"
|
|||
|
}
|
|||
|
},
|
|||
|
"nbformat": 4,
|
|||
|
"nbformat_minor": 2
|
|||
|
}
|