stivenmosheyoff commited on
Commit
c8bb70d
·
verified ·
1 Parent(s): fe6b452

Upload Copy_of_Assignment_1_EDA_&_Dataset_stiven_324496561.ipynb

Browse files
Copy_of_Assignment_1_EDA_&_Dataset_stiven_324496561.ipynb CHANGED
@@ -199,7 +199,7 @@
199
  "metadata": {
200
  "id": "OI0MZzohKwfE"
201
  },
202
- "execution_count": 1,
203
  "outputs": []
204
  },
205
  {
@@ -217,7 +217,7 @@
217
  "metadata": {
218
  "id": "SWIrnfSLKwnE"
219
  },
220
- "execution_count": 2,
221
  "outputs": []
222
  },
223
  {
@@ -354,7 +354,8 @@
354
  "print(\"-\" * 100)\n",
355
  "print(\"\\n>>> filtering date_of_birth wins losses and draws \")\n",
356
  "print(\"-\" * 100)\n",
357
- "\n",
 
358
  "df['date_of_birth'] = pd.to_datetime(df['date_of_birth'])\n",
359
  "today = pd.to_datetime(date.today())\n",
360
  "df['Age'] = (today - df['date_of_birth']).dt.days / 365.25\n",
@@ -399,9 +400,9 @@
399
  "height": 1000
400
  },
401
  "collapsed": true,
402
- "outputId": "b940c794-db0c-4eae-9d1f-a2ebbce6daf2"
403
  },
404
- "execution_count": 144,
405
  "outputs": [
406
  {
407
  "output_type": "stream",
@@ -559,14 +560,14 @@
559
  "output_type": "stream",
560
  "name": "stderr",
561
  "text": [
562
- "/tmp/ipython-input-2477576501.py:79: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.\n",
563
  "The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.\n",
564
  "\n",
565
  "For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.\n",
566
  "\n",
567
  "\n",
568
  " df['stance'].fillna('Unknown', inplace=True)\n",
569
- "/tmp/ipython-input-2477576501.py:87: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.\n",
570
  "The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.\n",
571
  "\n",
572
  "For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.\n",
@@ -611,7 +612,7 @@
611
  ],
612
  "text/html": [
613
  "\n",
614
- " <div id=\"df-52bb01bb-ff12-4c96-b834-872440acb2a6\" class=\"colab-df-container\">\n",
615
  " <div>\n",
616
  "<style scoped>\n",
617
  " .dataframe tbody tr th:only-of-type {\n",
@@ -789,7 +790,7 @@
789
  " <div class=\"colab-df-buttons\">\n",
790
  "\n",
791
  " <div class=\"colab-df-container\">\n",
792
- " <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-52bb01bb-ff12-4c96-b834-872440acb2a6')\"\n",
793
  " title=\"Convert this dataframe to an interactive table.\"\n",
794
  " style=\"display:none;\">\n",
795
  "\n",
@@ -841,12 +842,12 @@
841
  "\n",
842
  " <script>\n",
843
  " const buttonEl =\n",
844
- " document.querySelector('#df-52bb01bb-ff12-4c96-b834-872440acb2a6 button.colab-df-convert');\n",
845
  " buttonEl.style.display =\n",
846
  " google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
847
  "\n",
848
  " async function convertToInteractive(key) {\n",
849
- " const element = document.querySelector('#df-52bb01bb-ff12-4c96-b834-872440acb2a6');\n",
850
  " const dataTable =\n",
851
  " await google.colab.kernel.invokeFunction('convertToInteractive',\n",
852
  " [key], {});\n",
@@ -866,8 +867,8 @@
866
  " </div>\n",
867
  "\n",
868
  "\n",
869
- " <div id=\"df-27409ab2-be39-4419-80c6-d53fb90c6e24\">\n",
870
- " <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-27409ab2-be39-4419-80c6-d53fb90c6e24')\"\n",
871
  " title=\"Suggest charts\"\n",
872
  " style=\"display:none;\">\n",
873
  "\n",
@@ -986,7 +987,7 @@
986
  " }\n",
987
  " (() => {\n",
988
  " let quickchartButtonEl =\n",
989
- " document.querySelector('#df-27409ab2-be39-4419-80c6-d53fb90c6e24 button');\n",
990
  " quickchartButtonEl.style.display =\n",
991
  " google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
992
  " })();\n",
@@ -1002,7 +1003,7 @@
1002
  }
1003
  },
1004
  "metadata": {},
1005
- "execution_count": 144
1006
  }
