{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "Mission730Solutions.ipynb", "provenance": [] }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "markdown", "source": [ "# Purpose of Notebook\n", "\n", "The purpose of this notebook is to offer as a an example answer to the Guided Project for Linear Regression in Python course. Since the choice of model predictors is up to the student, results can differ. Use this solution as a guide to how to structure your own answer." ], "metadata": { "id": "OsSvDQ0Y3yNk" } }, { "cell_type": "code", "source": [ "import pandas as pd\n", "import numpy as np\n", "from sklearn.linear_model import LinearRegression\n", "from sklearn.metrics import mean_squared_error, r2_score\n", "from sklearn.model_selection import train_test_split" ], "metadata": { "id": "lmpsg5fi4t8d" }, "execution_count": 1, "outputs": [] }, { "cell_type": "code", "source": [ "# Load in the insurance dataset\n", "insurance = pd.read_csv(\"insurance.csv\")" ], "metadata": { "id": "y6aqBHg-5cJT" }, "execution_count": 2, "outputs": [] }, { "cell_type": "markdown", "source": [ "# Exploring The Dataset" ], "metadata": { "id": "wS1GbH1g7ta5" } }, { "cell_type": "code", "source": [ "# Columns in the dataset\n", "insurance.columns" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "JuqpqwPd5l6d", "outputId": "470c6b14-184b-4489-e151-0a6cfe235d08" }, "execution_count": 3, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "Index(['age', 'sex', 'bmi', 'children', 'smoker', 'region', 'charges'], dtype='object')" ] }, "metadata": {}, "execution_count": 3 } ] }, { "cell_type": "markdown", "source": [ "The `charges` column is our outcome, while everything else are the potential predictors to use in the model" ], "metadata": { "id": "M5zR7HAr8tsb" } }, { "cell_type": "code", "source": [ "insurance.hist(\"charges\")" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 316 }, "id": "SMObDGAlOci0", "outputId": "82673471-fdbe-48fe-fc14-5974fab5f95f" }, "execution_count": 4, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "array([[]],\n", " dtype=object)" ] }, "metadata": {}, "execution_count": 4 }, { "output_type": "display_data", "data": { "text/plain": [ "
" ], "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEICAYAAACktLTqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAVTklEQVR4nO3df7BndX3f8edLVpCyyoLQ2xW2LlZqxkiDcIM4puldGRNAGpyOsVgTgZLZToKNGWnjmszUJtMfaGqMTFLjRoxrJ8lKUQMFbSTopnE6oGxUFkTK8qvuDrKiQFz8UdF3/7ifNd+93N3vvdyf55PnY+Y795zP+ZzzfX/u9/C63/2c7/eQqkKS1JdnrHQBkqTFZ7hLUocMd0nqkOEuSR0y3CWpQ4a7JHXIcFe3klyS5DMrXYe0Egx3SeqQ4S7NQZI1K12DNB+Gu7qQZEOSjyb5WpKvJ/ndkW3/JcmjSe5Pct5I+6VJ7kryzST3JflXI9umkuxJ8tYkXwX+MMnRSba1Y92V5FeT7BnZ53lJPtJquD/JL49sOyvJbUn+OsnDSX57GX4t+lvMcNfgJTkCuAF4ENgInARsb5tfBtwNnAC8E7g6Sdq2fcAFwHOAS4F3Jzlj5NB/DzgeeD6wGXh7O/4LgFcBPzdSwzOA/wF8sT3/OcCvJPnp1uU9wHuq6jnAPwCuWZTBS4dguKsHZwHPA/5tVT1RVd+pqgMXUh+sqj+oqu8D24D1wARAVd1YVffWtL8APgn845Hj/gB4e1V9t6q+DbwO+E9V9WhV7QGuGun748CJVfWbVfX/quo+4A+Ai9r27wEvTHJCVe2vqluW5DchNYa7erCB6RB/cpZtXz2wUFXfaotrAZKcl+SWJN9I8hhwPtPv8A/4WlV9Z2T9ecBXRtZHl58PPC/JYwcewK/R/pAAlwH/EPhyks8luWD+w5TmzotE6sFXgL+fZM0hAv4pkhwFfAR4I3BdVX0v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6QOGe6S1CHDXZI6ZLhLUof+P+/jGHQlmobrAAAAAElFTkSuQmCC\n" }, "metadata": { "needs_background": "light" } } ] }, { "cell_type": "markdown", "source": [ "The `charges` column is highly skewed to the right. Extremely costly insurance charges are more common than extremely small ones. This makes it unlikely that the errors in the model will truly be centered at zero. It might be worth it to log-transform the outcome." ], "metadata": { "id": "5rSOAfQHOr_8" } }, { "cell_type": "code", "source": [ "insurance[\"log_charges\"] = np.log2(insurance[\"charges\"])\n", "\n", "insurance.hist(\"log_charges\")" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 316 }, "id": "FG2IyzGFPHF2", "outputId": "c0f8e3d8-57fd-4467-e164-6797960c871f" }, "execution_count": 5, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "array([[]],\n", " dtype=object)" ] }, "metadata": {}, "execution_count": 5 }, { "output_type": "display_data", "data": { "text/plain": [ "
" ], "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEICAYAAACktLTqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAATr0lEQVR4nO3df7DldX3f8edLiQTZFKSLt7hsc60saZCNTLgl2KQzd0MmIjpZaBMGyxhQM+uk2Il1U7NqapxY2m0USTM2pOvAQKJxZaIGIpiIjLfUmVAFhrggWrZ6UTbLMhQEVi3twrt/nC/Jye79tfece8+5H5+PmTP3+/18v+f7fb+5e1/3ez/new6pKiRJbXnBqAuQJA2f4S5JDTLcJalBhrskNchwl6QGGe6S1CDDXWMpyWySn1vlc04mqSTHrOZ5pZVguEtSgwx3aQV49a9RM9w11pIcm+R3k/x19/jdJMf2bX9nkv3dtl/pplVOW+SYxyW5KslDSZ5M8sUkx/XtcmmSbyV5LMl7+p53TpK/TPKd7pwfTvKivu2V5IokDwIPLlZf19sHu3MdSP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ILRlnj0Zrve5TkX3c/R/cn+Z1BzjF24Q5cD5x/2NgO4Paq2gTc3q2vJddzZE/3Af8cuGPVqxnc9RzZz23AmVX1E8D/BN612kUN4HqO7OcDVfUTVXUW8Bngvate1fJdz5H9kGQj8PPAt1a7oAFdzxz9AFdX1Vnd49ZVrmlQ13NYT0m20Hsn/6uq6pXABwc5wdiFe1XdATx+2PBW4IZu+QbgwlUtakBz9VRVD1TVYu/KHUvz9PO5qjrUrd5J770Na8I8/TzVt3o8sGbuPJjnZwjgauCdrKFeYMF+1qx5evpVYGdVPdPt8+gg5xi7cJ/HRFXt75YfASZGWYwW9Wbgs6MuYlBJrkzybeBS1taV+xGSbAX2VdVfjbqWIXpbN3V23Vqbqp3H6cA/S/I/kvy3JP9kkIOtlXD/G9W7d3NNXXn8IEnyHuAQ8LFR1zKoqnpPVW2k18vbFtt/XCV5MfBu1vgvqMNcA7wCOAvYD1w12nKG4hjgJOBc4N8CNybJcg+2VsL9QJJTALqvA/25opWR5HLg9cCl1dYbKD4G/ItRFzGAVwAvB/4qySy9KbN7kvyDkVY1gKo6UFXPVtVzwEfofRLtWvcw8Knq+RLwHL0PE1uWtRLuNwOXdcuXATeNsBbNIcn59OZzf6GqvjfqegaVZFPf6lbga6OqZVBVtaeqXlpVk1U1SS9EfrKqHhlxacv2/MVe5yJ6NyisdX8KbAFIcjrwIgb51MuqGqsH8HF6f2b9P3r/CN8C/H16d8k8CHweOGnUdQ6hp4u65WeAA8BfjLrOAfvZC3wbuLd7/MGo6xywn0/SC4yvAH8GbBh1nYP0c9j2WWD9qOsc8PvzR8Ce7vtzM3DKqOscQk8vAj7a/bu7B/jZQc7hxw9IUoPWyrSMJOkoGO6S1CDDXZIaZLhLUoMMd0lqkOEuSQ0y3CWpQf8fj+ORkw6jsrgAAAAASUVORK5CYII=\n" }, "metadata": { "needs_background": "light" } } ] }, { "cell_type": "markdown", "source": [ "The log-transformed `charges` values are more centered, which is what we wanted. This makes it more likely that the errors will be unbiased." ], "metadata": { "id": "sFiFbsCUQHv8" } }, { "cell_type": "code", "source": [ "# Checking the correlation between the continuous columns in the insurance data\n", "insurance.corr()" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 206 }, "id": "uSRq96HH8AAR", "outputId": "ace3b1fc-0cbc-4cce-b57e-38b26b1dbfe7" }, "execution_count": 6, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ " age bmi children charges log_charges\n", "age 1.000000 0.109272 0.042469 0.299008 0.527834\n", "bmi 0.109272 1.000000 0.012759 0.198341 0.132669\n", "children 0.042469 0.012759 1.000000 0.067998 0.161336\n", "charges 0.299008 0.198341 0.067998 1.000000 0.892964\n", "log_charges 0.527834 0.132669 0.161336 0.892964 1.000000" ], "text/html": [ "\n", "
\n", "
\n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
agebmichildrenchargeslog_charges
age1.0000000.1092720.0424690.2990080.527834
bmi0.1092721.0000000.0127590.1983410.132669
children0.0424690.0127591.0000000.0679980.161336
charges0.2990080.1983410.0679981.0000000.892964
log_charges0.5278340.1326690.1613360.8929641.000000
\n", "
\n", " \n", " \n", " \n", "\n", " \n", "
\n", "
\n", " " ] }, "metadata": {}, "execution_count": 6 } ] }, { "cell_type": "markdown", "source": [ "## Comments on correlation\n", "\n", "`age` has 30% correlation with `charges`, `bmi` has 19.8% correlation, and number of children has 6.7% correlation." ], "metadata": { "id": "-ghJAB_59B9Z" } }, { "cell_type": "code", "source": [ "insurance.boxplot(column = [\"log_charges\"], by = \"sex\")" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 373 }, "id": "amZ_91bU8352", "outputId": "dec66ac2-8799-432a-9aa5-344d5a6eaac6" }, "execution_count": 7, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "/usr/local/lib/python3.7/dist-packages/matplotlib/cbook/__init__.py:1376: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.\n", " X = np.atleast_1d(X.T if isinstance(X, np.ndarray) else np.asarray(X))\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "" ] }, "metadata": {}, "execution_count": 7 }, { "output_type": "display_data", "data": { "text/plain": [ "
" ], "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAAEcCAYAAAAmzxTpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAX3klEQVR4nO3de5RkVWHv8e+PhyiMFyEjHUeE4e0DhEirIUuXzZWrszAG0WUMokJAx0fUG5X4AgUvmhCJ0cRc4x0WOLAgo8YYo0xECNKOGggOymMIiC/QEWTAEWTEGIF9/zinsaipflf1g/39rHVWV53X3lV9+te79tl1TkopSJIe3raZ7wpIkgbPsJekChj2klQBw16SKmDYS1IFDHtJqoBhr3mVpCTZd77rMZ+SjCTZOMHy6t8jzZ5hLwCS3Jzkl0m2JPlZkrVJnjDf9RqT5PgkX5vvekiLlWGvTi8spSwBHgfcDnx0nuszMEm2m+86SHPJsNdWSin/BXwGePLYvCQ7JzkvyR1JbklySpJtkuyaZGOSF7brLUny3SSvap+vTvLxJJckuSfJV5Ls2avcCcp4EvBx4LD2k8dd42y/V5J1bTn/luT/Jjm/Xba87Q45MckPgS+3+z6lLWtTW/bO7fpbda20n36OaB+fluQzST7VlvfNJAd3rLssyT+1r+UHSd7csexR7fvysyT/CTx9C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lqQKGvSRVwLCXpAoY9pJUgf8PKMquRaXcha4AAAAASUVORK5CYII=\n" }, "metadata": { "needs_background": "light" } } ] }, { "cell_type": "code", "source": [ "insurance.boxplot(column = [\"log_charges\"], by = \"smoker\")" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 373 }, "id": "9_gIr-7AJ1Uo", "outputId": "61cfc34b-4718-429c-ff27-2e9ee9e39d22" }, "execution_count": 8, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "/usr/local/lib/python3.7/dist-packages/matplotlib/cbook/__init__.py:1376: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.\n", " X = np.atleast_1d(X.T if isinstance(X, np.ndarray) else np.asarray(X))\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "" ] }, "metadata": {}, "execution_count": 8 }, { "output_type": "display_data", "data": { "text/plain": [ "
" ], "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAAEcCAYAAAAmzxTpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAY2ElEQVR4nO3de5RkZX3u8e/DTYdLBs1gR0SZiIgICGpjQoKmDcTMAT14TzhHhYAZo4kHjUbGeMEbCkGPJkZDxjhnwMtElpGjMkcECc3oEi8DARmCEYUBRi4jIkgDKpf3/LF3Y9F0T1fXVHVPz/v9rFVrqvbt/dWumqd3vfutXSmlIEnaum0z1wVIkgbPsJekChj2klQBw16SKmDYS1IFDHtJqoBhr75KUpI8aa7rmEtJRpJs2MT8ebWP5lu9mpxhv5VKsj7JPUnGkvwsyeokj5/rusYlOTbJN+a6DqkWhv3W7QWllJ2BxwK3AB+d43oGJsl2c12DpubrM/c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KMJDlnruuQemXYSwOWxO+zaM4Z9toqTXYlxSTrk3wgyWVJ1iZ5RpKvJvlRkr9o10uS09p1rpjsCoxJDk7yH0n2SvLMJBcluaTd1mPbZUaTfCTJWuCEWX760sN4xKGt1fiVFI8ESLIQOBW4vpRyUJIPAyuB3wceCawDTgdeTHNFxgOBRcB3k6wZ32iS3wM+ChwF3AR8CjiqlPKT9g/DycBx7eI7lFKGB/1EpW4Y9tpaXQF8KMmpwDmllK+3X9H/Usf8nUspdwJ3Jvllkl2BQ4FV7df7b0lyEc21XX4O7EvzQ9nPK6XcmGR/YH/g/Hbb29L8ARj3uYE/S6lLhr22SqWUH0y8kmI7a/yKoQ/w0KuHPsD0/x9uovkU8HTgRiDAlaWUQ6ZY/q5eapcGwT57bZU240qKXwf+JMm2SXaj+V2A77TzbgeOBD6QZAT4L2C3JIe0bW6fZL8+Pg2pbzyy19bqAB5+JcXPd7He2cAhwOVAAd5SSrk5yVMASim3JHk+8BWavvmXAv/QnhPYDvgIcGW/n4y0ubw2jiRVwG4cSaqAYS9JFTDsJakChr0kVcCwl6QKGPaSVAHDXpIqYNhLUgX+P0SoQUpAGvq7AAAAAElFTkSuQmCC\n" }, "metadata": { "needs_background": "light" } } ] }, { "cell_type": "code", "source": [ "insurance.boxplot(column = [\"log_charges\"], by = \"region\")" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 373 }, "id": "Z5-n30hmKH_Y", "outputId": "aeabd663-0781-432c-954f-7ce33dc5c4f0" }, "execution_count": 9, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "/usr/local/lib/python3.7/dist-packages/matplotlib/cbook/__init__.py:1376: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.\n", " X = np.atleast_1d(X.T if isinstance(X, np.ndarray) else np.asarray(X))\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "" ] }, "metadata": {}, "execution_count": 9 }, { "output_type": "display_data", "data": { "text/plain": [ "
" ], "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAAEcCAYAAAAmzxTpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAcnUlEQVR4nO3deZxkVX338c+XRbYhLI72yxGlZRWigcdpfcRI7HkwyIMQxBgNjwojxhFNNKhEIaICbhA0+IpGcZBxIJgB3IVJkEXawQQUhiCLuMKgA8qIA0izyPZ7/jinmUtN91RNz71dy/m+X6969a17b91z6lfVvzp1zql7FRGYmdlg26jbFTAzs+Y52ZuZFcDJ3sysAE72ZmYFcLI3MyuAk72ZWQGc7K0xkkLSLt2uRzdJGpW0ch3bezJGkk6X9IFu18Pq42RfAEkrJD0oaVzS3ZKWSnpWt+s1QdJ8Sd/rdj1sjYg4KiI+3O16WH2c7MtxcETMAp4B3Al8usv1aYykTbpdh25zDKyVk31hIuIh4CvAnhPrJG0j6WxJv5V0m6TjJW0kaXtJKyUdnPebJennkg7P9xfnr/uXSLpP0ncl7ThZuesoYw/gdGCf/M3jnike/xxJy3I5l0r6V0nn5G3DuTvkzZJ+CXwnH/v4XNaqXPY2ef+1ulbyt5+X5+UTJH1F0nm5vGsl7VXZd46kr+bncqukd1a2bZHjcrekHwEv7OBlOVDSLZLuknRqrvtTJK2W9PzKsZ8u6QFJT5skPvMl/Zek0yT9DjhB0maSPiHpl5LuzK/VFpXHvFfSryXdIelvql1K+Tl8pLLvW/Jrv1rStyTNqWwLSUdJ+pmke/Jrow6et80gJ/vCSNoSeB1wVWX1p4FtgJ2AlwGHA2+KiNXAkcAZkp4OnAZcFxFnVx77euDDwGzgOuBLUxQ9VRk3A0cBV0bErIjYdorH/zvwA+CpwAnAGyfZ52XAHsArgPn5Ni+XOQv4zBT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ogXAJ8j/YzerGc42VspbouIq5j6bJB/CnwzIh6KiPtIP6FvtTvrPqPiZGf3NOsJg3puHLNWE2fmnOpskEfXUMZkZ/c06wlu2Vtppjob5H8BB0vaPG87aJLH/oSpz6ho1tPc+rCiTHU2yIi4WtK3SFfkupN0UYx7Wx77kKQ3MfkZFc16mqdemmWSZkXEeD6N8zLS9Vmv7Xa9zOrglr3ZGgvzJec2J11xyIneBoZb9mZmBfAArZlZAZzszcwK4GRvZlYAJ3szswI42ZuZFcDJ3sysAP8fkXGRrJCIF6QAAAAASUVORK5CYII=\n" }, "metadata": { "needs_background": "light" } } ] }, { "cell_type": "code", "source": [ "insurance.boxplot(column = [\"log_charges\"], by = \"region\")" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 373 }, "id": "lVogyvIOKK6o", "outputId": "30499162-adaf-4260-f26d-b650759d4b73" }, "execution_count": 10, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "/usr/local/lib/python3.7/dist-packages/matplotlib/cbook/__init__.py:1376: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.\n", " X = np.atleast_1d(X.T if isinstance(X, np.ndarray) else np.asarray(X))\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "" ] }, "metadata": {}, "execution_count": 10 }, { "output_type": "display_data", "data": { "text/plain": [ "
" ], "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAAEcCAYAAAAmzxTpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAcnUlEQVR4nO3deZxkVX338c+XRbYhLI72yxGlZRWigcdpfcRI7HkwyIMQxBgNjwojxhFNNKhEIaICbhA0+IpGcZBx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, { "cell_type": "markdown", "source": [ "## Comments on plots\n", "\n", "Males seem to have a wider distribution of charges compared to women. Smokers have much higher costs than non-smokers. There doesn't seem tobe many appreciable differences between regions. " ], "metadata": { "id": "EcQUy2RaKPNh" } }, { "cell_type": "markdown", "source": [ "# Dividing The Data\n", "\n", "Based on the univariate relationships shown above, `age`, `bmi` and `smoker` are positively associated with higher `charges`. We'll include these predictors in our final model." ], "metadata": { "id": "Q4f6SIK8Kv-k" } }, { "cell_type": "code", "source": [ "# Splitting the data up into a training and test set\n", "insurance[\"is_smoker\"] = (insurance[\"smoker\"] == \"yes\")\n", "X = insurance[[\"age\", \"bmi\", \"is_smoker\"]]\n", "y = insurance[\"log_charges\"]\n", "\n", "# 75% for training set, 25% for test set\n", "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.25, \n", " random_state = 1)" ], "metadata": { "id": "lihP2kTALKL-" }, "execution_count": 11, "outputs": [] }, { "cell_type": "markdown", "source": [ "# Build The Model" ], "metadata": { "id": "YE-XKUr_428I" } }, { "cell_type": "code", "source": [ "# Training and checking model performance on training set\n", "insurance_model = LinearRegression()\n", "insurance_model.fit(X_train, y_train)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "jCHcD-PcLfxu", "outputId": "93957439-f797-4f85-e5fc-1149ae619dd0" }, "execution_count": 12, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "LinearRegression()" ] }, "metadata": {}, "execution_count": 12 } ] }, { "cell_type": "markdown", "source": [ "" ], "metadata": { "id": "r9pR9V2TOYdT" } }, { "cell_type": "code", "source": [ "# Get predicted values by model\n", "y_pred = insurance_model.predict(X_train)\n", "\n", "# MSE on the log scale for the insurance charges\n", "mean_squared_error(y_train, y_pred)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "WY4gnJJpMqNN", "outputId": "ac7676db-6ccf-4b35-aa30-d81905dac57d" }, "execution_count": 13, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "0.4546665339270644" ] }, "metadata": {}, "execution_count": 13 } ] }, { "cell_type": "code", "source": [ "# MSE on the original scale for the insurance charges\n", "np.exp(mean_squared_error(y_train, y_pred))" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "YvUvASEyQ0aN", "outputId": "5f99b5a4-317f-47cc-93b1-8d22464612a6" }, "execution_count": 14, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "1.575647870310887" ] }, "metadata": {}, "execution_count": 14 } ] }, { "cell_type": "code", "source": [ "# Coefficient of determination\n", "r2_score(y_train, y_pred)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "tOFi1oxFRFPk", "outputId": "351d9bd3-2b78-4ff0-fec0-f5ca559b5d1c" }, "execution_count": 15, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "0.7421118855283421" ] }, "metadata": {}, "execution_count": 15 } ] }, { "cell_type": "markdown", "source": [ "## Comments\n", "\n", "The training MSE for the model is 0.454 and is 1.57 on the original scale. The $R^2$ indicates that the model can explain 74% of the variation in the log-insurance charges. These preliminary results are promising, but we must remember that these are optimistic values." ], "metadata": { "id": "70BciwrTQucW" } }, { "cell_type": "markdown", "source": [ "# Residual Diagnostics" ], "metadata": { "id": "Op2iO4grSZBZ" } }, { "cell_type": "code", "source": [ "# Quick visual check of residuals\n", "check = pd.DataFrame()\n", "check[\"residuals\"] = y_train - y_pred\n", "check[\"fitted\"] = y_pred\n", "\n", "check.plot.scatter(x = \"fitted\", y = \"residuals\")" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 296 }, "id": "dLCBNJMuNb-x", "outputId": "626a7509-6890-4932-cd42-8b443001d99f" }, "execution_count": 16, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "" ] }, "metadata": {}, "execution_count": 16 }, { "output_type": "display_data", "data": { "text/plain": [ "
" ], "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEGCAYAAABsLkJ6AAAABHNCSVQICAgIfAhkiAAAAAlw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TMzbBTGMC7wDYBgbsWrs3TDK9PfGXnsRwFoAC2Pa9bcAaIeh4TQJhpjfXQAuFUKYE/7NsY/8FYBrhRCt+b0ShkkOS0EwTHY4EcBEHJH1UAG8H+vyNiKmBw8AvwHwhcIMkWESYQPAMNmBAHQJIc5MeLGM23wypQ+7gBjGOwcBDHX5+Q0ARxHRmQBARH4iahFC7AOwj4imxo6bk7fRMkwK2AAwjHd+C2AhEb1ORMfD6PN6LxF1wHD5XArgFiLqBNAB4J9j7/sGgHtix+W14QfDJIOzgBiGYSoU3gEwDMNUKGwAGIZhKhQ2AAzDMBUKGwCGYZgKhQ0AwzBMhcIGgGEYpkJhA8AwDFOh/H/3pTIHjvpzFQAAAABJRU5ErkJggg==\n" }, "metadata": { "needs_background": "light" } } ] }, { "cell_type": "markdown", "source": [ "The residuals suggest some violations to the assumptions of linear regression. As fitted values get larger, the residuals trend downward. We expect an even band, centered around zero. This does not necessarily make the model predictions unusable, but it puts into question the linear regression assumptions." ], "metadata": { "id": "PW19C6k5TgUS" } }, { "cell_type": "markdown", "source": [ "# Interpreting The Model" ], "metadata": { "id": "2NpUAgXgUI0Z" } }, { "cell_type": "code", "source": [ "# Getting the non-intercept coefficients\n", "insurance_model.coef_" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "YmfjKyIjSqr-", "outputId": "7e388b83-ffb1-4116-c711-7aabea9312d5" }, "execution_count": 17, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "array([0.04892865, 0.01523672, 2.23063344])" ] }, "metadata": {}, "execution_count": 17 } ] }, { "cell_type": "markdown", "source": [ "- A year increase in the subject is associated with a 0.04 increase in the log charges, holding smoking status and bmi constant. About a 4% increase in the charges on the regular scale.\n", "- A unit increase in the subject BMI is associated with a 0.01 increase in the log charges, holding smoking status and age constant. About a 1.5% increase in the charges on the regular scale.\n", "- A smoker is associated with a 2.23 increase in the log charges, holding age and bmi constant. About a 930% increase in the charges on the regular scale.\n", "\n", "Note: we are not concerned about if these changes are *statistically significant*, so we don't know if these associations are truly non-zero. Our primary goal is prediction." ], "metadata": { "id": "guf4YyvQVSfq" } }, { "cell_type": "markdown", "source": [ "# Final Model Evaluation" ], "metadata": { "id": "aYOK6CucWXBB" } }, { "cell_type": "code", "source": [ "# Getting MSE on test model\n", "test_pred = insurance_model.predict(X_test)\n", "\n", "mean_squared_error(y_test, test_pred)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "tXrcpejXUNDv", "outputId": "fbbab0a6-4446-4b35-8626-dc4a5d47dd76" }, "execution_count": 18, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "0.4355350875308211" ] }, "metadata": {}, "execution_count": 18 } ] }, { "cell_type": "code", "source": [ "# Putting the outcome (in log-terms) back into the original scale\n", "np.exp(mean_squared_error(y_test, test_pred))" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "NjH8j9ZPXDHv", "outputId": "001d7c0a-70db-4be3-8a1d-84521e71ac8b" }, "execution_count": 20, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "1.545789970635098" ] }, "metadata": {}, "execution_count": 20 } ] }, { "cell_type": "markdown", "source": [ "# Drawing Conclusions\n", "\n", "The test MSE was about 0.435, while the training MSE was about 0.454. In this case, the two errors match up pretty well, so we can conclude that the model is not overfit. The residuals suggest that the model is predicting much lower costs for subjects who were actually charged much higher. Therefore the model struggles with these higher costs. As a whole, the model predictions are too conservative. \n", "\n", "We might improve the model by including more complex terms in the regression, such as interactions or quadratic terms. " ], "metadata": { "id": "iZcGg2tgWpGx" } }, { "cell_type": "code", "source": [ "" ], "metadata": { "id": "sMKpzdDG5B7_" }, "execution_count": 19, "outputs": [] } ] }