2023-03-25 12:44:06 +01:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Warning: Your Kaggle API key is readable by other users on this system! To fix this, you can run 'chmod 600 /Users/wojciechbatruszewicz/.kaggle/kaggle.json'\n",
"Downloading home-loan-approval.zip to /Users/wojciechbatruszewicz/InformatykaStudia/SEMESTR8/IUM/ZADANIA\n",
" 0%| | 0.00/12.6k [00:00<?, ?B/s]\n",
"100%|██████████████████████████████████████| 12.6k/12.6k [00:00<00:00, 18.6MB/s]\n"
]
}
],
"source": [
"!kaggle datasets download -d rishikeshkonapure/home-loan-approval"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Archive: home-loan-approval.zip\n",
" inflating: loan_sanction_test.csv \n",
" inflating: loan_sanction_train.csv \n"
]
}
],
"source": [
"!unzip -o home-loan-approval.zip"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 367 loan_sanction_test.csv\n"
]
}
],
"source": [
"!wc -l loan_sanction_test.csv"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 614 loan_sanction_train.csv\n"
]
}
],
"source": [
"!wc -l loan_sanction_train.csv"
]
},
{
"cell_type": "code",
2023-03-25 12:47:22 +01:00
"execution_count": 30,
2023-03-25 12:44:06 +01:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<bound method NDFrame.head of Loan_ID Gender Married Dependents Education Self_Employed \\\n",
"0 LP001002 Male No 0 Graduate No \n",
"1 LP001003 Male Yes 1 Graduate No \n",
"2 LP001005 Male Yes 0 Graduate Yes \n",
"3 LP001006 Male Yes 0 Not Graduate No \n",
"4 LP001008 Male No 0 Graduate No \n",
".. ... ... ... ... ... ... \n",
"609 LP002978 Female No 0 Graduate No \n",
"610 LP002979 Male Yes 3+ Graduate No \n",
"611 LP002983 Male Yes 1 Graduate No \n",
"612 LP002984 Male Yes 2 Graduate No \n",
"613 LP002990 Female No 0 Graduate Yes \n",
"\n",
" ApplicantIncome CoapplicantIncome LoanAmount Loan_Amount_Term \\\n",
"0 5849 0.0 NaN 360.0 \n",
"1 4583 1508.0 128.0 360.0 \n",
"2 3000 0.0 66.0 360.0 \n",
"3 2583 2358.0 120.0 360.0 \n",
"4 6000 0.0 141.0 360.0 \n",
".. ... ... ... ... \n",
"609 2900 0.0 71.0 360.0 \n",
"610 4106 0.0 40.0 180.0 \n",
"611 8072 240.0 253.0 360.0 \n",
"612 7583 0.0 187.0 360.0 \n",
"613 4583 0.0 133.0 360.0 \n",
"\n",
" Credit_History Property_Area Loan_Status \n",
"0 1.0 Urban Y \n",
"1 1.0 Rural N \n",
"2 1.0 Urban Y \n",
"3 1.0 Urban Y \n",
"4 1.0 Urban Y \n",
".. ... ... ... \n",
"609 1.0 Rural Y \n",
"610 1.0 Rural Y \n",
"611 1.0 Urban Y \n",
"612 1.0 Urban Y \n",
"613 0.0 Semiurban N \n",
"\n",
"[614 rows x 13 columns]>"
]
},
2023-03-25 12:47:22 +01:00
"execution_count": 30,
2023-03-25 12:44:06 +01:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"home_loan_train = pd.read_csv('loan_sanction_train.csv')\n",
"home_loan_test = pd.read_csv('loan_sanction_test.csv')\n",
"home_loan_train.head"
]
},
{
"cell_type": "code",
2023-03-25 12:47:22 +01:00
"execution_count": 31,
2023-03-25 12:44:06 +01:00
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Loan_ID</th>\n",
" <th>Gender</th>\n",
" <th>Married</th>\n",
" <th>Dependents</th>\n",
" <th>Education</th>\n",
" <th>Self_Employed</th>\n",
" <th>ApplicantIncome</th>\n",
" <th>CoapplicantIncome</th>\n",
" <th>LoanAmount</th>\n",
" <th>Loan_Amount_Term</th>\n",
" <th>Credit_History</th>\n",
" <th>Property_Area</th>\n",
" <th>Loan_Status</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
" <td>614</td>\n",
" <td>601</td>\n",
" <td>611</td>\n",
" <td>599</td>\n",
" <td>614</td>\n",
" <td>582</td>\n",
" <td>614.000000</td>\n",
" <td>614.000000</td>\n",
" <td>592.000000</td>\n",
" <td>600.00000</td>\n",
" <td>564.000000</td>\n",
" <td>614</td>\n",
" <td>614</td>\n",
" </tr>\n",
" <tr>\n",
" <th>unique</th>\n",
" <td>614</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" <td>4</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>3</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>top</th>\n",
" <td>LP001002</td>\n",
" <td>Male</td>\n",
" <td>Yes</td>\n",
" <td>0</td>\n",
" <td>Graduate</td>\n",
" <td>No</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>Semiurban</td>\n",
" <td>Y</td>\n",
" </tr>\n",
" <tr>\n",
" <th>freq</th>\n",
" <td>1</td>\n",
" <td>489</td>\n",
" <td>398</td>\n",
" <td>345</td>\n",
" <td>480</td>\n",
" <td>500</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>233</td>\n",
" <td>422</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>5403.459283</td>\n",
" <td>1621.245798</td>\n",
" <td>146.412162</td>\n",
" <td>342.00000</td>\n",
" <td>0.842199</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>6109.041673</td>\n",
" <td>2926.248369</td>\n",
" <td>85.587325</td>\n",
" <td>65.12041</td>\n",
" <td>0.364878</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>150.000000</td>\n",
" <td>0.000000</td>\n",
" <td>9.000000</td>\n",
" <td>12.00000</td>\n",
" <td>0.000000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>2877.500000</td>\n",
" <td>0.000000</td>\n",
" <td>100.000000</td>\n",
" <td>360.00000</td>\n",
" <td>1.000000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>3812.500000</td>\n",
" <td>1188.500000</td>\n",
" <td>128.000000</td>\n",
" <td>360.00000</td>\n",
" <td>1.000000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>5795.000000</td>\n",
" <td>2297.250000</td>\n",
" <td>168.000000</td>\n",
" <td>360.00000</td>\n",
" <td>1.000000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>81000.000000</td>\n",
" <td>41667.000000</td>\n",
" <td>700.000000</td>\n",
" <td>480.00000</td>\n",
" <td>1.000000</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Loan_ID Gender Married Dependents Education Self_Employed \\\n",
"count 614 601 611 599 614 582 \n",
"unique 614 2 2 4 2 2 \n",
"top LP001002 Male Yes 0 Graduate No \n",
"freq 1 489 398 345 480 500 \n",
"mean NaN NaN NaN NaN NaN NaN \n",
"std NaN NaN NaN NaN NaN NaN \n",
"min NaN NaN NaN NaN NaN NaN \n",
"25% NaN NaN NaN NaN NaN NaN \n",
"50% NaN NaN NaN NaN NaN NaN \n",
"75% NaN NaN NaN NaN NaN NaN \n",
"max NaN NaN NaN NaN NaN NaN \n",
"\n",
" ApplicantIncome CoapplicantIncome LoanAmount Loan_Amount_Term \\\n",
"count 614.000000 614.000000 592.000000 600.00000 \n",
"unique NaN NaN NaN NaN \n",
"top NaN NaN NaN NaN \n",
"freq NaN NaN NaN NaN \n",
"mean 5403.459283 1621.245798 146.412162 342.00000 \n",
"std 6109.041673 2926.248369 85.587325 65.12041 \n",
"min 150.000000 0.000000 9.000000 12.00000 \n",
"25% 2877.500000 0.000000 100.000000 360.00000 \n",
"50% 3812.500000 1188.500000 128.000000 360.00000 \n",
"75% 5795.000000 2297.250000 168.000000 360.00000 \n",
"max 81000.000000 41667.000000 700.000000 480.00000 \n",
"\n",
" Credit_History Property_Area Loan_Status \n",
"count 564.000000 614 614 \n",
"unique NaN 3 2 \n",
"top NaN Semiurban Y \n",
"freq NaN 233 422 \n",
"mean 0.842199 NaN NaN \n",
"std 0.364878 NaN NaN \n",
"min 0.000000 NaN NaN \n",
"25% 1.000000 NaN NaN \n",
"50% 1.000000 NaN NaN \n",
"75% 1.000000 NaN NaN \n",
"max 1.000000 NaN NaN "
]
},
2023-03-25 12:47:22 +01:00
"execution_count": 31,
2023-03-25 12:44:06 +01:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"home_loan_train.describe(include = \"all\")"
]
},
{
"cell_type": "code",
2023-03-25 12:47:22 +01:00
"execution_count": 32,
2023-03-25 12:44:06 +01:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Y 422\n",
"N 192\n",
"Name: Loan_Status, dtype: int64"
]
},
2023-03-25 12:47:22 +01:00
"execution_count": 32,
2023-03-25 12:44:06 +01:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"home_loan_train[\"Loan_Status\"].value_counts()"
]
},
{
"cell_type": "code",
2023-03-25 12:47:22 +01:00
"execution_count": 33,
2023-03-25 12:44:06 +01:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<Axes: >"
]
},
2023-03-25 12:47:22 +01:00
"execution_count": 33,
2023-03-25 12:44:06 +01:00
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
2023-03-25 12:47:22 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAioAAAGdCAYAAAA8F1jjAAAAOXRFWHRTb2Z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cNas2aNrly5otdee01r1671vxOoqKhIVVVVSkxMVFpamvbv36+UlBTl5+fPyAECAIC5a1KhYrFYdPDgQf3whz9UWVmZbt26paysLL311ltatGiRFi1apEOHDqmurk51dXWKj4/Xs88+q7KyMv/XKC0t1cjIiCoqKjQ0NKTs7GzV19ePu8EWAADAMjo6OhrqIabL6/Xp5s2BUI8xq+x2qxISYlV24Be6fG3q75jC3JCeNl8HX1qlvr4Brt0jbI39XOM8jwyJibETupmWN6sDAABjESoAAMBYhAoAADAWoQIAAIxFqAAAAGMRKgAAwFiECgAAMBahAgAAjEWoAAAAYxEqAADAWIQKAAAwFqECAACMRagAAABjESoAAMBYhAoAADAWoQIAAIxFqAAAAGMRKgAAwFiECgAAMBahAgAAjEWoAAAAYxEqAADAWIQKAAAwFqECAACMRagAAABjESoAAMBYhAoAADAWoQIAAIxFqAAAAGMRKgAAwFiTDpXe3l6Vl5crJydHTz75pL773e+qo6PDv/7ChQsqKirSihUrtGrVKtXX1wfs7/P5VFNTo9zcXGVmZmrjxo3q7Oyc/pEAAICwM+lQ2bJliz7//HMdOXJEJ06cUHR0tNavX6/BwUH19fVpw4YNeuSRR3Ty5EmVlJTo0KFDOnnypH//2tpaNTY2qrKyUk1NTbJYLCouLpbH4wnqgQEAgLnPPpmN+/r69PDDD2vLli169NFHJUkvvPC
2023-03-25 12:44:06 +01:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"home_loan_train[\"Loan_Status\"].value_counts().plot(kind=\"bar\")"
]
},
{
"cell_type": "code",
2023-03-25 12:47:22 +01:00
"execution_count": 34,
2023-03-25 12:44:06 +01:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<Axes: xlabel='Loan_Status'>"
]
},
2023-03-25 12:47:22 +01:00
"execution_count": 34,
2023-03-25 12:44:06 +01:00
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
2023-03-25 12:47:22 +01:00
"image/png": "iVBORw0KG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vn26ve+92n/4uEpKHSosLtX+w8dd2x86WqDGVwTJy2bTpi1fyjewuWv8Z54eopu699TOHV+rQ8dIPZE40bVuzYdpkqSDRwvk8HIfu0JhcalKSh1uy47lF2v/4eNqYPOq1t9Jktq0uUY7d+5wW7ZixVJ99NFqjR//vKST72VTcZlJkv797+01PnsSFNREQUFNdODAAd1zz9Wu5evXf6LPPvu7kpMn1WjcqiJmAMBQVbkn7spAm0od/rKXOiWLw7W84mxDy5BGl3SOp6v4efYyp0rsjkq2drdh3UdyOhz63Z33K6R5K7d1/e7pr40b1mjN6r/J6SxXxo6vtfR/U9Q9pre+y/hGH61epfgBw1Rid8j+30/dXvTqLD0yJFF+/gF6+38X6IqgJuoSFaMSu+PkWx04yt22P/k3bKDbfhurt99cLD//Rmp5dRt99veP9NO+H/WrYd2UlXVI2774XF//e7uaBDfVjm+/0rK3UiRJJ04UnzF2Bafj5FsrVCzz9fXTvswfdTTnmK4MblLtv3P//g/p0Ucf1qJFr+r22+/QgQM/6a9/fV1xcfepbdtrdNNNN2vmzBclSVdf3Urr13+izz//VJMnT6v2z5JOnrHp3/9hvfbaXxQSEqKbbrpFP/ywWzNnvqTu3W8561mki4mYAQAPVFbmVJnDqacfvLHyjS/2z3Y4VVbmrHzD03z29490w6+66KoWrc5Y1yykubp2i9Hmzzco9KqWujHqZv20f6+
2023-03-25 12:44:06 +01:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"home_loan_train[[\"Loan_Status\", \"ApplicantIncome\"]].groupby(\"Loan_Status\").mean().plot(kind=\"bar\")"
]
},
{
"cell_type": "code",
2023-03-25 12:47:22 +01:00
"execution_count": 35,
2023-03-25 12:44:06 +01:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
2023-03-25 12:47:22 +01:00
"<seaborn.axisgrid.FacetGrid at 0x13f929ae0>"
2023-03-25 12:44:06 +01:00
]
},
2023-03-25 12:47:22 +01:00
"execution_count": 35,
2023-03-25 12:44:06 +01:00
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkQAAAHkCAYAAADfFDApAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAAC0A0lEQVR4nOzdd3xUVdrA8d+909NDCAm9Q+ggBCKIIM1eENu6oIKyrgXXjop9RfdVFEWXZRXYxVUXUFDXiggqUqRXIfQOSSA9k0y7975/BAbGTDAJA5kkz/fz2ZXcc+bcczLtyamKYRgGQgghhBB1mFrdFRBCCCGEqG4SEAkhhBCizpOASAghhBB1ngREQgghhKjzJCASQgghRJ0nAZEQQggh6jwJiIQQQghR50lAJIQQQog6TwIiIYQQQtR55uquQG2laTo5Oc4K51dVhXr1IsnJcaLrNXfzcGlHeJF2hBdpR3gJVTsSE6NDWCtRXaSHKEyoqoKiKKiqUt1VOSvSjvAi7Qgv0o7wUlvaIUJDAiIhhBBC1HkSEAkhhBCizpOASAghhBB1ngREQgghhKjzJCASQgghRJ0nAZEQQggh6jwJiIQQQghR50lAJIQQQog6TwIiIYQQQtR5EhAJIYQQos6TgEgIIYQQdZ4EREIIIYSo8+S0eyFESFnMChatGAMFr8mBz1dzT0MXQtQdEhAJIUJCVRUiKcK5/nsKti4F1URUt8FEdbgIp+7AkLhICBHGJCASQoREJEVkfvgMWmGO/1rejx/i3LKE+jc8RZHhqMbaCSHEmckcIiHEWbOYwbn5x4Bg6CTv8YN4Dm3FZJKPGyFE+Kr2Tyiv18vkyZMZOHAgPXr04NZbb2XdunX+9G3btjFy5Ei6d+/OwIEDmTFjRsDjdV1nypQp9O/fn27dujFmzBj2798fkCcUZQghymfWXBRvW1puunPzD5jxnscaCSFE5VR7QPSPf/yDefPm8dJLL/HZZ5/RqlUrxo4dS2ZmJrm5uYwePZoWLVowb948xo0bx1tvvc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AMjIyKBdu3YB+U6mHTlyhIyMDAAaNmxYJs/Ro0dDVkZVmc0VjzdNJjXgvzWVtCO8SDvCi7QjvNSWdojQCJuA6PPPP8ftdjNq1Cj/NZfLhdVqDchns9mA0gCqpKQEIGie/Pz8kJVRFaqqEB8fWenHxcQ4qnzPcCLtCC/SjvAi7QgvtaUd4uyETUD02WefMWzYMOLj4/3X7HZ7mYnNbrcbgIiICOx2O1A6D+jkv0/mcTgcISujKnTdoKCguML5TSaVmBgHBQUlaJpe5ftWN2lHeJF2hBdpR3gJVTuq8sevCD9hERDl5OSwfv167r777oDrycnJZGVlBVw7+XNSUhI+n89/rVmzZgF5UlJSQlZGVfl8lX+DaZpepceFG2lHeJF2hBdpR3ipLe0QZycsBk7XrVuHoij07t074Hpqaipr165F0zT/tRUrVtCyZUsSEhJISUkhKiqKlStX+tMLCgrYunUrvXr1ClkZQgghhKjdwiIgSk9Pp2nTpmWGqEaMGEFRURETJkxg165dzJ8/n1mzZvl7kqxWKyNHjmTSpEksWrSI9PR0HnroIZKTkxk6dGjIyhBCCCFE7RYWQ2bHjx8nLi6uzPWEhASmT5/OxIkTGT58OImJiTz++OMMHz7cn+eBBx7A5/Px9NNP43K5SE1NZcaMGf5J0qEoQwghhBC1m2IYhlHdlaiNNE0nJ8dZ4fxms0p8fCS5uc4aPZYt7Qgv0o7wIu0IL6FqR2JidAhrJapLWAyZCSGEEEJUJwmIhBBCCFHnSUAkhBBCiDpPAiIhhBBC1HkSEAkhhBCizpOASAghhBB1ngREQgghhKjzJCASQgghRJ0nAZEQQggh6jwJiIQQQghR50lAJIQ
"text/plain": [
"<Figure size 605.847x500 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import seaborn as sns\n",
"sns.set_theme()\n",
"sns.relplot(data=home_loan_train, x=\"LoanAmount\", y=\"ApplicantIncome\", hue=\"Loan_Status\")\n"
]
},
{
"cell_type": "code",
2023-03-25 12:47:22 +01:00
"execution_count": 36,
2023-03-25 12:44:06 +01:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
2023-03-25 12:47:22 +01:00
"<seaborn.axisgrid.PairGrid at 0x148786080>"
2023-03-25 12:44:06 +01:00
]
},
2023-03-25 12:47:22 +01:00
"execution_count": 36,
2023-03-25 12:44:06 +01:00
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABUIAAATMCAYAAABC9v0RAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdZ3gc1fn38e+ZmW3qstx7wxV3G0wngOkQWiAFSAiQCvxDEjrpkMoTEkJIQoBASAESaoBQQm82GOPecK9ykdWlLVOeF7JlC0m2JKvv73NduYLn7I7OzuzMztxzn/uYIAgCRERERERERERERLoxq6M7ICIiIiIiIiIiItLWFAgVERERERERERGRbk+BUBEREREREREREen2FAgVERERERERERGRbk+BUBEREREREREREen2FAgVERERERERERGRbk+BUBEREREREREREen2FAgVERERERERERGRbk+BUBEREREREREREen2nI7uQHfleT67dlW22foty9CjRya7dlXi+0Gb/R1pOe2j9tOrV/Z+29v6eNyX9nvLaLu1XGfadgc6FqF9j0foXNunLelzdi+t8Tk7+rcxXfZVU2hb7JWu26Kjj8fOJl2/B51Juu6DplyrSvenjNAuyrIMxhgsy3R0V6QR2kfpSfu9ZbTdWk7bbv/SZfvoc3Yv3eFzdofP0Fq0LfbSthDQ96Az0D6QdKZAqIiIiIiIiIiIiHR7CoSKiIiIiIiIiIhIt6dAqIiIiIiIiIiIiHR7mixJRKQVWJYhYpLYbpxUcQVhwngmRBCkT/FxEem+IrZPyK8C38e3IyRMFM/T+U0kHdU9H4RJmAw8z+/obkkXEbF9wn4lqV1lRAgR2DF9f0SkXSkQKiJykBw7IBrfwa6X7iOxeQUA0aETyT/pMqqcHmk1E6OIdC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6F9JO2vrfeBSwisHkTGnEBOTozi4srdf1P7vjl0vLRcV9p2HdHPrrR9DkZbfE4XQ5xs7CEzMQYqXB9c6Mjzm/Zn6+ioa9V01R22hQvEycIeNB1jDFWeT9CC80F32BatLR22x57vT3jo4eTlZuh6uRPQsSjpqEMLQuypy7lixYo6y1euXMmQIUOYMWMGH374IZ63N3X+vffeY9iwYRQUFDBmzBiysrKYM2dObXtZWRlLly6tzTBtjXV0NaUVSXIywsQiDqWVyQO/QURaTTo9URWR9KKbJRHZw/MCXNcnaL8SwdKN+O1YW1pE5JM6NBA6ceJEpk+fzg033MDs2bNZt24dv/nNb3jvvff4yle+wvnnn09FRQW33HILq1at4oknnuChhx7iq1/9KlBT1/Piiy/mjjvu4JVXXmH58uVce+219O3bl1mzZgG0yjq6mrKqJJnREJlRhzIFQkVERERERERERDp2aLxlWdxzzz385je/4aabbqK0tJRRo0bx4IMPMnnyZADuu+8+br/9ds4991x69erF9ddfz7nnnlu7jmuuuQbXdbn11luJx+PMmDGD+++/v3byo4KCgoNeR1fi+T4VVSkyow6Z0RBlVQqEioiIiIiIiIiImCDQgIa24Hk+u3a1XcFnx7HIz8/cp65KjdKKBNfe/Q7nHjOc5RuK8fyAG78wtc36IY1rbB9J6+vVK3u/7W19PO5L+71ltN1arjNtuwMdi9C+xyN0ru3TlvQ5u5fW+Jwd/duYLvuqKbQt9krXbdHRx2Nnk67fg84kXfdBU65Vpfvr0KHx0vr21ATNijlkaGi8iIiIiIiIiIgIoEBot7Mn8JkRDZEVDWmyJBERERERERERERQI7Xb2BD4zIjUZodUJl1QapbqLiIiIiIiIiIg0RIHQbqY64WLbhpBjkRmtmQurXBMmiYiIiIiIiIhImlMgtJupTnpEQzY
"text/plain": [
"<Figure size 1355.85x1250 with 30 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"sns.pairplot(data=home_loan_train.drop(columns=[\"Loan_ID\"]), hue=\"Loan_Status\")"
]
},
{
"cell_type": "code",
2023-03-25 12:47:22 +01:00
"execution_count": 37,
2023-03-25 12:44:06 +01:00
"metadata": {},
"outputs": [],
"source": [
2023-03-25 12:47:22 +01:00
"from sklearn.model_selection import train_test_split\n",
"home_loan_val_final, home_loan_test_final = train_test_split(home_loan_test, test_size=0.5, random_state=1)\n",
"home_loan_train_final = home_loan_train"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Loan_ID</th>\n",
" <th>Gender</th>\n",
" <th>Married</th>\n",
" <th>Dependents</th>\n",
" <th>Education</th>\n",
" <th>Self_Employed</th>\n",
" <th>ApplicantIncome</th>\n",
" <th>CoapplicantIncome</th>\n",
" <th>LoanAmount</th>\n",
" <th>Loan_Amount_Term</th>\n",
" <th>Credit_History</th>\n",
" <th>Property_Area</th>\n",
" <th>Loan_Status</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>LP001003</td>\n",
" <td>Male</td>\n",
" <td>Yes</td>\n",
" <td>1</td>\n",
" <td>Graduate</td>\n",
" <td>No</td>\n",
" <td>0.054830</td>\n",
" <td>0.036192</td>\n",
" <td>0.172214</td>\n",
" <td>0.743590</td>\n",
" <td>1.0</td>\n",
" <td>Rural</td>\n",
" <td>N</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>LP001005</td>\n",
" <td>Male</td>\n",
" <td>Yes</td>\n",
" <td>0</td>\n",
" <td>Graduate</td>\n",
" <td>Yes</td>\n",
" <td>0.035250</td>\n",
" <td>0.000000</td>\n",
" <td>0.082489</td>\n",
" <td>0.743590</td>\n",
" <td>1.0</td>\n",
" <td>Urban</td>\n",
" <td>Y</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>LP001006</td>\n",
" <td>Male</td>\n",
" <td>Yes</td>\n",
" <td>0</td>\n",
" <td>Not Graduate</td>\n",
" <td>No</td>\n",
" <td>0.030093</td>\n",
" <td>0.056592</td>\n",
" <td>0.160637</td>\n",
" <td>0.743590</td>\n",
" <td>1.0</td>\n",
" <td>Urban</td>\n",
" <td>Y</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>LP001008</td>\n",
" <td>Male</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" <td>Graduate</td>\n",
" <td>No</td>\n",
" <td>0.072356</td>\n",
" <td>0.000000</td>\n",
" <td>0.191027</td>\n",
" <td>0.743590</td>\n",
" <td>1.0</td>\n",
" <td>Urban</td>\n",
" <td>Y</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>LP001011</td>\n",
" <td>Male</td>\n",
" <td>Yes</td>\n",
" <td>2</td>\n",
" <td>Graduate</td>\n",
" <td>Yes</td>\n",
" <td>0.065145</td>\n",
" <td>0.100703</td>\n",
" <td>0.373372</td>\n",
" <td>0.743590</td>\n",
" <td>1.0</td>\n",
" <td>Urban</td>\n",
" <td>Y</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>609</th>\n",
" <td>LP002978</td>\n",
" <td>Female</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" <td>Graduate</td>\n",
" <td>No</td>\n",
" <td>0.034014</td>\n",
" <td>0.000000</td>\n",
" <td>0.089725</td>\n",
" <td>0.743590</td>\n",
" <td>1.0</td>\n",
" <td>Rural</td>\n",
" <td>Y</td>\n",
" </tr>\n",
" <tr>\n",
" <th>610</th>\n",
" <td>LP002979</td>\n",
" <td>Male</td>\n",
" <td>Yes</td>\n",
" <td>3+</td>\n",
" <td>Graduate</td>\n",
" <td>No</td>\n",
" <td>0.048930</td>\n",
" <td>0.000000</td>\n",
" <td>0.044863</td>\n",
" <td>0.358974</td>\n",
" <td>1.0</td>\n",
" <td>Rural</td>\n",
" <td>Y</td>\n",
" </tr>\n",
" <tr>\n",
" <th>611</th>\n",
" <td>LP002983</td>\n",
" <td>Male</td>\n",
" <td>Yes</td>\n",
" <td>1</td>\n",
" <td>Graduate</td>\n",
" <td>No</td>\n",
" <td>0.097984</td>\n",
" <td>0.005760</td>\n",
" <td>0.353111</td>\n",
" <td>0.743590</td>\n",
" <td>1.0</td>\n",
" <td>Urban</td>\n",
" <td>Y</td>\n",
" </tr>\n",
" <tr>\n",
" <th>612</th>\n",
" <td>LP002984</td>\n",
" <td>Male</td>\n",
" <td>Yes</td>\n",
" <td>2</td>\n",
" <td>Graduate</td>\n",
" <td>No</td>\n",
" <td>0.091936</td>\n",
" <td>0.000000</td>\n",
" <td>0.257598</td>\n",
" <td>0.743590</td>\n",
" <td>1.0</td>\n",
" <td>Urban</td>\n",
" <td>Y</td>\n",
" </tr>\n",
" <tr>\n",
" <th>613</th>\n",
" <td>LP002990</td>\n",
" <td>Female</td>\n",
" <td>No</td>\n",
" <td>0</td>\n",
" <td>Graduate</td>\n",
" <td>Yes</td>\n",
" <td>0.054830</td>\n",
" <td>0.000000</td>\n",
" <td>0.179450</td>\n",
" <td>0.743590</td>\n",
" <td>0.0</td>\n",
" <td>Semiurban</td>\n",
" <td>N</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>480 rows × 13 columns</p>\n",
"</div>"
],
"text/plain": [
" Loan_ID Gender Married Dependents Education Self_Employed \\\n",
"1 LP001003 Male Yes 1 Graduate No \n",
"2 LP001005 Male Yes 0 Graduate Yes \n",
"3 LP001006 Male Yes 0 Not Graduate No \n",
"4 LP001008 Male No 0 Graduate No \n",
"5 LP001011 Male Yes 2 Graduate Yes \n",
".. ... ... ... ... ... ... \n",
"609 LP002978 Female No 0 Graduate No \n",
"610 LP002979 Male Yes 3+ Graduate No \n",
"611 LP002983 Male Yes 1 Graduate No \n",
"612 LP002984 Male Yes 2 Graduate No \n",
"613 LP002990 Female No 0 Graduate Yes \n",
"\n",
" ApplicantIncome CoapplicantIncome LoanAmount Loan_Amount_Term \\\n",
"1 0.054830 0.036192 0.172214 0.743590 \n",
"2 0.035250 0.000000 0.082489 0.743590 \n",
"3 0.030093 0.056592 0.160637 0.743590 \n",
"4 0.072356 0.000000 0.191027 0.743590 \n",
"5 0.065145 0.100703 0.373372 0.743590 \n",
".. ... ... ... ... \n",
"609 0.034014 0.000000 0.089725 0.743590 \n",
"610 0.048930 0.000000 0.044863 0.358974 \n",
"611 0.097984 0.005760 0.353111 0.743590 \n",
"612 0.091936 0.000000 0.257598 0.743590 \n",
"613 0.054830 0.000000 0.179450 0.743590 \n",
"\n",
" Credit_History Property_Area Loan_Status \n",
"1 1.0 Rural N \n",
"2 1.0 Urban Y \n",
"3 1.0 Urban Y \n",
"4 1.0 Urban Y \n",
"5 1.0 Urban Y \n",
".. ... ... ... \n",
"609 1.0 Rural Y \n",
"610 1.0 Rural Y \n",
"611 1.0 Urban Y \n",
"612 1.0 Urban Y \n",
"613 0.0 Semiurban N \n",
"\n",
"[480 rows x 13 columns]"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from sklearn.preprocessing import MinMaxScaler\n",
"numeric_cols_train = home_loan_train_final.select_dtypes(include='number').columns\n",
"numeric_cols_test = home_loan_test_final.select_dtypes(include='number').columns\n",
"numeric_cols_val = home_loan_val_final.select_dtypes(include='number').columns\n",
"scaler = MinMaxScaler()\n",
"home_loan_train_final[numeric_cols_train] = scaler.fit_transform(home_loan_train_final[numeric_cols_train])\n",
"home_loan_test_final[numeric_cols_test] = scaler.fit_transform(home_loan_test_final[numeric_cols_test])\n",
"home_loan_val_final[numeric_cols_val] = scaler.fit_transform(home_loan_val_final[numeric_cols_val])\n",
"\n",
"home_loan_train_final = home_loan_train_final.dropna()\n",
"home_loan_test_final = home_loan_test_final.dropna()\n",
"home_loan_val_final = home_loan_val_final.dropna()\n",
"\n",
"home_loan_train_final"
2023-03-25 12:44:06 +01:00
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "IUMEnv",
"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.10.8"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}