1007
  ]
1008
  },
@@ -1038,6 +1039,7 @@
1038
  " 'Takedowns/Fight', 'TD Accuracy', 'TD Defense', 'Submissions/Fight',\n",
1039
  " 'total_fights'\n",
1040
  "]\n",
 
1041
  "correlation_matrix = corr_data.corr()\n",
1042
  "print(\"\\nCorrelations with WIN_RATE:\")\n",
1043
  "print(correlation_matrix['win_rate'].sort_values(ascending=False).round(3))\n",
@@ -1132,11 +1134,10 @@
1132
  "base_uri": "https://localhost:8080/",
1133
  "height": 1000
1134
  },
1135
- "collapsed": true,
1136
  "id": "0xO35jtB_arm",
1137
- "outputId": "638c1f4b-bf3c-4d29-b245-3f33f331749b"
1138
  },
1139
- "execution_count": 163,
1140
  "outputs": [
1141
  {
1142
  "output_type": "stream",
@@ -1166,25 +1167,15 @@
1166
  "75% 4.480000 58.000000 2.110000 50.000000 71.000000 \n",
1167
  "max 52.500000 100.000000 24.110000 100.000000 100.000000 \n",
1168
  "\n",
1169
- " Submissions/Fight Age total_fights win_rate \\\n",
1170
- "count 2973.000000 2973.000000 2973.000000 2973.000000 \n",
1171
- "mean 0.649479 39.488732 20.389506 70.194717 \n",
1172
- "std 1.330835 7.780529 13.634073 14.459033 \n",
1173
- "min 0.000000 21.000000 1.000000 0.000000 \n",
1174
- "25% 0.000000 34.000000 12.000000 63.636364 \n",
1175
- "50% 0.200000 39.000000 18.000000 70.833333 \n",
1176
- "75% 0.800000 44.000000 26.000000 78.571429 \n",
1177
- "max 21.900000 82.000000 316.000000 100.000000 \n",
1178
- "\n",
1179
- " Aggressiveness_Index \n",
1180
- "count 2973.000000 \n",
1181
- "mean 0.218714 \n",
1182
- "std 0.077512 \n",
1183
- "min 0.000000 \n",
1184
- "25% 0.182538 \n",
1185
- "50% 0.223961 \n",
1186
- "75% 0.263198 \n",
1187
- "max 0.590243 \n",
1188
  "\n",
1189
  "====================================================================================================\n",
1190
  "CORRELATION ANALYSIS\n",
@@ -1202,6 +1193,7 @@
1202
  "reach_in_cm 0.033\n",
1203
  "Absorb/Min 0.001\n",
1204
  "height_cm -0.057\n",
 
1205
  "Name: win_rate, dtype: float64\n"
1206
  ]
1207
  },
@@ -1209,7 +1201,7 @@
1209
  "output_type": "stream",
1210
  "name": "stderr",
1211
  "text": [
1212
- "/tmp/ipython-input-316548456.py:66: FutureWarning: \n",
1213
  "\n",
1214
  "Passing `palette` without assigning `hue` is deprecated and will be removed in v0.14.0. Assign the `x` variable to `hue` and set `legend=False` for the same effect.\n",
1215
  "\n",
@@ -1290,12 +1282,12 @@
1290
  {
1291
  "cell_type": "code",
1292
  "source": [
1293
- "\"Among UFC fighters, do in-cage behavioral metrics (represented by the Composite Aggressiveness Index) predict the Win Rate more effectively than static physical metrics (Height, Reach, and Age)?\""
1294
  ],
1295
  "metadata": {
1296
  "id": "0ch5l8tIK1Dt"
1297
  },
1298
- "execution_count": 31,
1299
  "outputs": []
1300
  },
1301
  {
@@ -1326,7 +1318,7 @@
1326
  "metadata": {
1327
  "id": "uLxQ5tJQK6xG"
1328
  },
1329
- "execution_count": 31,
1330
  "outputs": []
1331
  },
1332
  {
@@ -1342,7 +1334,7 @@
1342
  "metadata": {
1343
  "id": "euWXtGKHK65d"
1344
  },
1345
- "execution_count": 31,
1346
  "outputs": []
1347
  },
1348
  {
@@ -1394,7 +1386,7 @@
1394
  "metadata": {
1395
  "id": "asKyjjGDK-GJ"
1396
  },
1397
- "execution_count": 31,
1398
  "outputs": []
1399
  },
1400
  {
@@ -1442,7 +1434,7 @@
1442
  "metadata": {
1443
  "id": "WZcWV_6KbE9s"
1444
  },
1445
- "execution_count": 31,
1446
  "outputs": []
1447
  },
1448
  {
@@ -1472,7 +1464,7 @@
1472
  "metadata": {
1473
  "id": "r-8LRIrecw9d"
1474
  },
1475
- "execution_count": 31,
1476
  "outputs": []
1477
  }
1478
  ]
 
