Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 60 additions & 53 deletions practice_problems/machine_learning_problems.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -37,12 +37,12 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"# Specify the path to the .db file\n",
"db_path = \"C:\\\\Users\\\\agomu\\\\Python\\\\github\\\\poke_api\\\\pokemon.db\"\n",
"db_path = \"/Users/kelechiagomuo/Documents/Python/poke_api/pokemon.db\"\n",
"\n",
"# Establish a connection to the SQLite database\n",
"conn = sqlite3.connect(db_path)\n",
Expand All @@ -69,7 +69,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -301,7 +301,7 @@
"max 120.000000 "
]
},
"execution_count": 3,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -312,7 +312,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -369,25 +369,25 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 grass/poison\n",
"1 grass/poison\n",
"2 grass/poison\n",
"3 fire\n",
"4 fire\n",
" ... \n",
"493 ghost/poison\n",
"494 water\n",
"495 water/ice\n",
"496 normal\n",
"497 normal\n",
"Name: totaltype, Length: 498, dtype: object\n"
"0 grass/poison\n",
"1 grass/poison\n",
"2 grass/poison\n",
"3 fire\n",
"4 fire\n",
" ... \n",
"504 fighting/poison\n",
"505 fighting\n",
"506 fighting/fire\n",
"507 fighting/water\n",
"508 poison/ground\n",
"Name: totaltype, Length: 509, dtype: object\n"
]
}
],
Expand All @@ -400,7 +400,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 9,
"metadata": {},
"outputs": [
{
Expand All @@ -413,12 +413,12 @@
"3 0\n",
"4 0\n",
" ..\n",
"493 1\n",
"494 0\n",
"495 1\n",
"496 0\n",
"497 0\n",
"Name: twotypes, Length: 498, dtype: int64\n"
"504 1\n",
"505 0\n",
"506 1\n",
"507 1\n",
"508 1\n",
"Name: twotypes, Length: 509, dtype: int64\n"
]
}
],
Expand All @@ -430,7 +430,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 10,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -499,8 +499,8 @@
" <td>grassland</td>\n",
" <td>grass</td>\n",
" <td>poison</td>\n",
" <td>grass,poison</td>\n",
" <td>True</td>\n",
" <td>grass/poison</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
Expand All @@ -523,8 +523,8 @@
" <td>grassland</td>\n",
" <td>grass</td>\n",
" <td>poison</td>\n",
" <td>grass,poison</td>\n",
" <td>True</td>\n",
" <td>grass/poison</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
Expand All @@ -547,8 +547,8 @@
" <td>grassland</td>\n",
" <td>grass</td>\n",
" <td>poison</td>\n",
" <td>grass,poison</td>\n",
" <td>True</td>\n",
" <td>grass/poison</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
Expand All @@ -572,7 +572,7 @@
" <td>fire</td>\n",
" <td></td>\n",
" <td>fire</td>\n",
" <td>False</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
Expand All @@ -596,7 +596,7 @@
" <td>fire</td>\n",
" <td></td>\n",
" <td>fire</td>\n",
" <td>False</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
Expand Down Expand Up @@ -626,16 +626,16 @@
"4 20 medium-slow generation-i mountain fire \n",
"\n",
" type_name_2 totaltype twotypes \n",
"0 poison grass,poison True \n",
"1 poison grass,poison True \n",
"2 poison grass,poison True \n",
"3 fire False \n",
"4 fire False \n",
"0 poison grass/poison 1 \n",
"1 poison grass/poison 1 \n",
"2 poison grass/poison 1 \n",
"3 fire 0 \n",
"4 fire 0 \n",
"\n",
"[5 rows x 29 columns]"
]
},
"execution_count": 5,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -653,7 +653,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -663,7 +663,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 12,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -717,7 +717,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 13,
"metadata": {},
"outputs": [
{
Expand All @@ -729,36 +729,36 @@
" bug 0.50 0.33 0.40 12\n",
" dark 0.00 0.00 0.00 4\n",
" dragon 1.00 0.67 0.80 3\n",
" electric 0.75 0.86 0.80 7\n",
" electric 0.78 1.00 0.88 7\n",
" fairy 0.00 0.00 0.00 2\n",
" fighting 1.00 0.33 0.50 3\n",
" fire 0.29 0.25 0.27 8\n",
" ghost 0.00 0.00 0.00 4\n",
" grass 0.20 0.25 0.22 8\n",
" grass 0.22 0.25 0.24 8\n",
" ground 0.00 0.00 0.00 3\n",
" ice 0.00 0.00 0.00 3\n",
" normal 0.50 0.54 0.52 13\n",
" poison 0.00 0.00 0.00 4\n",
" psychic 0.22 0.50 0.31 4\n",
" rock 0.60 0.50 0.55 6\n",
" steel 0.00 0.00 0.00 2\n",
" water 0.15 0.29 0.20 14\n",
" water 0.14 0.29 0.19 14\n",
"\n",
" accuracy 0.33 100\n",
" accuracy 0.34 100\n",
" macro avg 0.31 0.27 0.27 100\n",
"weighted avg 0.34 0.33 0.32 100\n",
"weighted avg 0.34 0.34 0.33 100\n",
"\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"c:\\Users\\agomu\\anaconda3\\lib\\site-packages\\sklearn\\metrics\\_classification.py:1344: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
"/Users/kelechiagomuo/anaconda3/lib/python3.10/site-packages/sklearn/metrics/_classification.py:1344: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
" _warn_prf(average, modifier, msg_start, len(result))\n",
"c:\\Users\\agomu\\anaconda3\\lib\\site-packages\\sklearn\\metrics\\_classification.py:1344: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
"/Users/kelechiagomuo/anaconda3/lib/python3.10/site-packages/sklearn/metrics/_classification.py:1344: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
" _warn_prf(average, modifier, msg_start, len(result))\n",
"c:\\Users\\agomu\\anaconda3\\lib\\site-packages\\sklearn\\metrics\\_classification.py:1344: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
"/Users/kelechiagomuo/anaconda3/lib/python3.10/site-packages/sklearn/metrics/_classification.py:1344: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
" _warn_prf(average, modifier, msg_start, len(result))\n"
]
}
Expand Down Expand Up @@ -800,6 +800,13 @@
" - Gen 1, Gen 2, Gen 3\n",
" - 1, 2, 3 respectively"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Feature Engineering"
]
}
],
"metadata": {
Expand All @@ -818,7 +825,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.10.9"
},
"orig_nbformat": 4
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"\n",
"\n",
"# Specify the path to the .db file\n",
"db_path = \"C:\\\\Users\\\\agomu\\\\Python\\\\github\\\\poke_api\\\\pokemon.db\"\n",
"db_path = \"/Users/kelechiagomuo/Documents/Python/poke_api/pokemon.db\"\n",
"\n",
"# Establish a connection to the SQLite database\n",
"conn = sqlite3.connect(db_path)\n",
Expand Down