You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1186 lines
334 KiB

2 years ago
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"___\n",
"\n",
"<a href='http://www.pieriandata.com'><img src='../Pierian_Data_Logo.png'/></a>\n",
"___\n",
"<center><em>Copyright by Pierian Data Inc.</em></center>\n",
"<center><em>For more information, visit us at <a href='http://www.pieriandata.com'>www.pieriandata.com</a></em></center>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Logistic Regression"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Imports"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import seaborn as sns\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Data\n",
"\n",
"An experiment was conducted on 5000 participants to study the effects of age and physical health on hearing loss, specifically the ability to hear high pitched tones. This data displays the result of the study in which participants were evaluated and scored for physical ability and then had to take an audio test (pass/no pass) which evaluated their ability to hear high frequencies. The age of the user was also noted. Is it possible to build a model that would predict someone's liklihood to hear the high frequency sound based solely on their features (age and physical score)?\n",
"\n",
"* Features\n",
"\n",
" * age - Age of participant in years\n",
" * physical_score - Score achieved during physical exam\n",
"\n",
"* Label/Target\n",
"\n",
" * test_result - 0 if no pass, 1 if test passed"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv('../DATA/hearing_test.csv')"
]
},
{
"cell_type": "code",
"execution_count": 32,
"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>age</th>\n",
" <th>physical_score</th>\n",
" <th>test_result</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>33.0</td>\n",
" <td>40.7</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>50.0</td>\n",
" <td>37.2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>52.0</td>\n",
" <td>24.7</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>56.0</td>\n",
" <td>31.0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>35.0</td>\n",
" <td>42.9</td>\n",
" <td>1</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" age physical_score test_result\n",
"0 33.0 40.7 1\n",
"1 50.0 37.2 1\n",
"2 52.0 24.7 0\n",
"3 56.0 31.0 0\n",
"4 35.0 42.9 1"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Exploratory Data Analysis and Visualization\n",
"\n",
"Feel free to explore the data further on your own."
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 5000 entries, 0 to 4999\n",
"Data columns (total 3 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 age 5000 non-null float64\n",
" 1 physical_score 5000 non-null float64\n",
" 2 test_result 5000 non-null int64 \n",
"dtypes: float64(2), int64(1)\n",
"memory usage: 117.3 KB\n"
]
}
],
"source": [
"df.info()"
]
},
{
"cell_type": "code",
"execution_count": 34,
"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>age</th>\n",
" <th>physical_score</th>\n",
" <th>test_result</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
" <td>5000.000000</td>\n",
" <td>5000.000000</td>\n",
" <td>5000.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
" <td>51.609000</td>\n",
" <td>32.760260</td>\n",
" <td>0.600000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>11.287001</td>\n",
" <td>8.169802</td>\n",
" <td>0.489947</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>18.000000</td>\n",
" <td>-0.000000</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>43.000000</td>\n",
" <td>26.700000</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>51.000000</td>\n",
" <td>35.300000</td>\n",
" <td>1.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>60.000000</td>\n",
" <td>38.900000</td>\n",
" <td>1.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>90.000000</td>\n",
" <td>50.000000</td>\n",
" <td>1.000000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" age physical_score test_result\n",
"count 5000.000000 5000.000000 5000.000000\n",
"mean 51.609000 32.760260 0.600000\n",
"std 11.287001 8.169802 0.489947\n",
"min 18.000000 -0.000000 0.000000\n",
"25% 43.000000 26.700000 0.000000\n",
"50% 51.000000 35.300000 1.000000\n",
"75% 60.000000 38.900000 1.000000\n",
"max 90.000000 50.000000 1.000000"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.describe()"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1 3000\n",
"0 2000\n",
"Name: test_result, dtype: int64"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df['test_result'].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot:xlabel='test_result', ylabel='count'>"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEHCAYAAABfkmooAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAASOklEQVR4nO3df7Dl9V3f8ecLCIkmUcC9obA/XEzWWqKG4B2CpnZImMCGjm50YoRpwpows9qCFZtxShynRJRpnBAZk0bqOmxYrIZuxTRrpOK6xaa2AXaJBFgowy0hZVcCGxZJaBrq4rt/nM8Op8u993MW7rnnLvf5mDlzvt/39/v9fN9nZ2df+/1xvidVhSRJ8zlm0g1IkpY+w0KS1GVYSJK6DAtJUpdhIUnqOm7SDYzDihUrau3atZNuQ5KOKnfdddfXqmpqtmUvy7BYu3Ytu3fvnnQbknRUSfKVuZZ5GkqS1GVYSJK6DAtJUpdhIUnqMiwkSV2GhSSpa2xhkeRVSe5M8qUke5L8aqufluSOJDNJ/n2S41v9lW1+pi1fOzTWh1r9wSTnj6tnSdLsxnlk8Szw9qp6E3AGsD7J2cBvANdW1RuAp4BL2vqXA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kSV2GhSSpy7CQJHWNLSySbEnyRJL7hmonJdmR5KH2fmKrJ8nHk8wkuSfJmUPbbGzrP5Rk47j6lSTNbZxHFjcA6w+rXQHsrKp1wM42D/BOYF17bQKug0G4AFcCbwHOAq48FDCSpMUztrCoqs8DBw4rbwC2tumtwLuG6jfWwO3ACUlOAc4HdlTVgap6CtjBCwNIkjRmi33N4uSqeqxNfxU4uU2vBB4dWm9vq81Vf4Ekm5LsTrJ7//79C9u1JC1zE7v
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"sns.countplot(data=df,x='test_result')"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot:xlabel='test_result', ylabel='age'>"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEHCAYAAACp9y31AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAWZklEQVR4nO3df5Bd9V3/8edrd0MJoW2SzTYDm6ZLvZkCwwhtV6YW26GQxRWsQYfBOrW5WjSjbZcFHAUdporDVLD9FkLmq99miroZbQVpK1hlZRNB1KmRBQLhZ3PFDWWFZFl+Ewv74+0f9yRskk264bufezb7eT1mdu49595z7ith89oPZ8/5HEUEZmaWj6ayA5iZWWO5+M3MMuPiNzPLjIvfzCwzLn4zs8y0lB1gJpYtWxYdHR1lxzAzO6rcf//9z0dE24Hrj4ri7+joYHBwsOwYZmZHFUk7p1vvQz1mZplx8ZuZZcbFb2aWGRe/mVlmXPyZGR0d5dJLL2V0dLTsKGZWkqTFL6lX0iOSHpV0WbFuqaQBSTuKxyUpM9j++vr62L59O5s2bSo7ipmVJFnxSzoN+HXgT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nXmpPuf6bF/4ykxcDfAgOSXgR2znDbTxRX/u51FbAlIq6TdFWxfOUM92U276w8foLf+9ArZcewOeRLD6SdRHGmv9z9+eLpH0i6G3g30P82P3MNcHbxvA+4Bxe/mVnDzHha5r0i4p+P5O3AXZIC+FpEbASWR8SzxevPcYi5cSWtA9YBrFy58khjmpnZIRxx8R+hn4qIYUnvoX6I6ImpL0ZEFD8UDlL8kNgI0NnZOe17zMzsyCW92XpEDBePu4H
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"sns.boxplot(x='test_result',y='age',data=df)"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot:xlabel='test_result', ylabel='physical_score'>"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAEHCAYAAABGNUbLAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAXoElEQVR4nO3df3TddZ3n8ecrSfn9+zb22JYamDC6LIwuRkZHmAPSYGSGwq7I6ow2Ck6ZlakV3RnBcY87HFZxdWYs3Vmxjqzpzg+ko7MUtYG2C4q7LJACWn4MhwwnIOFH60V+OzQ/3vvH/aYkbZrmW+73fpN8Xo9zcu79fHO/977S9rz6yfenIgIzM0tLU9kBzMys8Vz+ZmYJcvmbmSXI5W9mliCXv5lZglrKDjBd8+fPj7a2trJjmJnNKlu3bv1FRLTuvnzWlH9bWxt9fX1lxzAzm1UkPTbZcm/2MTNLkMvfzCxBLn8zswS5/M3MEuTyT0y1WuWTn/wk1Wq17ChmVqLCy1/SgKRtku6T1JctO0bSJkmPZI9HF53Danp6eti2bRvr1q0rO4qZlahRM/8zI+JtEd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46tvupZ/v6bMrP9dtZZZ00Ye4dvsepZ/mZm++2SSy6hqalWSU1NTaxYsaLkRHNbPct/575fYmY2uUqlsmu239nZ6cs5F2yfl3eQdMpU34+Ie7LHd9YrlJml6ZJLLuHpp5/2rL8BpnNtnz+f4ntj9+M1M7NZZJ/lHxFnNiKImVlPTw/btm1j3bp1XHbZZWXHmdPyXNIZSScBJwIHjS2LiHX1DlVvg4ODNL/yvG/eYRM0v1JlcHC47BiWqVar9Pb2EhH09vayfPlyb/cvUJ6
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"sns.boxplot(x='test_result',y='physical_score',data=df)"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot:xlabel='age', ylabel='physical_score'>"
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAEGCAYAAACNaZVuAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAD+xElEQVR4nOyddXhcZfbHP3d8kpm4uzWpu7srWry4Oyy2OOyyLLLoLi6Lu5VCKbQFWurubSppkzTunsno/f1xMplM00L7w7Yw3+fJk8zV994k5z3vOd/zPYqqqgQQQAABBPDngub3HkAAAQQQQAC/PQLGP4AAAgjgT4iA8Q8ggAAC+BMiYPwDCCCAAP6ECBj/AAIIIIA/IXS/9wCOFlFRUWpaWtrvPYwAAggggOMKGzdurFZVNfrQ7ceN8U9LS2PDhg2/9zACCCCAAI4rKIpSeLjtgbBPAAEEEMCfEAHjH0AAAQTwJ0TA+AcQQAAB/Alx3MT8AwgggACOBU6nk+LiYtra2n7vofwmMJlMJCUlodfrj+r4gPEPIIAA/pAoLi7Gar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/e79vv6qCrf6Q+1RDTZ78HBwtRnvZo/I5bbSEita+6Dt+2sPCpNHqJPmbt6jr2BtLYeLfJJHb80SJ4R8J1hhZCS2+17dNo4OEAT/ycpDJqWYfNJZLojgy6+fF6DU6+XI7u24PIID/UQwbNgy73e637e2336ZPn+MrXBn4L/PC7YQDyyB/qRRsxfSErEnCknF00oGp2OEz/nUFsOoZ6HO6JH+DYmD1f8RAe2EMgfBO7J+aA/D5VT4+fPIwSB0pSWMQDv7
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"sns.scatterplot(x='age',y='physical_score',data=df,hue='test_result')"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<seaborn.axisgrid.PairGrid at 0x19ceae2fd08>"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAaQAAAFlCAYAAACk+JwkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAD0t0lEQVR4nOyddXhVV9aH33Pd4u5OQggQXIu2QIVSL/VOO3WZtvPVZzqVaac2dXd3pdRwdw0QIe7uevV8f+wIIelgEaDnfZ48Sc49Z++dm3vvOmvttX5LkmUZBQUFBQWFwUY12AtQUFBQUFAAxSApKCgoKBwnKAZJQUFBQeG4QDFICgoKCgrHBYpBUlBQUFA4LlAMkoKCgoLCccEJY5DmzZsnA8qX8tWXX4dEed0pX/3wpfAHnDAGqaqqarCXoPAnRHndKSgMHCeMQVJQUFBQOLlRDJKCwklGfYuNNrtzsJehoHDEaAZ7AQoKCn1DWX0bi3YX89nmAsK8Tdw+K46xkV5IkjTYS1NQOCwUg6SgcBLgcsl8tjmfl1ZkAZBX3cLmnB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rhyRJkhewAIgC6oCvgXlHcP31wPUA4eHh/bDCQaI0BbyPMFzXgVsQ1OZC0GHWLykcMcfb607TS40QiCLVIA8j4T4mKhttFNR0ffhPjfXl8V/SO6V9CmuKyCht4PZZcTy3LJNzQ0N4/Jc09pU0cPnECPKqWpiVEMCLFyezvaCW+hY784YH8uhPqZw5PIhXLh2N1e7k/75OwdaesffSikxa7FGEeRn5eW9pt9RwgKomK6+tyuaR+cPQtrdS9zDq+M95w/lpdwlL08qZFufHuaN
"text/plain": [
"<Figure size 420.5x360 with 6 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"sns.pairplot(df,hue='test_result')"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot:>"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAaQAAAD9CAYAAADzugO+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAqAUlEQVR4nO3daZhU1bn28f8NKHhkVJChISoCQQ4KaoMjSgQRNYoGFWejKFETpxyNOCQmmnPUoCYxelSOUTFOEROwjaIokUh4I3aLIAgaDXrJjMwSMAL9vB9q0ynahq6mh6ou7l+uffUe1l77qcLUU2vtVWsrIjAzM8u2BtkOwMzMDJyQzMwsRzghmZlZTnBCMjOznOCEZGZmOcEJyczMcoITkpmZfY2kRyUtkzR7G8cl6T5JH0t6T9LB1b2mE5KZmVXkcWDwdo6fAHRNlhHAg9W9oBOSmZl9TUS8CazcTpEhwBOR8hbQUlL76lyzUXVOtu3buHyep8GoZbt16JftEPLenrs1y3YIO4Wlaz5QdeuoymfOrm32+x6pls0WoyNidBUuVwDMT9tekOxbXIU6tuKEZGa2E0qST1USUK1z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MLBd42LeZmeUGt5DMzCwnOCGZmVlO8O+QzMwsF8QmJyQzM8sF7rIzM7Oc4FF2ZmaWE+p5C8lPjDUzyxelkflSCUmDJX0o6WNJI7dTbqikkFRY3fDdQjIzyxOxuWa67CQ1BB4AjgMWAMWSiiJiTrlyzYCrgWk1cV0npFq0W4d+2Q4h721YNCXbIeS9TbM
"text/plain": [
"<Figure size 432x288 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"sns.heatmap(df.corr(),annot=True)"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot:xlabel='physical_score', ylabel='test_result'>"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEHCAYAAACjh0HiAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAm80lEQVR4nO3de5xcdX3/8ddn7nvPbQOYEEIggCwi4hZv1EsiCArBn5cotdpaKmpFaKlatUpI1LbW/rBg0YqK4pWieEkoiggiKpWyQQiEawy3REg2173P9dM/5sxmdndmdxJ2dsme9/Px2MfO+Z7v93s+3zNn5rMz57vnmLsjIiLhFZnuAEREZHopEYiIhJwSgYhIyCkRiIiEnBKBiEjIxaY7gAMxb948X7x48XSHISJyUFm/fv0Od28fXX5QJoLFixfT1dU13WGIiBxUzOyJSuX6akhEJOSUCEREQk6JQEQk5JQIRERCTolARCTk6jpryMyuBs4Ctrv7CRXWG3A58HpgAPhLd7+7njGJTIZCwXl8Zz/beoY4pDXF4rlNRCJWU7snd/WzrSdNfybHEXOaOHLevraFgvPYjn6e2NVPYyJGQyzC7sE0sUiUWNSIR4y8Q89glpZUnFwhTzwaZXtvmue1pcgVCuwZyNGcihK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WjWFmZ5jZw2a2ycw+WqXOSjN7wMw2mtl3a4xJREQmQWy8lWb2MuDlQLuZXVy2qhWITtS5mUWBK4HTgC3AXWa21t0fKKuzFPgY8Ap3321m8/d/GCIicqAm+kSQAJopJoyWsp8e4C019H8KsMn
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"sns.scatterplot(x='physical_score',y='test_result',data=df)"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot:xlabel='age', ylabel='test_result'>"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEGCAYAAABo25JHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAdPUlEQVR4nO3dfZRV9X3v8fd3YGBgYFBheBBQMGIijIg6S1FzWxuNReMCUiPRJE0fbGzv1cTUrHiTFaUpmjZJG29sNN7aJE1Mm1g0EYm1amIe2ppqGRTIDATlIijIwIA6w9PAwHzvH3ufw5k9+8zZA7PPnMn+vNaaxfnt/du/33c/nS/74ext7o6IiGRX1WAHICIig0uJQEQk45QIREQyTolARCTjlAhERDJu+GAHcDwmTJjgM2bMGOwwRESGlNWrV+929/ro8CGZCGbMmEFTU9NghyEiMqSY2da44To1JCKScUoEIiIZp0QgIpJxSgQiIhmnRCAiknGp3jVkZt8CrgF2uXtDzHgD7gWuBg4Af+juL6YRS3e3s2XPfnZ2dDKproYZ42upqrI+pzlypJuWHe3saO9kyrhRzJowmpbWvbR2HGJy3UgaJtexY9+hHm12HuqiuXUvOzsOMaluJGdNruXl1v358tmTa9m8+2C+zZkTavh1wfho/bMm1wL0GtbfcqW0obiG3rw1TB7L6FEjeuw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LkkvWvoRmAesNndD5jZeOCPUotKRETKJukRgQOzgU+E5VqCXxiLiMgQlzQRfB24mODhcAB7Cd48JiIiQ1zSU0MXufv5ZvYSQPh
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"sns.scatterplot(x='age',y='test_result',data=df)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Easily discover new plot types with a google search! Searching for \"3d matplotlib scatter plot\" quickly takes you to: https://matplotlib.org/3.1.1/gallery/mplot3d/scatter3d.html"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<mpl_toolkits.mplot3d.art3d.Path3DCollection at 0x19ceaf878c8>"
]
},
"execution_count": 44,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPgAAADsCAYAAABZlmuGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAABxv0lEQVR4nO2dd5xkZZX+v/dW7Jzz5NiTM8wgQQQEJMwQHMA0BMVV2BV0VVzXvLroTxR1MbuC7KorMwgSBCUJShhgmOnuyZ1mOqfq6q5ct+59f39U30tVdXV3VXVXT/dQz+czn5nprrr3VtV96j3vOc95jiSEIIMMMjg9IZ/qC8gggwzShwzBM8jgNEaG4BlkcBojQ/AMMjiNkSF4BhmcxjBP8PtMij2DDNIPKV0HzqzgGWRwGiND8AwyOI2RIXgGGZzGyBA8gwxOY2QInkEGpzEyBM8gg9MYGYJnkMFpjAzBM8jgNEaG4BlkcBojQ/AMMjiNkSF4BhmcxsgQPIMMTmNkCJ5BBqcxMgTPIIPTGBmCZ5DBaYwMwU8BhBCEQiE0TSPjaptBOjGR4UMGUwxN01AUBZ/PB4AkSVgsFiwWCyaTCUm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ZUW2wE23ocdqWQbD3pZbaC3h6WVEtl2vTlFAUkG7KimbcjKM6ATPBJ6cl2/lHirO0ya8BIBIICsvUV57jPA4skdMElEfia6rHbu3LkTymrjNfuMhXiEP3r0KLm5ucbPTkfzi9Oe4BPVtmVZxuVy8eabb0Z1gI2HRFbwUCjEwYMHMZlMrFh1KQPt9RQUnARNAgkU8wdAMqNJSxHyIoTWikRwghPHvriYv8d6XIKQ8DO/5H8ZFquA96Z2kBQ
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"from mpl_toolkits.mplot3d import Axes3D \n",
"fig = plt.figure()\n",
"ax = fig.add_subplot(111, projection='3d')\n",
"ax.scatter(df['age'],df['physical_score'],df['test_result'],c=df['test_result'])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Train | Test Split and Scaling"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [],
"source": [
"X = df.drop('test_result',axis=1)\n",
"y = df['test_result']"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [],
"source": [
"from sklearn.model_selection import train_test_split\n",
"from sklearn.preprocessing import StandardScaler"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {},
"outputs": [],
"source": [
"X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.1, random_state=101)"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [],
"source": [
"scaler = StandardScaler()"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {},
"outputs": [],
"source": [
"scaled_X_train = scaler.fit_transform(X_train)\n",
"scaled_X_test = scaler.transform(X_test)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Logistic Regression Model"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {},
"outputs": [],
"source": [
"from sklearn.linear_model import LogisticRegression"
]
},
{
"cell_type": "code",
"execution_count": 51,
"metadata": {},
"outputs": [],
"source": [
"# help(LogisticRegression)"
]
},
{
"cell_type": "code",
"execution_count": 52,
"metadata": {},
"outputs": [],
"source": [
"# help(LogisticRegressionCV)"
]
},
{
"cell_type": "code",
"execution_count": 53,
"metadata": {},
"outputs": [],
"source": [
"log_model = LogisticRegression()"
]
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"LogisticRegression()"
]
},
"execution_count": 54,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"log_model.fit(scaled_X_train,y_train)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Coefficient Interpretation\n",
"\n",
"Things to remember:\n",
"\n",
"* These coeffecients relate to the *odds* and can not be directly interpreted as in linear regression.\n",
"* We trained on a *scaled* version of the data \n",
"* It is much easier to understand and interpret the relationship between the coefficients than it is to interpret the coefficients relationship with the probability of the target/label class.\n",
"\n",
"Make sure to watch the video explanation, also check out the links below:\n",
"\n",
"* https://stats.idre.ucla.edu/stata/faq/how-do-i-interpret-odds-ratios-in-logistic-regression/\n",
"* https://stats.idre.ucla.edu/other/mult-pkg/faq/general/faq-how-do-i-interpret-odds-ratios-in-logistic-regression/\n",
"\n",
"### The odds ratio\n",
"\n",
"For a continuous independent variable the odds ratio can be defined as:"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<img src=\"https://wikimedia.org/api/rest_v1/media/math/render/svg/18dc1087bc50b9c1afee6820aad1858704b43ea3\" >"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This exponential relationship provides an interpretation for $$\\beta _{1}$$ "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The odds multiply by $${e^\\beta _{1}}$$ for every 1-unit increase in x."
]
},
{
"cell_type": "code",
"execution_count": 55,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[-0.94953524, 3.45991194]])"
]
},
"execution_count": 55,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"log_model.coef_"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This means:\n",
"* We can expect the **odds** of passing the test to **decrease** (the original coeff was negative) per unit increase of the age.\n",
"* We can expect the **odds** of passing the test to **increase** (the original coeff was positive) per unit increase of the physical score.\n",
"* Based on the ratios with each other, the physical_score indicator is a stronger predictor than age."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Model Performance on Classification Tasks"
]
},
{
"cell_type": "code",
"execution_count": 56,
"metadata": {},
"outputs": [],
"source": [
"from sklearn.metrics import accuracy_score,confusion_matrix,classification_report,plot_confusion_matrix"
]
},
{
"cell_type": "code",
"execution_count": 57,
"metadata": {},
"outputs": [],
"source": [
"y_pred = log_model.predict(scaled_X_test)"
]
},
{
"cell_type": "code",
"execution_count": 58,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.93"
]
},
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"accuracy_score(y_test,y_pred)"
]
},
{
"cell_type": "code",
"execution_count": 59,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[172, 21],\n",
" [ 14, 293]], dtype=int64)"
]
},
"execution_count": 59,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"confusion_matrix(y_test,y_pred)"
]
},
{
"cell_type": "code",
"execution_count": 60,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<sklearn.metrics._plot.confusion_matrix.ConfusionMatrixDisplay at 0x19ceb65e588>"
]
},
"execution_count": 60,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAATgAAAEGCAYAAADxD4m3AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAYvUlEQVR4nO3de5RdZZnn8e8vVQm5Q0KREEgCURMQaC5ZGS7iMIiMEMZeiG0j2NqMggHkZovdgy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ndxsz6qwbpRS3XyfA0SULr/E7OL3kvgK9UKygzq289X2u+b5UbizqpLwMxswZRJx0IWWQaySDpMOAQSu69RcSd1QrKzOpZfXQgZNFtgpN0JXAiSYJ7CJgOPA44wZn1Vw1Sg8vSi/oJklWmV0bEZ4EjgD2rGpWZ1beOjFuNZWmitkZEh6Q2SSOB1cCEKsdlZvWqCBNelpgraS/gFpKe1U3AH6sZlJnVt4bvRe0UEV9Id38s6WFgZEQ8X92wzKyuNXqCkzS13HsR8Ux1QjIzq4xyNbjvlnkvgJMqHAt7vLaFKZ/zWjeN5DfLn611CJbD0adsrsh5KtVElXQ78FFgdUQclpZ9A/g8sCY97KsR8VD63leAc0km3b00ImaXO3+5B30/1Ovozax4gkoO1boDuJ5dHzv7XkRcW1og6RDgLOBQkok/fidpSkR0OcN4lsdEzMzerULTJUXEo8D6jFc9Hbg7IrZGxGJgEXB0uQ84wZlZbopsG9AiaW7JNiPjJS6W9Lyk2yWNSsv2B5aUHLM0LeuSE5yZ5Ze9Brc2IqaVbDdnOPtNwHtJlkdYQfn+gLKyzOgrSZ+
"text/plain": [
"<Figure size 432x288 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plot_confusion_matrix(log_model,scaled_X_test,y_test)"
]
},
{
"cell_type": "code",
"execution_count": 61,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<sklearn.metrics._plot.confusion_matrix.ConfusionMatrixDisplay at 0x19ceb691b88>"
]
},
"execution_count": 61,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAATUAAAEGCAYAAAAE8QIHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAZ/0lEQVR4nO3deZxU1Z338c+3GxpQFsUG2QVHUBHX+CDoxJC4YZ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nsdo5yzQ8taPQzIuZLzQJsKE04ZlYREjxNqpCkNl/SsUBI6ghcBswqbVhmllgB0TqjnyVRSPfzAuBiMjfFLQKOyO6bWbulAre2l7elFhErgK+2QSxmVikS3P3M21KTtL+kJyQtl7RM0q8l7d8WwZlZQhU+TarNFdL9fAh4BOgL9AMeBR4uZVBmlmBNN98WspVBIUltj4j4RUTUZ7cHgc6lDszMkiuisK0cWpr72TP78qns4m0TyeTos9nuZjkza2cSPPrZ0kDBq2SSWFP038x5L8gs3GZm7ZASPFDQ0tzPIW0ZiJlViDIOAhSioBkFkkYAw8m5lhYRPy9VUGaWZOUbBChEIRPabySzQNtwMtfSTgWeB5zUzNqrBLfUChn9PBM4AVgSEd8ADgd6lDQqM0u2xgK3Miik+7kpIhol1UvqDiyj+WqVZtaetN4ikSVRSFKbLmkv4B4yI6LrgRdLGZSZJVtFjn42yVkM8i5JTwPdI+Kt0oZlZolWiUlN0lEtvRcRr5UmJDOzXddSS+2WFt4L4HOtHAvz3+7KFYNHt3a1VkJTFk0pdwhWhJGnrGuVeiqy+xkRn23LQMysQgQVO03KzGz
"text/plain": [
"<Figure size 432x288 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# Scaled so highest value=1\n",
"plot_confusion_matrix(log_model,scaled_X_test,y_test,normalize='true')"
]
},
{
"cell_type": "code",
"execution_count": 62,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" precision recall f1-score support\n",
"\n",
" 0 0.92 0.89 0.91 193\n",
" 1 0.93 0.95 0.94 307\n",
"\n",
" accuracy 0.93 500\n",
" macro avg 0.93 0.92 0.93 500\n",
"weighted avg 0.93 0.93 0.93 500\n",
"\n"
]
}
],
"source": [
"print(classification_report(y_test,y_pred))"
]
},
{
"cell_type": "code",
"execution_count": 63,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"age 32.0\n",
"physical_score 43.0\n",
"Name: 141, dtype: float64"
]
},
"execution_count": 63,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"X_train.iloc[0]"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y_train.iloc[0]"
]
},
{
"cell_type": "code",
"execution_count": 65,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[0., 1.]])"
]
},
"execution_count": 65,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# 0% probability of 0 class\n",
"# 100% probability of 1 class\n",
"log_model.predict_proba(X_train.iloc[0].values.reshape(1, -1))"
]
},
{
"cell_type": "code",
"execution_count": 66,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([1], dtype=int64)"
]
},
"execution_count": 66,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"log_model.predict(X_train.iloc[0].values.reshape(1, -1))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Evaluating Curves and AUC\n",
"\n",
"**Make sure to watch the video on this!**"
]
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {},
"outputs": [],
"source": [
"from sklearn.metrics import precision_recall_curve,plot_precision_recall_curve,plot_roc_curve"
]
},
{
"cell_type": "code",
"execution_count": 68,
"metadata": {},
"outputs": [],
"source": [
"y_score = log_model.decision_function(X_test)"
]
},
{
"cell_type": "code",
"execution_count": 69,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(500,)"
]
},
"execution_count": 69,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y_score.shape"
]
},
{
"cell_type": "code",
"execution_count": 70,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<sklearn.metrics._plot.precision_recall_curve.PrecisionRecallDisplay at 0x19cec76dac8>"
]
},
"execution_count": 70,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAEGCAYAAABy53LJ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hV0l6FFBwRd0dERURU9OzZs6iV3hYepjKz1iLNoarlwJ45672TtDoRsYKkxyGpM3BaRKxJti1Pfi6WNBM4CHgC6CqpQ9Lr2KLMcpN7OqKZWWuQZuCYDeyTnAW1HDiTf85NACCpB7A6IjYB3yFzhhWSugHrI+LDZJ+hwH9GREiaAXyJzJlV5wI/T7EN260t3ezOzNqG1Iaqkh7B14DpwELgsYiYL2mipOxZUkcCb0j6E/BJ4PtJ+meBKklzyUya3xgR2Un1q4ErJC0iM+dxT1ptMDOzLaV6HUdETAOm1Usbn7P8OPB4A/n+Dxi4lTIXkzljy8zMSsBXjpuZNZP6N2dsqVeRl/qsKjOzNmnByrUt9vG7DhxmZs3k8L17cPjePfjZxUPqrihviTxUZWbWTOrfnHHWktU8PGtZixuuco/DzKwEstd2tcThKgcOM7MSGF3Zp8Xev86Bw8zMCuLAYWZmBfHkuJlZmcg+JTBXOV7r4cBhZlYi9S8IrP/snnJ9ZrkDh5lZmajsv/tmPYzsI2dH3vVSWfU8HDjMzErk8L17AFte31FftifiwGFm1sY1FTCy13pkA0e58FlVZmZlanRlH3528RCAuiGrh2ctK3GtHDjMzFqMcrkxooeqzMzKXHYu5OONm0pckwz3OMzMytxDF1TWzYdkb4xYSqkGDknDJb0haZGksQ1s7yvpeUnzJM2U1DtJHyTpJUnzk20jc/LcJ2mJpOrkNSjNNpiZlYtyuTFiaoFDUntgMnACMAAYJWlAvd1uBh6IiAOAicA
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plot_precision_recall_curve(log_model,scaled_X_test,y_test)"
]
},
{
"cell_type": "code",
"execution_count": 71,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<sklearn.metrics._plot.roc_curve.RocCurveDisplay at 0x19ceb5c4288>"
]
},
"execution_count": 71,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAA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XKdAIws3eIdG09zt3nlt6RmV0HXAfQrl27aoYlIiLRYhq8PkRpQEegHzASeNLMmpYu5O5T3D3L3bNatmwZ3whFROq4MBPBBiK3nxZrEyyLlg/Mcve97r4G+IRIYhARkTiJKRGYWX0zO7GK+84BOppZezOrB1wOzCpV5m9EagOYWQsil4pWV/E4IiJSDZUmAjP7EZALzA3mu5tZ6S/0g7h7ETAamAesAqa7+woze8DMLgqKzQO2mtlKIBu4K9HPKWzftYfPNhckMgQRkbiKpdO5cUTuAHoTwN1zzax9LDt39znAnFLLfhU17cDtweuw0H/8m3y9K9LhanpaoptQRETCF1M31O6+w+yAMbo8pHgS7utdexnU+Wh+2juTI9UFtYgkgVgSwQozuwJIDR4Auxl4N9ywEqvT0Y3peXzzRIchIhIXsVz7uInIeMW7gReJdEd9a4gxiYhIHMVSIzjJ3e8F7g07GBERib9YagT/Y2arzOxBM+sSekQiIhJXlSYCd+9PZGSyLcAfzOxDM7sv9MhERCQuYro/0t2/cPdJwPVEnin4VcVbiIhIbRHLA2Unm9k4M/uQyOD17xLpLkJEROqAWBqLnwH+Apzv7htDjkdEROKs0kTg7r3iEYiIiCRGuYnAzKa7+/DgklD0k8QxjVAmIiK1Q0U1gluCv4PjEYiIiCRGuY3F7r4pmLzB3T+PfgE3xCc8EREJWyy3j55XxrILajoQERFJjIraCH5B5Jf/8Wa2LGpVY+CdsAMTEZH4qKiN4EXgVeAhYEzU8p3uvi3UqEREJG4qSgTu7mv
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plot_roc_curve(log_model,scaled_X_test,y_test)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"------\n",
"------"
]
}
],
"metadata": {
"anaconda-cloud": {},
"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.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 1
}