199
  "metadata": {
200
  "id": "OI0MZzohKwfE"
201
  },
202
+ "execution_count": 12,
203
  "outputs": []
204
  },
205
  {
 
217
  "metadata": {
218
  "id": "SWIrnfSLKwnE"
219
  },
220
+ "execution_count": 13,
221
  "outputs": []
222
  },
223
  {
 
354
  "print(\"-\" * 100)\n",
355
  "print(\"\\n>>> filtering date_of_birth wins losses and draws \")\n",
356
  "print(\"-\" * 100)\n",
357
+ "import pandas as pd\n",
358
+ "from datetime import date\n",
359
  "df['date_of_birth'] = pd.to_datetime(df['date_of_birth'])\n",
360
  "today = pd.to_datetime(date.today())\n",
361
  "df['Age'] = (today - df['date_of_birth']).dt.days / 365.25\n",
 
400
  "height": 1000
401
  },
402
  "collapsed": true,
403
+ "outputId": "f72ef831-ee1d-40e1-f06c-a39c32b09c69"
404
  },
405
+ "execution_count": 14,
406
  "outputs": [
407
  {
408
  "output_type": "stream",
 
560
  "output_type": "stream",
561
  "name": "stderr",
562
  "text": [
563
+ "/tmp/ipython-input-2870161678.py:79: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.\n",
564
  "The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.\n",
565
  "\n",
566
  "For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.\n",
567
  "\n",
568
  "\n",
569
  " df['stance'].fillna('Unknown', inplace=True)\n",
570
+ "/tmp/ipython-input-2870161678.py:87: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.\n",
571
  "The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.\n",
572
  "\n",
573
  "For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.\n",
 
612
  ],
613
  "text/html": [
614
  "\n",
615
+ " <div id=\"df-2559c298-d062-4c5d-bc38-0afef1514981\" class=\"colab-df-container\">\n",
616
  " <div>\n",
617
  "<style scoped>\n",
618
  " .dataframe tbody tr th:only-of-type {\n",
 
790
  " <div class=\"colab-df-buttons\">\n",
791
  "\n",
792
  " <div class=\"colab-df-container\">\n",
793
+ " <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-2559c298-d062-4c5d-bc38-0afef1514981')\"\n",
794
  " title=\"Convert this dataframe to an interactive table.\"\n",
795
  " style=\"display:none;\">\n",
796
  "\n",
 
842
  "\n",
843
  " <script>\n",
844
  " const buttonEl =\n",
845
+ " document.querySelector('#df-2559c298-d062-4c5d-bc38-0afef1514981 button.colab-df-convert');\n",
846
  " buttonEl.style.display =\n",
847
  " google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
848
  "\n",
849
  " async function convertToInteractive(key) {\n",
850
+ " const element = document.querySelector('#df-2559c298-d062-4c5d-bc38-0afef1514981');\n",
851
  " const dataTable =\n",
852
  " await google.colab.kernel.invokeFunction('convertToInteractive',\n",
853
  " [key], {});\n",
 
867
  " </div>\n",
868
  "\n",
869
  "\n",
870
+ " <div id=\"df-95c00793-eec7-451b-8fc7-8b2ea8e0cfb1\">\n",
871
+ " <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-95c00793-eec7-451b-8fc7-8b2ea8e0cfb1')\"\n",
872
  " title=\"Suggest charts\"\n",
873
  " style=\"display:none;\">\n",
874
  "\n",
 
987
  " }\n",
988
  " (() => {\n",
989
  " let quickchartButtonEl =\n",
990
+ " document.querySelector('#df-95c00793-eec7-451b-8fc7-8b2ea8e0cfb1 button');\n",
991
  " quickchartButtonEl.style.display =\n",
992
  " google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
993
  " })();\n",
 
1003
  }
1004
  },
1005
  "metadata": {},
1006
+ "execution_count": 14
1007
  }
1008
  ]
1009
  },
 
1039
  " 'Takedowns/Fight', 'TD Accuracy', 'TD Defense', 'Submissions/Fight',\n",
1040
  " 'total_fights'\n",
1041
  "]\n",
1042
+ "corr_data = df[key_cols]\n",
1043
  "correlation_matrix = corr_data.corr()\n",
1044
  "print(\"\\nCorrelations with WIN_RATE:\")\n",
1045
  "print(correlation_matrix['win_rate'].sort_values(ascending=False).round(3))\n",
 
1134
  "base_uri": "https://localhost:8080/",
1135
  "height": 1000
1136
  },
 
1137
  "id": "0xO35jtB_arm",
1138
+ "outputId": "6fcc09f8-f4d0-4f7d-c938-23aaadd72ee1"
1139
  },
1140
+ "execution_count": 15,
1141
  "outputs": [
1142
  {
1143
  "output_type": "stream",
 
1167
  "75% 4.480000 58.000000 2.110000 50.000000 71.000000 \n",
1168
  "max 52.500000 100.000000 24.110000 100.000000 100.000000 \n",
1169
  "\n",
1170
+ " Submissions/Fight Age total_fights win_rate \n",
1171
+ "count 2973.000000 2973.000000 2973.000000 2973.000000 \n",
1172
+ "mean 0.649479 39.488732 20.389506 70.194717 \n",
1173
+ "std 1.330835 7.780529 13.634073 14.459033 \n",
1174
+ "min 0.000000 21.000000 1.000000 0.000000 \n",
1175
+ "25% 0.000000 34.000000 12.000000 63.636364 \n",
1176
+ "50% 0.200000 39.000000 18.000000 70.833333 \n",
1177
+ "75% 0.800000 44.000000 26.000000 78.571429 \n",
1178
+ "max 21.900000 82.000000 316.000000 100.000000 \n",
 
 
 
 
 
 
 
 
 
 
1179
  "\n",
1180
  "====================================================================================================\n",
1181
  "CORRELATION ANALYSIS\n",
 
1193
  "reach_in_cm 0.033\n",
1194
  "Absorb/Min 0.001\n",
1195
  "height_cm -0.057\n",
1196
+ "total_fights -0.091\n",
1197
  "Name: win_rate, dtype: float64\n"
1198
  ]
1199
  },
 
1201
  "output_type": "stream",
1202
  "name": "stderr",
1203
  "text": [
1204
+ "/tmp/ipython-input-753851434.py:67: FutureWarning: \n",
1205
  "\n",
1206
  "Passing `palette` without assigning `hue` is deprecated and will be removed in v0.14.0. Assign the `x` variable to `hue` and set `legend=False` for the same effect.\n",
1207
  "\n",
 
1282
  {
1283
  "cell_type": "code",
1284
  "source": [
1285
+ "#\"Among UFC fighters, do in-cage behavioral metrics (represented by the Composite Aggressiveness Index) predict the Win Rate more effectively than static physical metrics (Height, Reach, and Age)?\""
1286
  ],
1287
  "metadata": {
1288
  "id": "0ch5l8tIK1Dt"
1289
  },
1290
+ "execution_count": 16,
1291
  "outputs": []
1292
  },
1293
  {
 
1318
  "metadata": {
1319
  "id": "uLxQ5tJQK6xG"
1320
  },
1321
+ "execution_count": 16,
1322
  "outputs": []
1323
  },
1324
  {
 
1334
  "metadata": {
1335
  "id": "euWXtGKHK65d"
1336
  },
1337
+ "execution_count": 16,
1338
  "outputs": []
1339
  },
1340
  {
 
1386
  "metadata": {
1387
  "id": "asKyjjGDK-GJ"
1388
  },
1389
+ "execution_count": 16,
1390
  "outputs": []
1391
  },
1392
  {
 
1434
  "metadata": {
1435
  "id": "WZcWV_6KbE9s"
1436
  },
1437
+ "execution_count": 16,
1438
  "outputs": []
1439
  },
1440
  {
 
1464
  "metadata": {
1465
  "id": "r-8LRIrecw9d"
1466
  },
1467
+ "execution_count": 16,
1468
  "outputs": []
1469
  }
1470
  ]