Machine Learning

profileelcinkara
Lab06RidgeRegressionandLasso-20210519T193913Z-001.zip

Lab06 Ridge Regression and Lasso/Lab06 Ridge Lasso Homework.ipynb

{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Lab06 Ridge Lasso Homework" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Using College100.csv file, test out the ridge regression and the lasso approaches for 'Grad_Rate' as response y, and display the coefficients, alpha, the Mean Square Errors (MSEs) for the lowest MSE values of each approach. Drop the column \"College' and 'Private\" from the College100.csv data since these are not necessary for data analysis. You don't need to plot alpha-weights diagram here.\n", "\n", "Save your work file as \"Lab06 Homework (your first name).ipynb\" and post it to the WK11 Assignment." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# Import all necessary software packages to run Ridge Regression and Lasso. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Read College100.csv and drop the columns \"College' and 'Private\"\n", "# Hint: Use drop(['College', 'Private'], axis = 1) " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "# Define output y variable to Grad_r\\Rate and X variable with the remaining columns\n", "# Convert all X columns to float64 type numbers by using .astype('float64')." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Run the following commands\n", "# alphas represent lambda in Ridge Regression. alpha values range very big to very small.\n", "alphas = 10**np.linspace(10,-2,100)*0.5\n", "# Split data into training and test sets\n", "X_train, X_test , y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=1)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Run Ridge Regression for alpha = 0 and print fitted coefficients and MSE value.\n", "# This is the result of regular Linear Regression." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Find the best fitting alpha by using ridgecv cross validation, and print its MSE \n", "# and coefficients." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Find the best fitting alpha by using lassocv cross validation, and print its MSE \n", "# and coefficients." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "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": 4 }

Lab06 Ridge Regression and Lasso/Lab06 Ridge Regression Lasso.ipynb

{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# 6.6: Ridge Regression and the Lasso" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "\n", "import pandas as pd\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "\n", "from sklearn.preprocessing import scale \n", "from sklearn.model_selection import train_test_split\n", "from sklearn.linear_model import Ridge, RidgeCV, Lasso, LassoCV\n", "from sklearn.metrics import mean_squared_error" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We will use the sklearn package in order to perform ridge regression and the lasso. The main functions in this package \n", "that we care about are Ridge(), which can be used to fit ridge regression models, and Lasso() which will fit lasso models. \n", "They also have cross-validated counterparts: RidgeCV() and LassoCV(). We'll use these a bit later.\n", "\n", "Before proceeding, let's first ensure that the missing values have been removed from the data, as described in the previous lab." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "<class 'pandas.core.frame.DataFrame'>\n", "Int64Index: 263 entries, 1 to 321\n", "Data columns (total 20 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 AtBat 263 non-null int64 \n", " 1 Hits 263 non-null int64 \n", " 2 HmRun 263 non-null int64 \n", " 3 Runs 263 non-null int64 \n", " 4 RBI 263 non-null int64 \n", " 5 Walks 263 non-null int64 \n", " 6 Years 263 non-null int64 \n", " 7 CAtBat 263 non-null int64 \n", " 8 CHits 263 non-null int64 \n", " 9 CHmRun 263 non-null int64 \n", " 10 CRuns 263 non-null int64 \n", " 11 CRBI 263 non-null int64 \n", " 12 CWalks 263 non-null int64 \n", " 13 League 263 non-null object \n", " 14 Division 263 non-null object \n", " 15 PutOuts 263 non-null int64 \n", " 16 Assists 263 non-null int64 \n", " 17 Errors 263 non-null int64 \n", " 18 Salary 263 non-null float64\n", " 19 NewLeague 263 non-null object \n", "dtypes: float64(1), int64(16), object(3)\n", "memory usage: 43.1+ KB\n" ] } ], "source": [ "# Read Hitter.csv and remove the missing values\n", "df = pd.read_csv('Hitters.csv').dropna().drop('Player', axis = 1)\n", "df.info()\n", "dummies = pd.get_dummies(df[['League', 'Division', 'NewLeague']]) \n", "# Convert categorical variable into dummy/indicator variables." ] }, { "cell_type": "code", "execution_count": 4, "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>League_A</th>\n", " <th>League_N</th>\n", " <th>Division_E</th>\n", " <th>Division_W</th>\n", " <th>NewLeague_A</th>\n", " <th>NewLeague_N</th>\n", " </tr>\n", " </thead>\n", " <tbody>\n", " <tr>\n", " <th>1</th>\n", " <td>0</td>\n", " <td>1</td>\n", " <td>0</td>\n", " <td>1</td>\n", " <td>0</td>\n", " <td>1</td>\n", " </tr>\n", " <tr>\n", " <th>2</th>\n", " <td>1</td>\n", " <td>0</td>\n", " <td>0</td>\n", " <td>1</td>\n", " <td>1</td>\n", " <td>0</td>\n", " </tr>\n", " <tr>\n", " <th>3</th>\n", " <td>0</td>\n", " <td>1</td>\n", " <td>1</td>\n", " <td>0</td>\n", " <td>0</td>\n", " <td>1</td>\n", " </tr>\n", " <tr>\n", " <th>4</th>\n", " <td>0</td>\n", " <td>1</td>\n", " <td>1</td>\n", " <td>0</td>\n", " <td>0</td>\n", " <td>1</td>\n", " </tr>\n", " <tr>\n", " <th>5</th>\n", " <td>1</td>\n", " <td>0</td>\n", " <td>0</td>\n", " <td>1</td>\n", " <td>1</td>\n", " <td>0</td>\n", " </tr>\n", " </tbody>\n", "</table>\n", "</div>" ], "text/plain": [ " League_A League_N Division_E Division_W NewLeague_A NewLeague_N\n", "1 0 1 0 1 0 1\n", "2 1 0 0 1 1 0\n", "3 0 1 1 0 0 1\n", "4 0 1 1 0 0 1\n", "5 1 0 0 1 1 0" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dummies.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We will now perform ridge regression and the lasso in order to predict Salary on the Hitters data. Let's set up our data:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "<class 'pandas.core.frame.DataFrame'>\n", "Int64Index: 263 entries, 1 to 321\n", "Data columns (total 19 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 AtBat 263 non-null float64\n", " 1 Hits 263 non-null float64\n", " 2 HmRun 263 non-null float64\n", " 3 Runs 263 non-null float64\n", " 4 RBI 263 non-null float64\n", " 5 Walks 263 non-null float64\n", " 6 Years 263 non-null float64\n", " 7 CAtBat 263 non-null float64\n", " 8 CHits 263 non-null float64\n", " 9 CHmRun 263 non-null float64\n", " 10 CRuns 263 non-null float64\n", " 11 CRBI 263 non-null float64\n", " 12 CWalks 263 non-null float64\n", " 13 PutOuts 263 non-null float64\n", " 14 Assists 263 non-null float64\n", " 15 Errors 263 non-null float64\n", " 16 League_N 263 non-null uint8 \n", " 17 Division_W 263 non-null uint8 \n", " 18 NewLeague_N 263 non-null uint8 \n", "dtypes: float64(16), uint8(3)\n", "memory usage: 35.7 KB\n" ] } ], "source": [ "y = df.Salary\n", "\n", "# Drop the column with the independent variable (Salary), and columns for which we created dummy variables\n", "X_ = df.drop(['Salary', 'League', 'Division', 'NewLeague'], axis = 1).astype('float64')\n", "\n", "# Define the feature set X.\n", "X = pd.concat([X_, dummies[['League_N', 'Division_W', 'NewLeague_N']]], axis = 1)\n", "\n", "X.info()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(263, 20)\n", "(263, 19)\n", "(263,)\n" ] } ], "source": [ "print(df.shape)\n", "print(X.shape)\n", "print(y.shape)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1 475.0\n", "2 480.0\n", "3 500.0\n", "4 91.5\n", "5 750.0\n", "Name: Salary, dtype: float64" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "y.head()" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "# 6.6.1 Ridge Regression" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The Ridge() function has an alpha argument (λ, but with a different name!) that is used to tune the model. We'll generate \n", "an array of alpha values ranging from very big to very small, essentially covering the full range of scenarios from the \n", "null model containing only the intercept, to the least squares fit:" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([5.00000000e+09, 3.78231664e+09, 2.86118383e+09, 2.16438064e+09,\n", " 1.63727458e+09, 1.23853818e+09, 9.36908711e+08, 7.08737081e+08,\n", " 5.36133611e+08, 4.05565415e+08, 3.06795364e+08, 2.32079442e+08,\n", " 1.75559587e+08, 1.32804389e+08, 1.00461650e+08, 7.59955541e+07,\n", " 5.74878498e+07, 4.34874501e+07, 3.28966612e+07, 2.48851178e+07,\n", " 1.88246790e+07, 1.42401793e+07, 1.07721735e+07, 8.14875417e+06,\n", " 6.16423370e+06, 4.66301673e+06, 3.52740116e+06, 2.66834962e+06,\n", " 2.01850863e+06, 1.52692775e+06, 1.15506485e+06, 8.73764200e+05,\n", " 6.60970574e+05, 5.00000000e+05, 3.78231664e+05, 2.86118383e+05,\n", " 2.16438064e+05, 1.63727458e+05, 1.23853818e+05, 9.36908711e+04,\n", " 7.08737081e+04, 5.36133611e+04, 4.05565415e+04, 3.06795364e+04,\n", " 2.32079442e+04, 1.75559587e+04, 1.32804389e+04, 1.00461650e+04,\n", " 7.59955541e+03, 5.74878498e+03, 4.34874501e+03, 3.28966612e+03,\n", " 2.48851178e+03, 1.88246790e+03, 1.42401793e+03, 1.07721735e+03,\n", " 8.14875417e+02, 6.16423370e+02, 4.66301673e+02, 3.52740116e+02,\n", " 2.66834962e+02, 2.01850863e+02, 1.52692775e+02, 1.15506485e+02,\n", " 8.73764200e+01, 6.60970574e+01, 5.00000000e+01, 3.78231664e+01,\n", " 2.86118383e+01, 2.16438064e+01, 1.63727458e+01, 1.23853818e+01,\n", " 9.36908711e+00, 7.08737081e+00, 5.36133611e+00, 4.05565415e+00,\n", " 3.06795364e+00, 2.32079442e+00, 1.75559587e+00, 1.32804389e+00,\n", " 1.00461650e+00, 7.59955541e-01, 5.74878498e-01, 4.34874501e-01,\n", " 3.28966612e-01, 2.48851178e-01, 1.88246790e-01, 1.42401793e-01,\n", " 1.07721735e-01, 8.14875417e-02, 6.16423370e-02, 4.66301673e-02,\n", " 3.52740116e-02, 2.66834962e-02, 2.01850863e-02, 1.52692775e-02,\n", " 1.15506485e-02, 8.73764200e-03, 6.60970574e-03, 5.00000000e-03])" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# alphas represent lambda in Ridge Regression. alpha values range very big to very small.\n", "alphas = 10**np.linspace(10,-2,100)*0.5\n", "# numpy.linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None, axis=0)[source]¶\n", "# Return evenly spaced numbers over a specified interval.\n", "alphas" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Associated with each alpha value is a vector of ridge regression coefficients, which we'll store in a matrix coefs. \n", "In this case, it is a 19×100 matrix, with 19 rows (one for each predictor) and 100 columns (one for each value of alpha). \n", "Remember that we'll want to standardize the variables so that they are on the same scale. To do this, we can use the \n", "(normalize = True) parameter:" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(100, 19)" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ridge = Ridge(normalize = True) \n", "# normalize - standardize the variables so that they are on the same scale by squeezing data in [0,1]\n", "coefs = []\n", " \n", "for a in alphas:\n", " ridge.set_params(alpha = a)\n", " ridge.fit(X, y) \n", " coefs.append(ridge.coef_) # coefs matrix - 100 rows x 19 columns\n", " \n", "np.shape(coefs)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[array([ 2.41792033e-10, 8.77087820e-10, 3.53418911e-09, 1.48322166e-09,\n", " 1.56674826e-09, 1.84396625e-09, 7.54102361e-09, 2.07601888e-11,\n", " 7.64034224e-11, 5.76187223e-10, 1.53282320e-10, 1.58190714e-10,\n", " 1.67364484e-10, 9.68457013e-11, 1.58184041e-11, -7.37555427e-11,\n", " -2.57640933e-09, -3.46788982e-08, -5.11835167e-10]),\n", " array([ 3.19634838e-10, 1.15945848e-09, 4.67199001e-09, 1.96073175e-09,\n", " 2.07114900e-09, 2.43761486e-09, 9.96878940e-09, 2.74437478e-11,\n", " 1.01000828e-10, 7.61685599e-10, 2.02630206e-10, 2.09118814e-10,\n", " 2.21245998e-10, 1.28024318e-10, 2.09109993e-11, -9.75004868e-11,\n", " -3.40586150e-09, -4.58434625e-08, -6.76615963e-10]),\n", " array([ 4.22538444e-10, 1.53273587e-09, 6.17609583e-09, 2.59197198e-09,\n", " 2.73793708e-09, 3.22238339e-09, 1.31781529e-08, 3.62790194e-11,\n", " 1.33517150e-10, 1.00690354e-09, 2.67865207e-10, 2.76442765e-10,\n", " 2.92474189e-10, 1.69240613e-10, 2.76431104e-11, -1.28889906e-10,\n", " -4.50234845e-09, -6.06023595e-08, -8.94446472e-10]),\n", " array([ 5.58570956e-10, 2.02618662e-09, 8.16443521e-09, 3.42643441e-09,\n", " 3.61939169e-09, 4.25980119e-09, 1.74207426e-08, 4.79587286e-11,\n", " 1.76501815e-10, 1.33106721e-09, 3.54102039e-10, 3.65441066e-10,\n", " 3.86633664e-10, 2.23726131e-10, 3.65425651e-11, -1.70384870e-10,\n", " -5.95183965e-09, -8.01127527e-08, -1.18240558e-09]),\n", " array([ 7.38397930e-10, 2.67849946e-09, 1.07929028e-08, 4.52954464e-09,\n", " 4.78462280e-09, 5.63120648e-09, 2.30291964e-08, 6.33986167e-11,\n", " 2.33325012e-10, 1.75959252e-09, 4.68102056e-10, 4.83091582e-10,\n", " 5.11106950e-10, 2.95752778e-10, 4.83071204e-11, -2.25238771e-10,\n", " -7.86798170e-09, -1.05904344e-07, -1.56307055e-09])]" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "coefs[0:5]" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "[array([-1.71961785e+00, 6.06622348e+00, 1.27540705e+00, -6.76054919e-01,\n", " -1.21922719e-01, 5.45628756e+00, -9.49631946e+00, -7.26036515e-02,\n", " 1.96162636e-01, 6.09184001e-01, 8.08032861e-01, 4.25005674e-01,\n", " -6.46655431e-01, 2.80320693e-01, 3.06142702e-01, -3.69563350e+00,\n", " 6.16685846e+01, -1.21878443e+02, -2.77610000e+01]),\n", " array([-1.78822160e+00, 6.35234831e+00, 1.69242754e+00, -9.26987185e-01,\n", " -2.43350576e-01, 5.61390256e+00, -8.80100460e+00, -8.59233028e-02,\n", " 1.96979402e-01, 5.46795916e-01, 8.90564305e-01, 4.59823055e-01,\n", " -6.75778781e-01, 2.80934805e-01, 3.17755891e-01, -3.64766963e+00,\n", " 6.19333364e+01, -1.21176136e+02, -2.76369152e+01])]" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "coefs[98:100]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We expect the coefficient estimates to be much smaller, in terms of l2 norm, when a large value of alpha is used, as \n", "compared to when a small value of alpha is used. Let's plot and find out:" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Text(0, 0.5, 'weights')" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAEKCAYAAADuEgmxAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3deXxcd33v/9dnzuwa7YsXWbLlfYtjxyIOhAQnJAFSQgiFQqDsXAMlt6W3vfdCaW/59RZul0vb2+XShiU3bE24CUtugIQkJEDIZsdbJHmVV1nyIslaRttsn98fM3ZkR7LHtkZnZvR5Ph7Hc7aZeX8leT5zvmcTVcUYY4zJhsftAMYYYwqHFQ1jjDFZs6JhjDEma1Y0jDHGZM2K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lN1pb8UyztgAJpixWN/LIZWCIiTSLiB94HPOJypitVTG2ytuSfYmkHFEhbrGi4RET+HXgeWCYiHSLycVVNAPcAjwO7gO+raqubOS9FMbXJ2pJ/iqUdUNhtsQsWGmOMyZptaRhjjMmaFQ1jjDFZs6JhjDEma1Y0jDHGZM2KhjHGmKxZ0TDGGJM1KxrG5JCIHBKRmitdx5h8YUXDGGNM1qxoGDNFRORHIvKyiLSKyKbzli0Qkd0icr+I7Mzc5S88bpX/KCJbReQVEVmeec61IvKciGzLPC6b1gYZMwErGsZMnY+p6nrSd+/7fRGpPm/5MuBeVV0DDAC/N25Zt6peA3wV+OPMvN3Ajaq6DvhvwJdzmt6YLFjRMGbq/L6I7ABeIH210iXnLT+qqr/JjH8HeOO4ZWcuR/4ysCAzXg7838wtQf8eWJWL0MZcCisaxkwBEdkI3AK8XlWvBraRvs/2eOdf6G389FjmMcmr97n578DTqroauGOC1zNm2lnRMGZqlAOnVXU4s0/iugnWaRSR12fG7waezeI1j2XGPzIlKY25QlY0jJkajwFeEdlJegvhhQnW2QV8OLNOFen9FxfyN8D/EJHfAM5UhjXmctml0Y2ZBiKyAHg009VkTMGyLQ1jjDFZsy0NY4wxWbMtDWOMMVmzomGMMSZrVjSMMcZkzYqGMcaYrFnRMMYYkzUrGsYYY7L2/wNAr2l4eLf16AAAAABJRU5ErkJggg==\n", "text/plain": [ "<Figure size 432x288 with 1 Axes>" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "ax = plt.gca() # gca - get the current axes\n", "ax.plot(alphas, coefs)\n", "ax.set_xscale('log')\n", "plt.axis('tight')\n", "plt.xlabel('alpha')\n", "plt.ylabel('weights')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For pyplot tutorial including gca(), visit: https://matplotlib.org/3.1.1/tutorials/introductory/pyplot.html#sphx-glr-tutorials-introductory-pyplot-py." ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [], "source": [ "# Split data into training and test sets\n", "X_train, X_test , y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=1)" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "AtBat 0.098658\n", "Hits 0.446094\n", "HmRun 1.412107\n", "Runs 0.660773\n", "RBI 0.843403\n", "Walks 1.008473\n", "Years 2.779882\n", "CAtBat 0.008244\n", "CHits 0.034149\n", "CHmRun 0.268634\n", "CRuns 0.070407\n", "CRBI 0.070060\n", "CWalks 0.082795\n", "PutOuts 0.104747\n", "Assists -0.003739\n", "Errors 0.268363\n", "League_N 4.241051\n", "Division_W -30.768885\n", "NewLeague_N 4.123474\n", "dtype: float64\n", "106216.52238005563\n" ] } ], "source": [ "# fit a ridge regression model on the training set and get MSE, using lambda=4\n", "ridge2 = Ridge(alpha = 4, normalize = True)\n", "ridge2.fit(X_train, y_train) # Fit a ridge regression on the training data\n", "pred2 = ridge2.predict(X_test) # Use this model to predict the test data\n", "print(pd.Series(ridge2.coef_, index = X.columns)) # Print coefficients\n", "print(mean_squared_error(y_test, pred2)) # Calculate the test MSE" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The test MSE when alpha = 4 is 106216. Now let's see what happens if we use a huge value of alpha, say 10^10:" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "AtBat 1.317464e-10\n", "Hits 4.647486e-10\n", "HmRun 2.079865e-09\n", "Runs 7.726175e-10\n", "RBI 9.390640e-10\n", "Walks 9.769219e-10\n", "Years 3.961442e-09\n", "CAtBat 1.060533e-11\n", "CHits 3.993605e-11\n", "CHmRun 2.959428e-10\n", "CRuns 8.245247e-11\n", "CRBI 7.795451e-11\n", "CWalks 9.894387e-11\n", "PutOuts 7.268991e-11\n", "Assists -2.615885e-12\n", "Errors 2.084514e-10\n", "League_N -2.501281e-09\n", "Division_W -1.549951e-08\n", "NewLeague_N -2.023196e-09\n", "dtype: float64\n", "172862.23580379886\n" ] } ], "source": [ "ridge3 = Ridge(alpha = 10**10, normalize = True)\n", "ridge3.fit(X_train, y_train) # Fit a ridge regression on the training data\n", "pred3 = ridge3.predict(X_test) # Use this model to predict the test data\n", "print(pd.Series(ridge3.coef_, index = X.columns)) # Print coefficients\n", "print(mean_squared_error(y_test, pred3)) # Calculate the test MSE" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This big penalty shrinks the coefficients to a very large degree, essentially reducing to a model containing just the \n", "intercept. This over-shrinking makes the model more biased, resulting in a higher MSE." ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "532.7090148153795\n" ] } ], "source": [ "print(ridge3.intercept_)" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "AtBat -1.821115\n", "Hits 4.259156\n", "HmRun -4.773401\n", "Runs -0.038760\n", "RBI 3.984578\n", "Walks 3.470126\n", "Years 9.498236\n", "CAtBat -0.605129\n", "CHits 2.174979\n", "CHmRun 2.979306\n", "CRuns 0.266356\n", "CRBI -0.598456\n", "CWalks 0.171383\n", "PutOuts 0.421063\n", "Assists 0.464379\n", "Errors -6.024576\n", "League_N 133.743163\n", "Division_W -113.743875\n", "NewLeague_N -81.927763\n", "dtype: float64\n", "116690.46856660438\n" ] } ], "source": [ "# least squares is simply ridge regression with alpha = 0.\n", "ridge2 = Ridge(alpha = 0, normalize = True)\n", "ridge2.fit(X_train, y_train) # Fit a ridge regression on the training data\n", "pred = ridge2.predict(X_test) # Use this model to predict the test data\n", "print(pd.Series(ridge2.coef_, index = X.columns)) # Print coefficients\n", "print(mean_squared_error(y_test, pred)) # Calculate the test MSE" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "It looks like we are indeed improving over regular least-squares!\n", "Instead of arbitrarily choosing alpha=4, it would be better to use cross-validation to choose the tuning parameter alpha. \n", "We can do this using the cross-validated ridge regression function, RidgeCV(). By default, the function performs generalized \n", "cross-validation (an efficient form of LOOCV), though this can be changed using the argument cv." ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.5748784976988678" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ridgecv = RidgeCV(alphas = alphas, scoring = 'neg_mean_squared_error', normalize = True)\n", "ridgecv.fit(X_train, y_train)\n", "ridgecv.alpha_" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Therefore, we see that the value of alpha that results in the smallest cross-validation error is 0.57. \n", "What is the test MSE associated with this value of alpha?" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "99825.6489629273" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ridge4 = Ridge(alpha = ridgecv.alpha_, normalize = True)\n", "ridge4.fit(X_train, y_train)\n", "mean_squared_error(y_test, ridge4.predict(X_test))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This represents a further improvement over the test MSE that we got using alpha=4. Finally, we refit our ridge regression \n", "model on the full data set, using the value of alpha chosen by cross-validation, and examine the coefficient estimates." ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "AtBat 0.055838\n", "Hits 0.934879\n", "HmRun 0.369048\n", "Runs 1.092480\n", "RBI 0.878259\n", "Walks 1.717770\n", "Years 0.783515\n", "CAtBat 0.011318\n", "CHits 0.061101\n", "CHmRun 0.428333\n", "CRuns 0.121418\n", "CRBI 0.129351\n", "CWalks 0.041990\n", "PutOuts 0.179957\n", "Assists 0.035737\n", "Errors -1.597699\n", "League_N 24.774519\n", "Division_W -85.948661\n", "NewLeague_N 8.336918\n", "dtype: float64" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ridge4.fit(X, y)\n", "pd.Series(ridge4.coef_, index = X.columns)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As expected, none of the coefficients are exactly zero - ridge regression does not perform variable selection!" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# 6.6.2 The Lasso" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We saw that ridge regression with a wise choice of alpha can outperform least squares as well as the null model on the \n", "Hitters data set. We now ask whether the lasso can yield either a more accurate or a more interpretable model than ridge \n", "regression. In order to fit a lasso model, we'll use the Lasso() function; however, this time we'll need to include the \n", "argument max_iter = 10000. Other than that change, we proceed just as we did in fitting a ridge model:" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [], "source": [ "lasso = Lasso(max_iter = 10000, normalize = True) \n", "# normalize means all data are squeezed in [0,1]\n", "coefs = []\n", "\n", "for a in alphas:\n", " lasso.set_params(alpha=a)\n", " lasso.fit(scale(X_train), y_train) # scale - Standardize a dataset along any axis\n", " coefs.append(lasso.coef_)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "It is quite questionable whether we have to scale the data set for fitting a model. If we fit with the scaled data set, we need to roll back to the unscaled prediction later. It might be OK without scaling even though there might be different sensitivities with the data set weighting." ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Text(0, 0.5, 'weights')" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZMAAAEKCAYAAADXdbjqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3dd3wc9Z3/8ddntmlVVpJVbVmy3HG3QRCwA4EAoYWjBBLiBDjCndO43F1y+YWUu+TClfQEUkgIR0K5gxBC6KFDSLABF8AVFyzZkmWrd+2utnx/f8zKyLZkq8+u9HnymMfufnd29zNao7fm+535jhhjUEoppUbCcroApZRSqU/DRCml1IhpmCillBoxD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2QY8CGwHngY+b4yJJfY6bgKeAXYADybWBfgK8EUR2YM9hvI/47s1o6OmpoYnn3ySWbNmce655zpdjlJKDYnYf9xPPhUVFWbDhg1OlwFAW1sbd955Jy6XizVr1uhkjkqppCUiG40xFUe3J1s316TT3NzMb37zG8LhMNdcc40GiVIqJY3ZALw6sfr6eu655x5isRjXX3+9Xo5XKZWyNEwccuDAAe677z5cLhc33HADhYWFTpeklFLDpmHigMrKSu6//37S09O57rrrdGp5pVTK0zAZZzt27OChhx5iypQpXHvttQQCAadLUkqpEdMwGUc7duzgwQcfpKSkhNWrV+tgu1JqwtAwGSctLS088sgjTJs2jWuvvRafz+d0SUopNWr00OBxEIvF+MMf/gDAVVddpUGilJpwNEzGwZ///Gdqamr48Ic/TG5urtPlKKXUqNMwGWN79+7llVdeYfny5SxZssTpcpRSakxomIyhAwcO8MADD5Cfn89FF13kdDlKKTVmNEzGSF1dHffddx/p6ek64K6UmvA0TMZAU1MT9957L263m+uuu47s7GynS1JKqTGlhwaPsnfffZeHHnoIEeGGG27Qs9uVUpOChskoMcawdu1ann/+eQoKCvjYxz6m129XSk0aGiajoLW1lT/96U/s3LmThQsXctlll+kYiVJqUtEwGYFoNMratWt55ZVXEBEuuOACTj/9dETE6dKUUmpcaZgMQzgcZtOmTbz22mu0tbWxYMECLrjgAnJycpwuTSmlHKFhMgTxeJyXXnqJ9evXEwqFKCsr49JLL2XOnDlOl6aUUo7SMBkCy7Kora1l5syZrFq1iunTpztdklJKJQUNkyFavXo1LpfL6TKUUiqp6EmLQ6RBopRSx9IwUUopNWIaJkoppUZMw0QppdSIaZgopZQaMQ0TpZRSI6ZhopRSasQ0TJRSSo2YGGOcrsERItIA7HO6juPIBxqdLmKU6LYkn4myHaDbMt5mGGMKjm6ctGGS7ERkgzGmwuk6RoNuS/KZKNsBui3JQru5lFJKjZiGiVJKqRHTMEledzhdwCjSbUk+E2U7QLclKeiYiVJKqRHTPROllFIjpmGilFJqxDRMlFJKjZiGSQoSkVki8j8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oaJUmPvCyLyNvAa9sywc496vtoY82ri/n3A+/s81zst/EagPHE/G/h94rKvPwYWjUXRSg2FholSY0hEzgbOA84wxiwD3sS+znpfR0+Q1/dxOHEb473rD90CvGSMWQxc2s/7KTXuNEyUGlvZQIsxpjsx5nF6P+uUicgZifsfB/46iPc8kLj/t6NSpVIjpGGi1Nh6GnCLyGbsPYrX+llnB3B9Yp0p2OMjx/M94L9F5FXANZrFKjVcOgW9Ug4SkXLgiUSXlVIpS/dMlFJKjZjumSillBox3TNRSik1YhomSimlRkzDRCml1IhpmCillBoxDROllFIjpmGilFJqxP4/v6a2LESHDY0AAAAASUVORK5CYII=\n", "text/plain": [ "<Figure size 432x288 with 1 Axes>" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "ax = plt.gca()\n", "ax.plot(alphas*2, coefs)\n", "ax.set_xscale('log')\n", "plt.axis('tight')\n", "plt.xlabel('alpha')\n", "plt.ylabel('weights')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Notice that in the coefficient plot that depending on the choice of tuning parameter, some of the coefficients are exactly \n", "equal to zero. We now perform 10-fold cross-validation to choose the best alpha, refit the model, and compute the associated \n", "test error:" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "104960.65853895503" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lassocv = LassoCV(alphas = None, cv = 10, max_iter = 100000, normalize = True)\n", "lassocv.fit(X_train, y_train)\n", "\n", "lasso.set_params(alpha=lassocv.alpha_)\n", "lasso.fit(X_train, y_train)\n", "mean_squared_error(y_test, lasso.predict(X_test))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is substantially lower than the test set MSE of the null model and of least squares, and only a little worse than \n", "the test MSE of ridge regression with alpha chosen by cross-validation.\n", "\n", "However, the lasso has a substantial advantage over ridge regression in that the resulting coefficient estimates are sparse. \n", "Here we see that 13 of the 19 coefficient estimates are exactly zero:" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "AtBat 0.000000\n", "Hits 1.082446\n", "HmRun 0.000000\n", "Runs 0.000000\n", "RBI 0.000000\n", "Walks 2.906388\n", "Years 0.000000\n", "CAtBat 0.000000\n", "CHits 0.000000\n", "CHmRun 0.219367\n", "CRuns 0.000000\n", "CRBI 0.513975\n", "CWalks 0.000000\n", "PutOuts 0.368401\n", "Assists -0.000000\n", "Errors -0.000000\n", "League_N 0.000000\n", "Division_W -89.064338\n", "NewLeague_N 0.000000\n", "dtype: float64" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Some of the coefficients are now reduced to exactly zero.\n", "pd.Series(lasso.coef_, index=X.columns)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The above data result has been a motive for the Movie Moneyball.\n", "\n", "**Movie Moneyball:** Billy Beane (Brad Pitt), general manager of the Oakland A's, one day has an epiphany: Baseball's conventional wisdom is all wrong. Faced with a tight budget, Beane must reinvent his team by outsmarting the richer ball clubs. Joining forces with Ivy League graduate Peter Brand (Jonah Hill), Beane prepares to challenge old-school traditions. He recruits bargain-bin players whom the scouts have labeled as flawed, but have game-winning potential. Based on the book by Michael Lewis." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now it's time to test out these approaches (ridge regression and the lasso) and evaluation methods (validation set, cross \n", "validation) on other datasets. You may want to work with a team on this portion of the lab. You may use any of the datasets \n", "included in ISLR, or choose one from the UCI machine learning repository (http://archive.ics.uci.edu/ml/datasets.html). \n", "Download a dataset, and try to determine the optimal set of parameters to use to model it! You are free to use the same \n", "dataset you used in Lab 9, or you can choose a new one." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Lab06 Ridge Lasso Homework in a separate file." ] } ], "metadata": { "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": 4 }

Lab06 Ridge Regression and Lasso/Hitters.csv

Player AtBat Hits HmRun Runs RBI Walks Years CAtBat CHits CHmRun CRuns CRBI CWalks League Division PutOuts Assists Errors Salary NewLeague
Andy Allanson 293 66 1 30 29 14 1 293 66 1 30 29 14 A E 446 33 20 NA A
Alan Ashby 315 81 7 24 38 39 14 3449 835 69 321 414 375 N W 632 43 10 475 N
Alvin Davis 479 130 18 66 72 76 3 1624 457 63 224 266 263 A W 880 82 14 480 A
Andre Dawson 496 141 20 65 78 37 11 5628 1575 225 828 838 354 N E 200 11 3 500 N
Andres Galarraga 321 87 10 39 42 30 2 396 101 12 48 46 33 N E 805 40 4 91.5 N
Alfredo Griffin 594 169 4 74 51 35 11 4408 1133 19 501 336 194 A W 282 421 25 750 A
Al Newman 185 37 1 23 8 21 2 214 42 1 30 9 24 N E 76 127 7 70 A
Argenis Salazar 298 73 0 24 24 7 3 509 108 0 41 37 12 A W 121 283 9 100 A
Andres Thomas 323 81 6 26 32 8 2 341 86 6 32 34 8 N W 143 290 19 75 N
Andre Thornton 401 92 17 49 66 65 13 5206 1332 253 784 890 866 A E 0 0 0 1100 A
Alan Trammell 574 159 21 107 75 59 10 4631 1300 90 702 504 488 A E 238 445 22 517.143 A
Alex Trevino 202 53 4 31 26 27 9 1876 467 15 192 186 161 N W 304 45 11 512.5 N
Andy VanSlyke 418 113 13 48 61 47 4 1512 392 41 205 204 203 N E 211 11 7 550 N
Alan Wiggins 239 60 0 30 11 22 6 1941 510 4 309 103 207 A E 121 151 6 700 A
Bill Almon 196 43 7 29 27 30 13 3231 825 36 376 290 238 N E 80 45 8 240 N
Billy Beane 183 39 3 20 15 11 3 201 42 3 20 16 11 A W 118 0 0 NA A
Buddy Bell 568 158 20 89 75 73 15 8068 2273 177 1045 993 732 N W 105 290 10 775 N
Buddy Biancalana 190 46 2 24 8 15 5 479 102 5 65 23 39 A W 102 177 16 175 A
Bruce Bochte 407 104 6 57 43 65 12 5233 1478 100 643 658 653 A W 912 88 9 NA A
Bruce Bochy 127 32 8 16 22 14 8 727 180 24 67 82 56 N W 202 22 2 135 N
Barry Bonds 413 92 16 72 48 65 1 413 92 16 72 48 65 N E 280 9 5 100 N
Bobby Bonilla 426 109 3 55 43 62 1 426 109 3 55 43 62 A W 361 22 2 115 N
Bob Boone 22 10 1 4 2 1 6 84 26 2 9 9 3 A W 812 84 11 NA A
Bob Brenly 472 116 16 60 62 74 6 1924 489 67 242 251 240 N W 518 55 3 600 N
Bill Buckner 629 168 18 73 102 40 18 8424 2464 164 1008 1072 402 A E 1067 157 14 776.667 A
Brett Butler 587 163 4 92 51 70 6 2695 747 17 442 198 317 A E 434 9 3 765 A
Bob Dernier 324 73 4 32 18 22 7 1931 491 13 291 108 180 N E 222 3 3 708.333 N
Bo Diaz 474 129 10 50 56 40 10 2331 604 61 246 327 166 N W 732 83 13 750 N
Bill Doran 550 152 6 92 37 81 5 2308 633 32 349 182 308 N W 262 329 16 625 N
Brian Downing 513 137 20 90 95 90 14 5201 1382 166 763 734 784 A W 267 5 3 900 A
Bobby Grich 313 84 9 42 30 39 17 6890 1833 224 1033 864 1087 A W 127 221 7 NA A
Billy Hatcher 419 108 6 55 36 22 3 591 149 8 80 46 31 N W 226 7 4 110 N
Bob Horner 517 141 27 70 87 52 9 3571 994 215 545 652 337 N W 1378 102 8 NA N
Brook Jacoby 583 168 17 83 80 56 5 1646 452 44 219 208 136 A E 109 292 25 612.5 A
Bob Kearney 204 49 6 23 25 12 7 1309 308 27 126 132 66 A W 419 46 5 300 A
Bill Madlock 379 106 10 38 60 30 14 6207 1906 146 859 803 571 N W 72 170 24 850 N
Bobby Meacham 161 36 0 19 10 17 4 1053 244 3 156 86 107 A E 70 149 12 NA A
Bob Melvin 268 60 5 24 25 15 2 350 78 5 34 29 18 N W 442 59 6 90 N
Ben Oglivie 346 98 5 31 53 30 16 5913 1615 235 784 901 560 A E 0 0 0 NA A
Bip Roberts 241 61 1 34 12 14 1 241 61 1 34 12 14 N W 166 172 10 NA N
BillyJo Robidoux 181 41 1 15 21 33 2 232 50 4 20 29 45 A E 326 29 5 67.5 A
Bill Russell 216 54 0 21 18 15 18 7318 1926 46 796 627 483 N W 103 84 5 NA N
Billy Sample 200 57 6 23 14 14 9 2516 684 46 371 230 195 N W 69 1 1 NA N
Bill Schroeder 217 46 7 32 19 9 4 694 160 32 86 76 32 A E 307 25 1 180 A
Butch Wynegar 194 40 7 19 29 30 11 4183 1069 64 486 493 608 A E 325 22 2 NA A
Chris Bando 254 68 2 28 26 22 6 999 236 21 108 117 118 A E 359 30 4 305 A
Chris Brown 416 132 7 57 49 33 3 932 273 24 113 121 80 N W 73 177 18 215 N
Carmen Castillo 205 57 8 34 32 9 5 756 192 32 117 107 51 A E 58 4 4 247.5 A
Cecil Cooper 542 140 12 46 75 41 16 7099 2130 235 987 1089 431 A E 697 61 9 NA A
Chili Davis 526 146 13 71 70 84 6 2648 715 77 352 342 289 N W 303 9 9 815 N
Carlton Fisk 457 101 14 42 63 22 17 6521 1767 281 1003 977 619 A W 389 39 4 875 A
Curt Ford 214 53 2 30 29 23 2 226 59 2 32 32 27 N E 109 7 3 70 N
Cliff Johnson 19 7 0 1 2 1 4 41 13 1 3 4 4 A E 0 0 0 NA A
Carney Lansford 591 168 19 80 72 39 9 4478 1307 113 634 563 319 A W 67 147 4 1200 A
Chet Lemon 403 101 12 45 53 39 12 5150 1429 166 747 666 526 A E 316 6 5 675 A
Candy Maldonado 405 102 18 49 85 20 6 950 231 29 99 138 64 N W 161 10 3 415 N
Carmelo Martinez 244 58 9 28 25 35 4 1335 333 49 164 179 194 N W 142 14 2 340 N
Charlie Moore 235 61 3 24 39 21 14 3926 1029 35 441 401 333 A E 425 43 4 NA A
Craig Reynolds 313 78 6 32 41 12 12 3742 968 35 409 321 170 N W 106 206 7 416.667 N
Cal Ripken 627 177 25 98 81 70 6 3210 927 133 529 472 313 A E 240 482 13 1350 A
Cory Snyder 416 113 24 58 69 16 1 416 113 24 58 69 16 A E 203 70 10 90 A
Chris Speier 155 44 6 21 23 15 16 6631 1634 98 698 661 777 N E 53 88 3 275 N
Curt Wilkerson 236 56 0 27 15 11 4 1115 270 1 116 64 57 A W 125 199 13 230 A
Dave Anderson 216 53 1 31 15 22 4 926 210 9 118 69 114 N W 73 152 11 225 N
Doug Baker 24 3 0 1 0 2 3 159 28 0 20 12 9 A W 80 4 0 NA A
Don Baylor 585 139 31 93 94 62 17 7546 1982 315 1141 1179 727 A E 0 0 0 950 A
Dann Bilardello 191 37 4 12 17 14 4 773 163 16 61 74 52 N E 391 38 8 NA N
Daryl Boston 199 53 5 29 22 21 3 514 120 8 57 40 39 A W 152 3 5 75 A
Darnell Coles 521 142 20 67 86 45 4 815 205 22 99 103 78 A E 107 242 23 105 A
Dave Collins 419 113 1 44 27 44 12 4484 1231 32 612 344 422 A E 211 2 1 NA A
Dave Concepcion 311 81 3 42 30 26 17 8247 2198 100 950 909 690 N W 153 223 10 320 N
Darren Daulton 138 31 8 18 21 38 3 244 53 12 33 32 55 N E 244 21 4 NA N
Doug DeCinces 512 131 26 69 96 52 14 5347 1397 221 712 815 548 A W 119 216 12 850 A
Darrell Evans 507 122 29 78 85 91 18 7761 1947 347 1175 1152 1380 A E 808 108 2 535 A
Dwight Evans 529 137 26 86 97 97 15 6661 1785 291 1082 949 989 A E 280 10 5 933.333 A
Damaso Garcia 424 119 6 57 46 13 9 3651 1046 32 461 301 112 A E 224 286 8 850 N
Dan Gladden 351 97 4 55 29 39 4 1258 353 16 196 110 117 N W 226 7 3 210 A
Danny Heep 195 55 5 24 33 30 8 1313 338 25 144 149 153 N E 83 2 1 NA N
Dave Henderson 388 103 15 59 47 39 6 2174 555 80 285 274 186 A W 182 9 4 325 A
Donnie Hill 339 96 4 37 29 23 4 1064 290 11 123 108 55 A W 104 213 9 275 A
Dave Kingman 561 118 35 70 94 33 16 6677 1575 442 901 1210 608 A W 463 32 8 NA A
Davey Lopes 255 70 7 49 35 43 15 6311 1661 154 1019 608 820 N E 51 54 8 450 N
Don Mattingly 677 238 31 117 113 53 5 2223 737 93 349 401 171 A E 1377 100 6 1975 A
Darryl Motley 227 46 7 23 20 12 5 1325 324 44 156 158 67 A W 92 2 2 NA A
Dale Murphy 614 163 29 89 83 75 11 5017 1388 266 813 822 617 N W 303 6 6 1900 N
Dwayne Murphy 329 83 9 50 39 56 9 3828 948 145 575 528 635 A W 276 6 2 600 A
Dave Parker 637 174 31 89 116 56 14 6727 2024 247 978 1093 495 N W 278 9 9 1041.667 N
Dan Pasqua 280 82 16 44 45 47 2 428 113 25 61 70 63 A E 148 4 2 110 A
Darrell Porter 155 41 12 21 29 22 16 5409 1338 181 746 805 875 A W 165 9 1 260 A
Dick Schofield 458 114 13 67 57 48 4 1350 298 28 160 123 122 A W 246 389 18 475 A
Don Slaught 314 83 13 39 46 16 5 1457 405 28 156 159 76 A W 533 40 4 431.5 A
Darryl Strawberry 475 123 27 76 93 72 4 1810 471 108 292 343 267 N E 226 10 6 1220 N
Dale Sveum 317 78 7 35 35 32 1 317 78 7 35 35 32 A E 45 122 26 70 A
Danny Tartabull 511 138 25 76 96 61 3 592 164 28 87 110 71 A W 157 7 8 145 A
Dickie Thon 278 69 3 24 21 29 8 2079 565 32 258 192 162 N W 142 210 10 NA N
Denny Walling 382 119 13 54 58 36 12 2133 594 41 287 294 227 N W 59 156 9 595 N
Dave Winfield 565 148 24 90 104 77 14 7287 2083 305 1135 1234 791 A E 292 9 5 1861.46 A
Enos Cabell 277 71 2 27 29 14 15 5952 1647 60 753 596 259 N W 360 32 5 NA N
Eric Davis 415 115 27 97 71 68 3 711 184 45 156 119 99 N W 274 2 7 300 N
Eddie Milner 424 110 15 70 47 36 7 2130 544 38 335 174 258 N W 292 6 3 490 N
Eddie Murray 495 151 17 61 84 78 10 5624 1679 275 884 1015 709 A E 1045 88 13 2460 A
Ernest Riles 524 132 9 69 47 54 2 972 260 14 123 92 90 A E 212 327 20 NA A
Ed Romero 233 49 2 41 23 18 8 1350 336 7 166 122 106 A E 102 132 10 375 A
Ernie Whitt 395 106 16 48 56 35 10 2303 571 86 266 323 248 A E 709 41 7 NA A
Fred Lynn 397 114 23 67 67 53 13 5589 1632 241 906 926 716 A E 244 2 4 NA A
Floyd Rayford 210 37 8 15 19 15 6 994 244 36 107 114 53 A E 40 115 15 NA A
Franklin Stubbs 420 95 23 55 58 37 3 646 139 31 77 77 61 N W 206 10 7 NA N
Frank White 566 154 22 76 84 43 14 6100 1583 131 743 693 300 A W 316 439 10 750 A
George Bell 641 198 31 101 108 41 5 2129 610 92 297 319 117 A E 269 17 10 1175 A
Glenn Braggs 215 51 4 19 18 11 1 215 51 4 19 18 11 A E 116 5 12 70 A
George Brett 441 128 16 70 73 80 14 6675 2095 209 1072 1050 695 A W 97 218 16 1500 A
Greg Brock 325 76 16 33 52 37 5 1506 351 71 195 219 214 N W 726 87 3 385 A
Gary Carter 490 125 24 81 105 62 13 6063 1646 271 847 999 680 N E 869 62 8 1925.571 N
Glenn Davis 574 152 31 91 101 64 3 985 260 53 148 173 95 N W 1253 111 11 215 N
George Foster 284 64 14 30 42 24 18 7023 1925 348 986 1239 666 N E 96 4 4 NA N
Gary Gaetti 596 171 34 91 108 52 6 2862 728 107 361 401 224 A W 118 334 21 900 A
Greg Gagne 472 118 12 63 54 30 4 793 187 14 102 80 50 A W 228 377 26 155 A
George Hendrick 283 77 14 45 47 26 16 6840 1910 259 915 1067 546 A W 144 6 5 700 A
Glenn Hubbard 408 94 4 42 36 66 9 3573 866 59 429 365 410 N W 282 487 19 535 N
Garth Iorg 327 85 3 30 44 20 8 2140 568 16 216 208 93 A E 91 185 12 362.5 A
Gary Matthews 370 96 21 49 46 60 15 6986 1972 231 1070 955 921 N E 137 5 9 733.333 N
Graig Nettles 354 77 16 36 55 41 20 8716 2172 384 1172 1267 1057 N W 83 174 16 200 N
Gary Pettis 539 139 5 93 58 69 5 1469 369 12 247 126 198 A W 462 9 7 400 A
Gary Redus 340 84 11 62 33 47 5 1516 376 42 284 141 219 N E 185 8 4 400 A
Garry Templeton 510 126 2 42 44 35 11 5562 1578 44 703 519 256 N W 207 358 20 737.5 N
Gorman Thomas 315 59 16 45 36 58 13 4677 1051 268 681 782 697 A W 0 0 0 NA A
Greg Walker 282 78 13 37 51 29 5 1649 453 73 211 280 138 A W 670 57 5 500 A
Gary Ward 380 120 5 54 51 31 8 3118 900 92 444 419 240 A W 237 8 1 600 A
Glenn Wilson 584 158 15 70 84 42 5 2358 636 58 265 316 134 N E 331 20 4 662.5 N
Harold Baines 570 169 21 72 88 38 7 3754 1077 140 492 589 263 A W 295 15 5 950 A
Hubie Brooks 306 104 14 50 58 25 7 2954 822 55 313 377 187 N E 116 222 15 750 N
Howard Johnson 220 54 10 30 39 31 5 1185 299 40 145 154 128 N E 50 136 20 297.5 N
Hal McRae 278 70 7 22 37 18 18 7186 2081 190 935 1088 643 A W 0 0 0 325 A
Harold Reynolds 445 99 1 46 24 29 4 618 129 1 72 31 48 A W 278 415 16 87.5 A
Harry Spilman 143 39 5 18 30 15 9 639 151 16 80 97 61 N W 138 15 1 175 N
Herm Winningham 185 40 4 23 11 18 3 524 125 7 58 37 47 N E 97 2 2 90 N
Jesse Barfield 589 170 40 107 108 69 6 2325 634 128 371 376 238 A E 368 20 3 1237.5 A
Juan Beniquez 343 103 6 48 36 40 15 4338 1193 70 581 421 325 A E 211 56 13 430 A
Juan Bonilla 284 69 1 33 18 25 5 1407 361 6 139 98 111 A E 122 140 5 NA N
John Cangelosi 438 103 2 65 32 71 2 440 103 2 67 32 71 A W 276 7 9 100 N
Jose Canseco 600 144 33 85 117 65 2 696 173 38 101 130 69 A W 319 4 14 165 A
Joe Carter 663 200 29 108 121 32 4 1447 404 57 210 222 68 A E 241 8 6 250 A
Jack Clark 232 55 9 34 23 45 12 4405 1213 194 702 705 625 N E 623 35 3 1300 N
Jose Cruz 479 133 10 48 72 55 17 7472 2147 153 980 1032 854 N W 237 5 4 773.333 N
Julio Cruz 209 45 0 38 19 42 10 3859 916 23 557 279 478 A W 132 205 5 NA A
Jody Davis 528 132 21 61 74 41 6 2641 671 97 273 383 226 N E 885 105 8 1008.333 N
Jim Dwyer 160 39 8 18 31 22 14 2128 543 56 304 268 298 A E 33 3 0 275 A
Julio Franco 599 183 10 80 74 32 5 2482 715 27 330 326 158 A E 231 374 18 775 A
Jim Gantner 497 136 7 58 38 26 11 3871 1066 40 450 367 241 A E 304 347 10 850 A
Johnny Grubb 210 70 13 32 51 28 15 4040 1130 97 544 462 551 A E 0 0 0 365 A
Jerry Hairston 225 61 5 32 26 26 11 1568 408 25 202 185 257 A W 132 9 0 NA A
Jack Howell 151 41 4 26 21 19 2 288 68 9 45 39 35 A W 28 56 2 95 A
John Kruk 278 86 4 33 38 45 1 278 86 4 33 38 45 N W 102 4 2 110 N
Jeffrey Leonard 341 95 6 48 42 20 10 2964 808 81 379 428 221 N W 158 4 5 100 N
Jim Morrison 537 147 23 58 88 47 10 2744 730 97 302 351 174 N E 92 257 20 277.5 N
John Moses 399 102 3 56 34 34 5 670 167 4 89 48 54 A W 211 9 3 80 A
Jerry Mumphrey 309 94 5 37 32 26 13 4618 1330 57 616 522 436 N E 161 3 3 600 N
Joe Orsulak 401 100 2 60 19 28 4 876 238 2 126 44 55 N E 193 11 4 NA N
Jorge Orta 336 93 9 35 46 23 15 5779 1610 128 730 741 497 A W 0 0 0 NA A
Jim Presley 616 163 27 83 107 32 3 1437 377 65 181 227 82 A W 110 308 15 200 A
Jamie Quirk 219 47 8 24 26 17 12 1188 286 23 100 125 63 A W 260 58 4 NA A
Johnny Ray 579 174 7 67 78 58 6 3053 880 32 366 337 218 N E 280 479 5 657 N
Jeff Reed 165 39 2 13 9 16 3 196 44 2 18 10 18 A W 332 19 2 75 N
Jim Rice 618 200 20 98 110 62 13 7127 2163 351 1104 1289 564 A E 330 16 8 2412.5 A
Jerry Royster 257 66 5 31 26 32 14 3910 979 33 518 324 382 N W 87 166 14 250 A
John Russell 315 76 13 35 60 25 3 630 151 24 68 94 55 N E 498 39 13 155 N
Juan Samuel 591 157 16 90 78 26 4 2020 541 52 310 226 91 N E 290 440 25 640 N
John Shelby 404 92 11 54 49 18 6 1354 325 30 188 135 63 A E 222 5 5 300 A
Joel Skinner 315 73 5 23 37 16 4 450 108 6 38 46 28 A W 227 15 3 110 A
Jeff Stone 249 69 6 32 19 20 4 702 209 10 97 48 44 N E 103 8 2 NA N
Jim Sundberg 429 91 12 41 42 57 13 5590 1397 83 578 579 644 A W 686 46 4 825 N
Jim Traber 212 54 13 28 44 18 2 233 59 13 31 46 20 A E 243 23 5 NA A
Jose Uribe 453 101 3 46 43 61 3 948 218 6 96 72 91 N W 249 444 16 195 N
Jerry Willard 161 43 4 17 26 22 3 707 179 21 77 99 76 A W 300 12 2 NA A
Joel Youngblood 184 47 5 20 28 18 11 3327 890 74 419 382 304 N W 49 2 0 450 N
Kevin Bass 591 184 20 83 79 38 5 1689 462 40 219 195 82 N W 303 12 5 630 N
Kal Daniels 181 58 6 34 23 22 1 181 58 6 34 23 22 N W 88 0 3 86.5 N
Kirk Gibson 441 118 28 84 86 68 8 2723 750 126 433 420 309 A E 190 2 2 1300 A
Ken Griffey 490 150 21 69 58 35 14 6126 1839 121 983 707 600 A E 96 5 3 1000 N
Keith Hernandez 551 171 13 94 83 94 13 6090 1840 128 969 900 917 N E 1199 149 5 1800 N
Kent Hrbek 550 147 29 85 91 71 6 2816 815 117 405 474 319 A W 1218 104 10 1310 A
Ken Landreaux 283 74 4 34 29 22 10 3919 1062 85 505 456 283 N W 145 5 7 737.5 N
Kevin McReynolds 560 161 26 89 96 66 4 1789 470 65 233 260 155 N W 332 9 8 625 N
Kevin Mitchell 328 91 12 51 43 33 2 342 94 12 51 44 33 N E 145 59 8 125 N
Keith Moreland 586 159 12 72 79 53 9 3082 880 83 363 477 295 N E 181 13 4 1043.333 N
Ken Oberkfell 503 136 5 62 48 83 10 3423 970 20 408 303 414 N W 65 258 8 725 N
Ken Phelps 344 85 24 69 64 88 7 911 214 64 150 156 187 A W 0 0 0 300 A
Kirby Puckett 680 223 31 119 96 34 3 1928 587 35 262 201 91 A W 429 8 6 365 A
Kurt Stillwell 279 64 0 31 26 30 1 279 64 0 31 26 30 N W 107 205 16 75 N
Leon Durham 484 127 20 66 65 67 7 3006 844 116 436 458 377 N E 1231 80 7 1183.333 N
Len Dykstra 431 127 8 77 45 58 2 667 187 9 117 64 88 N E 283 8 3 202.5 N
Larry Herndon 283 70 8 33 37 27 12 4479 1222 94 557 483 307 A E 156 2 2 225 A
Lee Lacy 491 141 11 77 47 37 15 4291 1240 84 615 430 340 A E 239 8 2 525 A
Len Matuszek 199 52 9 26 28 21 6 805 191 30 113 119 87 N W 235 22 5 265 N
Lloyd Moseby 589 149 21 89 86 64 7 3558 928 102 513 471 351 A E 371 6 6 787.5 A
Lance Parrish 327 84 22 53 62 38 10 4273 1123 212 577 700 334 A E 483 48 6 800 N
Larry Parrish 464 128 28 67 94 52 13 5829 1552 210 740 840 452 A W 0 0 0 587.5 A
Luis Rivera 166 34 0 20 13 17 1 166 34 0 20 13 17 N E 64 119 9 NA N
Larry Sheets 338 92 18 42 60 21 3 682 185 36 88 112 50 A E 0 0 0 145 A
Lonnie Smith 508 146 8 80 44 46 9 3148 915 41 571 289 326 A W 245 5 9 NA A
Lou Whitaker 584 157 20 95 73 63 10 4704 1320 93 724 522 576 A E 276 421 11 420 A
Mike Aldrete 216 54 2 27 25 33 1 216 54 2 27 25 33 N W 317 36 1 75 N
Marty Barrett 625 179 4 94 60 65 5 1696 476 12 216 163 166 A E 303 450 14 575 A
Mike Brown 243 53 4 18 26 27 4 853 228 23 101 110 76 N E 107 3 3 NA N
Mike Davis 489 131 19 77 55 34 7 2051 549 62 300 263 153 A W 310 9 9 780 A
Mike Diaz 209 56 12 22 36 19 2 216 58 12 24 37 19 N E 201 6 3 90 N
Mariano Duncan 407 93 8 47 30 30 2 969 230 14 121 69 68 N W 172 317 25 150 N
Mike Easler 490 148 14 64 78 49 13 3400 1000 113 445 491 301 A E 0 0 0 700 N
Mike Fitzgerald 209 59 6 20 37 27 4 884 209 14 66 106 92 N E 415 35 3 NA N
Mel Hall 442 131 18 68 77 33 6 1416 398 47 210 203 136 A E 233 7 7 550 A
Mickey Hatcher 317 88 3 40 32 19 8 2543 715 28 269 270 118 A W 220 16 4 NA A
Mike Heath 288 65 8 30 36 27 9 2815 698 55 315 325 189 N E 259 30 10 650 A
Mike Kingery 209 54 3 25 14 12 1 209 54 3 25 14 12 A W 102 6 3 68 A
Mike LaValliere 303 71 3 18 30 36 3 344 76 3 20 36 45 N E 468 47 6 100 N
Mike Marshall 330 77 19 47 53 27 6 1928 516 90 247 288 161 N W 149 8 6 670 N
Mike Pagliarulo 504 120 28 71 71 54 3 1085 259 54 150 167 114 A E 103 283 19 175 A
Mark Salas 258 60 8 28 33 18 3 638 170 17 80 75 36 A W 358 32 8 137 A
Mike Schmidt 20 1 0 0 0 0 2 41 9 2 6 7 4 N E 78 220 6 2127.333 N
Mike Scioscia 374 94 5 36 26 62 7 1968 519 26 181 199 288 N W 756 64 15 875 N
Mickey Tettleton 211 43 10 26 35 39 3 498 116 14 59 55 78 A W 463 32 8 120 A
Milt Thompson 299 75 6 38 23 26 3 580 160 8 71 33 44 N E 212 1 2 140 N
Mitch Webster 576 167 8 89 49 57 4 822 232 19 132 83 79 N E 325 12 8 210 N
Mookie Wilson 381 110 9 61 45 32 7 3015 834 40 451 249 168 N E 228 7 5 800 N
Marvell Wynne 288 76 7 34 37 15 4 1644 408 16 198 120 113 N W 203 3 3 240 N
Mike Young 369 93 9 43 42 49 5 1258 323 54 181 177 157 A E 149 1 6 350 A
Nick Esasky 330 76 12 35 41 47 4 1367 326 55 167 198 167 N W 512 30 5 NA N
Ozzie Guillen 547 137 2 58 47 12 2 1038 271 3 129 80 24 A W 261 459 22 175 A
Oddibe McDowell 572 152 18 105 49 65 2 978 249 36 168 91 101 A W 325 13 3 200 A
Omar Moreno 359 84 4 46 27 21 12 4992 1257 37 699 386 387 N W 151 8 5 NA N
Ozzie Smith 514 144 0 67 54 79 9 4739 1169 13 583 374 528 N E 229 453 15 1940 N
Ozzie Virgil 359 80 15 45 48 63 7 1493 359 61 176 202 175 N W 682 93 13 700 N
Phil Bradley 526 163 12 88 50 77 4 1556 470 38 245 167 174 A W 250 11 1 750 A
Phil Garner 313 83 9 43 41 30 14 5885 1543 104 751 714 535 N W 58 141 23 450 N
Pete Incaviglia 540 135 30 82 88 55 1 540 135 30 82 88 55 A W 157 6 14 172 A
Paul Molitor 437 123 9 62 55 40 9 4139 1203 79 676 390 364 A E 82 170 15 1260 A
Pete O'Brien 551 160 23 86 90 87 5 2235 602 75 278 328 273 A W 1224 115 11 NA A
Pete Rose 237 52 0 15 25 30 24 14053 4256 160 2165 1314 1566 N W 523 43 6 750 N
Pat Sheridan 236 56 6 41 19 21 5 1257 329 24 166 125 105 A E 172 1 4 190 A
Pat Tabler 473 154 6 61 48 29 6 1966 566 29 250 252 178 A E 846 84 9 580 A
Rafael Belliard 309 72 0 33 31 26 5 354 82 0 41 32 26 N E 117 269 12 130 N
Rick Burleson 271 77 5 35 29 33 12 4933 1358 48 630 435 403 A W 62 90 3 450 A
Randy Bush 357 96 7 50 45 39 5 1394 344 43 178 192 136 A W 167 2 4 300 A
Rick Cerone 216 56 4 22 18 15 12 2796 665 43 266 304 198 A E 391 44 4 250 A
Ron Cey 256 70 13 42 36 44 16 7058 1845 312 965 1128 990 N E 41 118 8 1050 A
Rob Deer 466 108 33 75 86 72 3 652 142 44 102 109 102 A E 286 8 8 215 A
Rick Dempsey 327 68 13 42 29 45 18 3949 939 78 438 380 466 A E 659 53 7 400 A
Rich Gedman 462 119 16 49 65 37 7 2131 583 69 244 288 150 A E 866 65 6 NA A
Ron Hassey 341 110 9 45 49 46 9 2331 658 50 249 322 274 A E 251 9 4 560 A
Rickey Henderson 608 160 28 130 74 89 8 4071 1182 103 862 417 708 A E 426 4 6 1670 A
Reggie Jackson 419 101 18 65 58 92 20 9528 2510 548 1509 1659 1342 A W 0 0 0 487.5 A
Ricky Jones 33 6 0 2 4 7 1 33 6 0 2 4 7 A W 205 5 4 NA A
Ron Kittle 376 82 21 42 60 35 5 1770 408 115 238 299 157 A W 0 0 0 425 A
Ray Knight 486 145 11 51 76 40 11 3967 1102 67 410 497 284 N E 88 204 16 500 A
Randy Kutcher 186 44 7 28 16 11 1 186 44 7 28 16 11 N W 99 3 1 NA N
Rudy Law 307 80 1 42 36 29 7 2421 656 18 379 198 184 A W 145 2 2 NA A
Rick Leach 246 76 5 35 39 13 6 912 234 12 102 96 80 A E 44 0 1 250 A
Rick Manning 205 52 8 31 27 17 12 5134 1323 56 643 445 459 A E 155 3 2 400 A
Rance Mulliniks 348 90 11 50 45 43 10 2288 614 43 295 273 269 A E 60 176 6 450 A
Ron Oester 523 135 8 52 44 52 9 3368 895 39 377 284 296 N W 367 475 19 750 N
Rey Quinones 312 68 2 32 22 24 1 312 68 2 32 22 24 A E 86 150 15 70 A
Rafael Ramirez 496 119 8 57 33 21 7 3358 882 36 365 280 165 N W 155 371 29 875 N
Ronn Reynolds 126 27 3 8 10 5 4 239 49 3 16 13 14 N E 190 2 9 190 N
Ron Roenicke 275 68 5 42 42 61 6 961 238 16 128 104 172 N E 181 3 2 191 N
Ryne Sandberg 627 178 14 68 76 46 6 3146 902 74 494 345 242 N E 309 492 5 740 N
Rafael Santana 394 86 1 38 28 36 4 1089 267 3 94 71 76 N E 203 369 16 250 N
Rick Schu 208 57 8 32 25 18 3 653 170 17 98 54 62 N E 42 94 13 140 N
Ruben Sierra 382 101 16 50 55 22 1 382 101 16 50 55 22 A W 200 7 6 97.5 A
Roy Smalley 459 113 20 59 57 68 12 5348 1369 155 713 660 735 A W 0 0 0 740 A
Robby Thompson 549 149 7 73 47 42 1 549 149 7 73 47 42 N W 255 450 17 140 N
Rob Wilfong 288 63 3 25 33 16 10 2682 667 38 315 259 204 A W 135 257 7 341.667 A
Reggie Williams 303 84 4 35 32 23 2 312 87 4 39 32 23 N W 179 5 3 NA N
Robin Yount 522 163 9 82 46 62 13 7037 2019 153 1043 827 535 A E 352 9 1 1000 A
Steve Balboni 512 117 29 54 88 43 6 1750 412 100 204 276 155 A W 1236 98 18 100 A
Scott Bradley 220 66 5 20 28 13 3 290 80 5 27 31 15 A W 281 21 3 90 A
Sid Bream 522 140 16 73 77 60 4 730 185 22 93 106 86 N E 1320 166 17 200 N
Steve Buechele 461 112 18 54 54 35 2 680 160 24 76 75 49 A W 111 226 11 135 A
Shawon Dunston 581 145 17 66 68 21 2 831 210 21 106 86 40 N E 320 465 32 155 N
Scott Fletcher 530 159 3 82 50 47 6 1619 426 11 218 149 163 A W 196 354 15 475 A
Steve Garvey 557 142 21 58 81 23 18 8759 2583 271 1138 1299 478 N W 1160 53 7 1450 N
Steve Jeltz 439 96 0 44 36 65 4 711 148 1 68 56 99 N E 229 406 22 150 N
Steve Lombardozzi 453 103 8 53 33 52 2 507 123 8 63 39 58 A W 289 407 6 105 A
Spike Owen 528 122 1 67 45 51 4 1716 403 12 211 146 155 A W 209 372 17 350 A
Steve Sax 633 210 6 91 56 59 6 3070 872 19 420 230 274 N W 367 432 16 90 N
Tony Armas 16 2 0 1 0 0 2 28 4 0 1 0 0 A E 247 4 8 NA A
Tony Bernazard 562 169 17 88 73 53 8 3181 841 61 450 342 373 A E 351 442 17 530 A
Tom Brookens 281 76 3 42 25 20 8 2658 657 48 324 300 179 A E 106 144 7 341.667 A
Tom Brunansky 593 152 23 69 75 53 6 2765 686 133 369 384 321 A W 315 10 6 940 A
Tony Fernandez 687 213 10 91 65 27 4 1518 448 15 196 137 89 A E 294 445 13 350 A
Tim Flannery 368 103 3 48 28 54 8 1897 493 9 207 162 198 N W 209 246 3 326.667 N
Tom Foley 263 70 1 26 23 30 4 888 220 9 83 82 86 N E 81 147 4 250 N
Tony Gwynn 642 211 14 107 59 52 5 2364 770 27 352 230 193 N W 337 19 4 740 N
Terry Harper 265 68 8 26 30 29 7 1337 339 32 135 163 128 N W 92 5 3 425 A
Toby Harrah 289 63 7 36 41 44 17 7402 1954 195 1115 919 1153 A W 166 211 7 NA A
Tommy Herr 559 141 2 48 61 73 8 3162 874 16 421 349 359 N E 352 414 9 925 N
Tim Hulett 520 120 17 53 44 21 4 927 227 22 106 80 52 A W 70 144 11 185 A
Terry Kennedy 19 4 1 2 3 1 1 19 4 1 2 3 1 N W 692 70 8 920 A
Tito Landrum 205 43 2 24 17 20 7 854 219 12 105 99 71 N E 131 6 1 286.667 N
Tim Laudner 193 47 10 21 29 24 6 1136 256 42 129 139 106 A W 299 13 5 245 A
Tom O'Malley 181 46 1 19 18 17 5 937 238 9 88 95 104 A E 37 98 9 NA A
Tom Paciorek 213 61 4 17 22 3 17 4061 1145 83 488 491 244 A W 178 45 4 235 A
Tony Pena 510 147 10 56 52 53 7 2872 821 63 307 340 174 N E 810 99 18 1150 N
Terry Pendleton 578 138 1 56 59 34 3 1399 357 7 149 161 87 N E 133 371 20 160 N
Tony Perez 200 51 2 14 29 25 23 9778 2732 379 1272 1652 925 N W 398 29 7 NA N
Tony Phillips 441 113 5 76 52 76 5 1546 397 17 226 149 191 A W 160 290 11 425 A
Terry Puhl 172 42 3 17 14 15 10 4086 1150 57 579 363 406 N W 65 0 0 900 N
Tim Raines 580 194 9 91 62 78 8 3372 1028 48 604 314 469 N E 270 13 6 NA N
Ted Simmons 127 32 4 14 25 12 19 8396 2402 242 1048 1348 819 N W 167 18 6 500 N
Tim Teufel 279 69 4 35 31 32 4 1359 355 31 180 148 158 N E 133 173 9 277.5 N
Tim Wallach 480 112 18 50 71 44 7 3031 771 110 338 406 239 N E 94 270 16 750 N
Vince Coleman 600 139 0 94 29 60 2 1236 309 1 201 69 110 N E 300 12 9 160 N
Von Hayes 610 186 19 107 98 74 6 2728 753 69 399 366 286 N E 1182 96 13 1300 N
Vance Law 360 81 5 37 44 37 7 2268 566 41 279 257 246 N E 170 284 3 525 N
Wally Backman 387 124 1 67 27 36 7 1775 506 6 272 125 194 N E 186 290 17 550 N
Wade Boggs 580 207 8 107 71 105 5 2778 978 32 474 322 417 A E 121 267 19 1600 A
Will Clark 408 117 11 66 41 34 1 408 117 11 66 41 34 N W 942 72 11 120 N
Wally Joyner 593 172 22 82 100 57 1 593 172 22 82 100 57 A W 1222 139 15 165 A
Wayne Krenchicki 221 53 2 21 23 22 8 1063 283 15 107 124 106 N E 325 58 6 NA N
Willie McGee 497 127 7 65 48 37 5 2703 806 32 379 311 138 N E 325 9 3 700 N
Willie Randolph 492 136 5 76 50 94 12 5511 1511 39 897 451 875 A E 313 381 20 875 A
Wayne Tolleson 475 126 3 61 43 52 6 1700 433 7 217 93 146 A W 37 113 7 385 A
Willie Upshaw 573 144 9 85 60 78 8 3198 857 97 470 420 332 A E 1314 131 12 960 A
Willie Wilson 631 170 9 77 44 31 11 4908 1457 30 775 357 249 A W 408 4 3 1000 A

Lab06 Ridge Regression and Lasso/College100.csv

College Private Apps Accept Enroll Top10perc Top25perc F_Undergrad P_Undergrad Outstate Room_Board Books Personal PhD Terminal S_F_Ratio perc_alumni Expend Grad_Rate
Abilene Christian University Yes 1660 1232 721 23 52 2885 537 7440 3300 450 2200 70 78 18.1 12 7041 60
Adelphi University Yes 2186 1924 512 16 29 2683 1227 12280 6450 750 1500 29 30 12.2 16 10527 56
Adrian College Yes 1428 1097 336 22 50 1036 99 11250 3750 400 1165 53 66 12.9 30 8735 54
Agnes Scott College Yes 417 349 137 60 89 510 63 12960 5450 450 875 92 97 7.7 37 19016 59
Alaska Pacific University Yes 193 146 55 16 44 249 869 7560 4120 800 1500 76 72 11.9 2 10922 15
Albertson College Yes 587 479 158 38 62 678 41 13500 3335 500 675 67 73 9.4 11 9727 55
Albertus Magnus College Yes 353 340 103 17 45 416 230 13290 5720 500 1500 90 93 11.5 26 8861 63
Albion College Yes 1899 1720 489 37 68 1594 32 13868 4826 450 850 89 100 13.7 37 11487 73
Albright College Yes 1038 839 227 30 63 973 306 15595 4400 300 500 79 84 11.3 23 11644 80
Alderson-Broaddus College Yes 582 498 172 21 44 799 78 10468 3380 660 1800 40 41 11.5 15 8991 52
Alfred University Yes 1732 1425 472 37 75 1830 110 16548 5406 500 600 82 88 11.3 31 10932 73
Allegheny College Yes 2652 1900 484 44 77 1707 44 17080 4440 400 600 73 91 9.9 41 11711 76
Allentown Coll. of St. Francis de Sales Yes 1179 780 290 38 64 1130 638 9690 4785 600 1000 60 84 13.3 21 7940 74
Alma College Yes 1267 1080 385 44 73 1306 28 12572 4552 400 400 79 87 15.3 32 9305 68
Alverno College Yes 494 313 157 23 46 1317 1235 8352 3640 650 2449 36 69 11.1 26 8127 55
American International College Yes 1420 1093 220 9 22 1018 287 8700 4780 450 1400 78 84 14.7 19 7355 69
Amherst College Yes 4302 992 418 83 96 1593 5 19760 5300 660 1598 93 98 8.4 63 21424 100
Anderson University Yes 1216 908 423 19 40 1819 281 10100 3520 550 1100 48 61 12.1 14 7994 59
Andrews University Yes 1130 704 322 14 23 1586 326 9996 3090 900 1320 62 66 11.5 18 10908 46
Angelo State University No 3540 2001 1016 24 54 4190 1512 5130 3592 500 2000 60 62 23.1 5 4010 34
Antioch University Yes 713 661 252 25 44 712 23 15476 3336 400 1100 69 82 11.3 35 42926 48
Appalachian State University No 7313 4664 1910 20 63 9940 1035 6806 2540 96 2000 83 96 18.3 14 5854 70
Aquinas College Yes 619 516 219 20 51 1251 767 11208 4124 350 1615 55 65 12.7 25 6584 65
Arizona State University Main campus No 12809 10308 3761 24 49 22593 7585 7434 4850 700 2100 88 93 18.9 5 4602 48
Arkansas College (Lyon College) Yes 708 334 166 46 74 530 182 8644 3922 500 800 79 88 12.6 24 14579 54
Arkansas Tech University No 1734 1729 951 12 52 3602 939 3460 2650 450 1000 57 60 19.6 5 4739 48
Assumption College Yes 2135 1700 491 23 59 1708 689 12000 5920 500 500 93 93 13.8 30 7100 88
Auburn University-Main Campus No 7548 6791 3070 25 57 16262 1716 6300 3933 600 1908 85 91 16.7 18 6642 69
Augsburg College Yes 662 513 257 12 30 2074 726 11902 4372 540 950 65 65 12.8 31 7836 58
Augustana College IL Yes 1879 1658 497 36 69 1950 38 13353 4173 540 821 78 83 12.7 40 9220 71
Augustana College Yes 761 725 306 21 58 1337 300 10990 3244 600 1021 66 70 10.4 30 6871 69
Austin College Yes 948 798 295 42 74 1120 15 11280 4342 400 1150 81 95 13 33 11361 71
Averett College Yes 627 556 172 16 40 777 538 9925 4135 750 1350 59 67 22.4 11 6523 48
Baker University Yes 602 483 206 21 47 958 466 8620 4100 400 2250 58 68 11 21 6136 65
Baldwin-Wallace College Yes 1690 1366 662 30 61 2718 1460 10995 4410 1000 1000 68 74 17.6 20 8086 85
Barat College Yes 261 192 111 15 36 453 266 9690 4300 500 500 57 77 9.7 35 9337 71
Bard College Yes 1910 838 285 50 85 1004 15 19264 6206 750 750 98 98 10.4 30 13894 79
Barnard College Yes 2496 1402 531 53 95 2121 69 17926 8124 600 850 83 93 10.3 33 12580 91
Barry University Yes 990 784 279 18 45 1811 3144 11290 5360 600 1800 76 78 12.6 11 9084 72
Baylor University Yes 6075 5349 2367 34 66 9919 484 6450 3920 600 1346 71 76 18.5 38 7503 72
Beaver College Yes 1163 850 348 23 56 878 519 12850 5400 400 800 78 89 12.2 30 8954 73
Bellarmine College Yes 807 707 308 39 63 1198 605 8840 2950 750 1290 74 82 13.1 31 6668 84
Belmont Abbey College Yes 632 494 129 17 36 709 131 9000 4850 300 2480 78 85 13.2 10 7550 52
Belmont University Yes 1220 974 481 28 67 1964 623 7800 3664 650 900 61 61 11.1 19 7614 49
Beloit College Yes 1320 923 284 26 54 1085 81 16304 3616 355 715 87 95 11.1 26 12957 69
Bemidji State University No 1208 877 546 12 36 3796 824 4425 2700 660 1800 57 62 19.6 16 3752 46
Benedictine College Yes 632 620 222 14 24 702 501 9550 3850 350 250 64 84 14.1 18 5922 58
Bennington College Yes 519 327 114 25 53 457 2 21700 4100 600 500 35 59 10.1 33 16364 55
Bentley College Yes 3466 2330 640 20 60 3095 1533 13800 5510 630 850 87 87 17.5 20 10941 82
Berry College Yes 1858 1221 480 37 68 1620 49 8050 3940 350 2375 80 80 16.3 17 10511 63
Bethany College Yes 878 816 200 16 41 706 62 8740 3363 550 1700 62 68 11.6 29 7718 48
Bethel College KS Yes 202 184 122 19 42 537 101 8540 3580 500 1400 61 80 8.8 32 8324 56
Bethel College Yes 502 384 104 11 28 347 74 6200 2900 600 800 63 63 11.7 13 7623 35
Bethune Cookman College Yes 1646 1150 542 12 30 2128 82 5188 3396 650 2500 48 48 13.8 9 6817 58
Birmingham-Southern College Yes 805 588 287 67 88 1376 207 11660 4325 400 900 74 79 14 34 8649 72
Blackburn College Yes 500 336 156 25 55 421 27 6500 2700 500 1000 76 76 14.3 53 8377 51
Bloomsburg Univ. of Pennsylvania No 6773 3028 1025 15 55 5847 946 7844 2948 500 1680 66 68 18 19 7041 75
Bluefield College Yes 377 358 181 15 30 653 129 7150 4350 450 1500 61 67 17.8 3 6259 53
Bluffton College Yes 692 514 209 20 50 760 81 9900 3990 400 900 76 71 13.3 19 9073 58
Boston University Yes 20192 13007 3810 45 80 14971 3113 18420 6810 475 1025 80 81 11.9 16 16836 72
Bowdoin College Yes 3356 1019 418 76 100 1490 8 19030 5885 1495 875 93 96 11.2 52 20447 96
Bowling Green State University No 9251 7333 3076 14 45 13699 1213 7452 3352 600 1700 81 89 21.1 14 6918 67
Bradford College Yes 443 330 151 5 36 453 42 14080 6270 500 900 57 80 10.2 21 15387 46
Bradley University Yes 3767 3414 1061 30 58 4531 643 10870 4440 2000 1522 75 81 14.4 21 7671 85
Brandeis University Yes 4186 2743 740 48 77 2819 62 19380 6750 410 1000 90 97 9.8 24 17150 84
Brenau University Yes 367 274 158 12 41 917 479 9592 5879 500 700 71 80 13.7 12 5935 49
Brewton-Parker College Yes 1436 1228 1202 10 26 1320 822 4371 2370 500 2000 62 62 12.6 10 4900 18
Briar Cliff College Yes 392 351 155 16 44 738 430 10260 3597 600 1500 39 66 13.1 26 8355 58
Bridgewater College Yes 838 673 292 22 53 881 55 10265 4725 560 875 68 73 13.2 24 8655 82
Brigham Young University at Provo Yes 7365 5402 4615 48 82 27378 1253 2340 3580 860 1220 76 76 20.5 40 7916 33
Brown University Yes 12586 3239 1462 87 95 5643 349 19528 5926 720 1100 99 100 7.6 39 20440 97
Bryn Mawr College Yes 1465 810 313 71 95 1088 16 18165 6750 500 1200 100 100 12.3 49 17449 89
Bucknell University Yes 6548 3813 862 49 85 3316 31 18550 4750 800 1200 95 97 14.2 36 13675 93
Buena Vista College Yes 860 688 285 32 70 1928 442 13306 3797 450 950 62 69 8.8 10 6333 78
Butler University Yes 2362 2037 700 40 68 2607 148 13130 4650 500 1600 77 81 10.9 29 9511 83
Cabrini College Yes 599 494 224 8 28 1035 446 10518 6250 300 300 59 76 16.5 36 7117 71
Caldwell College Yes 1011 604 213 17 42 693 868 8900 4600 425 1000 87 96 13.9 25 7922 55
California Lutheran University Yes 563 247 247 23 52 1427 432 12950 5300 612 576 72 74 12.4 17 8985 60
California Polytechnic-San Luis No 7811 3817 1650 47 73 12911 1404 7380 4877 612 2091 72 81 19.8 13 8453 59
California State University at Fresno No 4540 3294 1483 5 60 13494 1254 7706 4368 600 1926 90 90 21.2 8 7268 61
Calvin College Yes 1784 1512 913 29 56 3401 136 10230 3710 400 1210 75 81 14.8 41 7786 81
Campbell University Yes 2087 1339 657 20 54 3191 1204 7550 2790 600 500 77 77 21.8 34 3739 63
Campbellsville College Yes 848 587 298 25 55 935 184 6060 3070 600 1300 62 66 17.7 13 5391 49
Canisius College Yes 2853 2193 753 16 34 2978 434 10750 5340 400 1130 90 92 14.6 26 7972 64
Capital University Yes 1747 1382 449 34 66 1662 960 13050 4000 500 800 64 69 12.1 27 9557 83
Capitol College Yes 100 90 35 10 52 282 331 8400 2812 300 2134 10 50 12.1 24 7976 52
Carleton College Yes 2694 1579 489 75 93 1870 12 19292 3957 550 550 81 93 10.4 60 17960 91
Carnegie Mellon University Yes 8728 5201 1191 60 89 4265 291 17900 5690 450 1250 86 93 9.2 31 24386 74
Carroll College Yes 1160 991 352 19 55 1357 737 12200 3880 480 930 74 81 17.8 25 7666 79
Carson-Newman College Yes 1096 951 464 27 62 1776 239 8150 3150 400 500 61 62 13.6 16 6716 67
Carthage College Yes 1616 1427 434 20 43 1405 580 13125 3775 500 1300 74 89 15.9 22 7364 62
Case Western Reserve University Yes 3877 3156 713 71 93 3051 513 15700 4730 525 1460 95 95 2.9 29 19733 67
Castleton State College No 1257 940 363 9 22 1547 294 7656 4690 400 700 89 91 14.7 8 6318 79
Catawba College Yes 1083 880 291 13 34 915 80 9270 4100 600 1860 75 82 13.5 27 8425 55
Catholic University of America Yes 1754 1465 505 24 49 2159 211 13712 6408 526 1100 90 96 9.3 18 12751 75
Cazenovia College Yes 3847 3433 527 9 35 1010 12 9384 4840 600 500 22 47 14.3 20 7697 118
Cedar Crest College Yes 776 607 198 25 58 791 764 14340 5285 500 1000 58 83 11.7 39 10961 74
Cedarville College Yes 1307 1090 616 25 55 2196 82 7344 4410 570 1000 50 52 15.3 34 6897 64
Centenary College Yes 369 312 90 12 46 396 526 11400 5400 500 760 41 85 9.5 20 9583 24
Centenary College of Louisiana Yes 495 434 210 35 55 775 44 8950 3490 600 1900 86 92 11.3 25 9685 66

Lab06 Ridge Regression and Lasso/07_chap06_Subset Selection and Shrinkage Methods.pptx

Linear Model Selection and regularization

Chapter 06

IOM 530: Intro. to Statistical Learning

1

1

Outline

Subset Selection

Best Subset Selection

Stepwise Selection

Choosing the Optimal Model

Shrinkage Methods

Ridge Regression

The Lasso

IOM 530: Intro. to Statistical Learning

2

2

Improving on the Least Squares Regression Estimates?

We want to improve the Linear Regression model, by replacing the least square fitting with some alternative fitting procedure, i.e., the values that minimize the mean square error (MSE)

There are 2 reasons we might not prefer to just use the ordinary least squares (OLS) estimates

Prediction Accuracy

Model Interpretability

IOM 530: Intro. to Statistical Learning

3

1. Prediction Accuracy

The least squares estimates have relatively low bias and low variability especially when the relationship between Y and X is linear and the number of observations n is way bigger than the number of predictors p

But, when , then the least squares fit can have high variance and may result in over fitting and poor estimates on unseen observations,

And, when , then the variability of the least squares fit increases dramatically, and the variance of these estimates in infinite

IOM 530: Intro. to Statistical Learning

4

2. Model Interpretability

When we have a large number of variables X in the model there will generally be many that have little or no effect on Y

Leaving these variables in the model makes it harder to see the “big picture”, i.e., the effect of the “important variables”

The model would be easier to interpret by removing (i.e. setting the coefficients to zero) the unimportant variables

IOM 530: Intro. to Statistical Learning

5

Solution

Subset Selection

Identifying a subset of all p predictors X that we believe to be related to the response Y, and then fitting the model using this subset

E.g. best subset selection and stepwise selection

Shrinkage

Involves shrinking the estimates coefficients towards zero

This shrinkage reduces the variance

Some of the coefficients may shrink to exactly zero, and hence shrinkage methods can also perform variable selection

E.g. Ridge regression and the Lasso

Dimension Reduction

Involves projecting all p predictors into an M-dimensional space where M < p, and then fitting linear regression model

E.g. Principle Components Regression

IOM 530: Intro. to Statistical Learning

6

6.1 Subset selection

IOM 530: Intro. to Statistical Learning

7

6.6.1 Best Subset Selection

In this approach, we run a linear regression for each possible combination of the X predictors

How do we judge which subset is the “best”?

One simple approach is to take the subset with the smallest RSS or the largest R2

Unfortunately, one can show that the model that includes all the variables will always have the largest R2 (and smallest RSS)

IOM 530: Intro. to Statistical Learning

8

Credit Data: R2 vs. Subset Size

The RSS/R2 will always decline/increase as the number of variables increase so they are not very useful

The red line tracks the best model for a given number of predictors, according to RSS and R2

IOM 530: Intro. to Statistical Learning

9

Other Measures of Comparison

To compare different models, we can use other approaches:

Adjusted R2

AIC (Akaike information criterion)

BIC (Bayesian information criterion)

Cp (equivalent to AIC for linear regression)

These methods add penalty to RSS for the number of variables (i.e. complexity) in the model

None are perfect

IOM 530: Intro. to Statistical Learning

10

+ Penalty(p’s)

Revised

Credit Data: Cp, BIC, and Adjusted R2

A small value of Cp and BIC indicates a low error, and thus a better model

A large value for the Adjusted R2 indicates a better model

IOM 530: Intro. to Statistical Learning

11

6.1.2 Stepwise Selection

Best Subset Selection is computationally intensive especially when we have a large number of predictors (large p)

More attractive methods:

Forward Stepwise Selection: Begins with the model containing no predictor, and then adds one predictor at a time that improves the model the most until no further improvement is possible

Backward Stepwise Selection: Begins with the model containing all predictors, and then deleting one predictor at a time that improves the model the most until no further improvement is possible

IOM 530: Intro. to Statistical Learning

12

6.2 Shrinkage Methods

IOM 530: Intro. to Statistical Learning

13

6.2.1 Ridge Regression

Ordinary Least Squares (OLS) estimates by minimizing the Residual Sum of Square (RSS)

Ridge Regression uses a slightly different equation

IOM 530: Intro. to Statistical Learning

14

Ridge Regression Adds a Penalty on !

The effect of this equation is to add a penalty of the form

Where the tuning parameter is a positive value.

This has the effect of “shrinking” large values of towards zero.

It turns out that such a constraint should improve the fit, because shrinking the coefficients can significantly reduce their variance

Notice that when = 0, we get the OLS!

IOM 530: Intro. to Statistical Learning

15

Credit Data: Ridge Regression

As increases, the standardized coefficients shrinks towards zero.

IOM 530: Intro. to Statistical Learning

16

Why can shrinking towards zero be a good thing to do?

It turns out that the OLS estimates generally have low bias but can be highly variable. In particular when n and p are of similar size or when n < p, then the OLS estimates will be extremely variable

The penalty term makes the ridge regression estimates biased but can also substantially reduce variance

Thus, there is a bias/ variance trade-off

IOM 530: Intro. to Statistical Learning

17

Ridge Regression Bias/ Variance

Black: Bias

Green: Variance

Purple: MSE

Increase increases bias but decreases variance

IOM 530: Intro. to Statistical Learning

18

Bias/ Variance Trade-off

In general, the ridge regression estimates will be more biased than the OLS ones but have lower variance.

Ridge regression will work best in situations where the OLS estimates have high variance

IOM 530: Intro. to Statistical Learning

19

Computational Advantages of Ridge Regression

If p is large, then using the best subset selection approach requires searching through enormous numbers of possible models

With Ridge Regression, for any given , we only need to fit one model and the computations turn out to be very simple

Ridge Regression can even be used when p > n, a situation where OLS fails completely!

IOM 530: Intro. to Statistical Learning

20

6.2.2. The LASSO

Ridge Regression isn’t perfect

One significant problem is that the penalty term will never force any of the coefficients to be exactly zero. Thus, the final model will include all variables, which makes it harder to interpret

A more modern alternative is the LASSO

The LASSO works in a similar way to Ridge Regression, except it uses a different penalty term

IOM 530: Intro. to Statistical Learning

21

LASSO’s Penalty Term

Ridge Regression minimizes

The LASSO estimates the by minimizing the

IOM 530: Intro. to Statistical Learning

22

What’s the Big Deal?

This seems like a very similar idea but there is a big difference

Using this penalty, it could be proven mathematically that some coefficients end up being set to exactly zero

With LASSO, we can produce a model that has high predictive power and it is simple to interpret

IOM 530: Intro. to Statistical Learning

23

Credit Data: LASSO

IOM 530: Intro. to Statistical Learning

24

6.2.3 Selecting the Tuning Parameter

We need to decide on a value for

Select a grid of potential values, use cross validation to estimate the error rate on test data (for each value of ) and select the value that gives the least error rate

IOM 530: Intro. to Statistical Learning

25

å

=

-

=

n

i

i

i

y

y

n

MSE

1

2

)

ˆ

(

1

n ≈ p

n»p

n < p

n<p

(n >> p)

(n>>p)

Yi = β0 +β1X1 +β2X2 ++βpXp +ε

Y

i

=b

0

+b

1

X

1

+b

2

X

2

++b

p

X

p

+e

Variance

Starting

Variance

Ending

1

)

(

1

2

2

-

»

-

-

=

å

Y

Y

RSS

R

i

Ŷi = β̂0 + β̂1X1 + β̂2X2 ++ β̂pXp

ˆ

Y

i

=

ˆ

b

0

+

ˆ

b

1

X

1

+

ˆ

b

2

X

2

++

ˆ

b

p

X

p

2 4 6 8 10

2 e

+ 0

7 4

e +

0 7

6 e

+ 0

7 8

e +

0 7

Number of Predictors

R e

s id

u a

l S

u m

o f

S q

u a

re s

2 4 6 8 10

0 .0

0 .2

0 .4

0 .6

0 .8

1 .0

Number of Predictors

R 2

2 4 6 8 10

1 0 0 0 0

1 5 0 0 0

2 0 0 0 0

2 5 0 0 0

3 0 0 0 0

Number of Predictors

C p

2 4 6 8 10

1 0 0 0 0

1 5 0 0 0

2 0 0 0 0

2 5 0 0 0

3 0 0 0 0

Number of Predictors B

IC 2 4 6 8 10

0 .8

6 0 .8

8 0 .9

0 0 .9

2 0 .9

4 0 .9

6

Number of Predictors

A d ju

s te

d R

2

β 's

b's

6.2 Shrinkage Methods 217

shrinking the coe!cient estimates can significantly reduce their variance. The two best-known techniques for shrinking the regression coe!cients towards zero are ridge regression and the lasso.

6.2.1 Ridge Regression

Recall from Chapter 3 that the least squares fitting procedure estimates !0, !1, . . . , !p using the values that minimize

RSS = n!

i=1

"

#yi !!0 ! p!

j=1

!jxij

$

% 2

.

Ridge regression is very similar to least squares, except that the coe!cients ridge regression

are estimated by minimizing a slightly di"erent quantity. In particular, the ridge regression coe!cient estimates !̂R are the values that minimize

n!

i=1

"

#yi !!0 ! p!

j=1

!jxij

$

% 2

+ " p!

j=1

!2j = RSS + " p!

j=1

!2j , (6.5)

where " " 0 is a tuning parameter, to be determined separately. Equa- tuning parameter

tion 6.5 trades o" two di"erent criteria. As with least squares, ridge regres- sion seeks coe!cient estimates that fit the data well, by making the RSS small. However, the second term, "

& j !

2 j , called a shrinkage penalty, is shrinkage penalty

small when !1, . . . , !p are close to zero, and so it has the e"ect of shrinking the estimates of !j towards zero. The tuning parameter " serves to control the relative impact of these two terms on the regression coe!cient esti- mates. When " = 0, the penalty term has no e"ect, and ridge regression will produce the least squares estimates. However, as " #$, the impact of the shrinkage penalty grows, and the ridge regression coe!cient estimates will approach zero. Unlike least squares, which generates only one set of co- e!cient estimates, ridge regression will produce a di"erent set of coe!cient estimates, !̂R! , for each value of ". Selecting a good value for " is critical; we defer this discussion to Section 6.2.3, where we use cross-validation. Note that in (6.5), the shrinkage penalty is applied to !1, . . . , !p, but

not to the intercept !0. We want to shrink the estimated association of each variable with the response; however, we do not want to shrink the intercept, which is simply a measure of the mean value of the response when xi1 = xi2 = . . . = xip = 0. If we assume that the variables — that is, the columns of the data matrix X — have been centered to have mean zero before ridge regression is performed, then the estimated intercept will take the form !̂0 = ȳ =

&n i=1 yi/n.

6.2 Shrinkage Methods 217

shrinking the coe!cient estimates can significantly reduce their variance. The two best-known techniques for shrinking the regression coe!cients towards zero are ridge regression and the lasso.

6.2.1 Ridge Regression

Recall from Chapter 3 that the least squares fitting procedure estimates !0, !1, . . . , !p using the values that minimize

RSS = n!

i=1

"

#yi !!0 ! p!

j=1

!jxij

$

% 2

.

Ridge regression is very similar to least squares, except that the coe!cients ridge regression

are estimated by minimizing a slightly di"erent quantity. In particular, the ridge regression coe!cient estimates !̂R are the values that minimize

n!

i=1

"

#yi !!0 ! p!

j=1

!jxij

$

% 2

+ " p!

j=1

!2j = RSS + " p!

j=1

!2j , (6.5)

where " " 0 is a tuning parameter, to be determined separately. Equa- tuning parameter

tion 6.5 trades o" two di"erent criteria. As with least squares, ridge regres- sion seeks coe!cient estimates that fit the data well, by making the RSS small. However, the second term, "

& j !

2 j , called a shrinkage penalty, is shrinkage penalty

small when !1, . . . , !p are close to zero, and so it has the e"ect of shrinking the estimates of !j towards zero. The tuning parameter " serves to control the relative impact of these two terms on the regression coe!cient esti- mates. When " = 0, the penalty term has no e"ect, and ridge regression will produce the least squares estimates. However, as " #$, the impact of the shrinkage penalty grows, and the ridge regression coe!cient estimates will approach zero. Unlike least squares, which generates only one set of co- e!cient estimates, ridge regression will produce a di"erent set of coe!cient estimates, !̂R! , for each value of ". Selecting a good value for " is critical; we defer this discussion to Section 6.2.3, where we use cross-validation. Note that in (6.5), the shrinkage penalty is applied to !1, . . . , !p, but

not to the intercept !0. We want to shrink the estimated association of each variable with the response; however, we do not want to shrink the intercept, which is simply a measure of the mean value of the response when xi1 = xi2 = . . . = xip = 0. If we assume that the variables — that is, the columns of the data matrix X — have been centered to have mean zero before ridge regression is performed, then the estimated intercept will take the form !̂0 = ȳ =

&n i=1 yi/n.

6.2 Shrinkage Methods 217

shrinking the coe!cient estimates can significantly reduce their variance. The two best-known techniques for shrinking the regression coe!cients towards zero are ridge regression and the lasso.

6.2.1 Ridge Regression

Recall from Chapter 3 that the least squares fitting procedure estimates !0, !1, . . . , !p using the values that minimize

RSS = n!

i=1

"

#yi !!0 ! p!

j=1

!jxij

$

% 2

.

Ridge regression is very similar to least squares, except that the coe!cients ridge regression

are estimated by minimizing a slightly di"erent quantity. In particular, the ridge regression coe!cient estimates !̂R are the values that minimize

n!

i=1

"

#yi !!0 ! p!

j=1

!jxij

$

% 2

+ " p!

j=1

!2j = RSS + " p!

j=1

!2j , (6.5)

where " " 0 is a tuning parameter, to be determined separately. Equa- tuning parameter

tion 6.5 trades o" two di"erent criteria. As with least squares, ridge regres- sion seeks coe!cient estimates that fit the data well, by making the RSS small. However, the second term, "

& j !

2 j , called a shrinkage penalty, is shrinkage penalty

small when !1, . . . , !p are close to zero, and so it has the e"ect of shrinking the estimates of !j towards zero. The tuning parameter " serves to control the relative impact of these two terms on the regression coe!cient esti- mates. When " = 0, the penalty term has no e"ect, and ridge regression will produce the least squares estimates. However, as " #$, the impact of the shrinkage penalty grows, and the ridge regression coe!cient estimates will approach zero. Unlike least squares, which generates only one set of co- e!cient estimates, ridge regression will produce a di"erent set of coe!cient estimates, !̂R! , for each value of ". Selecting a good value for " is critical; we defer this discussion to Section 6.2.3, where we use cross-validation. Note that in (6.5), the shrinkage penalty is applied to !1, . . . , !p, but

not to the intercept !0. We want to shrink the estimated association of each variable with the response; however, we do not want to shrink the intercept, which is simply a measure of the mean value of the response when xi1 = xi2 = . . . = xip = 0. If we assume that the variables — that is, the columns of the data matrix X — have been centered to have mean zero before ridge regression is performed, then the estimated intercept will take the form !̂0 = ȳ =

&n i=1 yi/n.

6.2 Shrinkage Methods 217

shrinking the coe!cient estimates can significantly reduce their variance. The two best-known techniques for shrinking the regression coe!cients towards zero are ridge regression and the lasso.

6.2.1 Ridge Regression

Recall from Chapter 3 that the least squares fitting procedure estimates !0, !1, . . . , !p using the values that minimize

RSS = n!

i=1

"

#yi !!0 ! p!

j=1

!jxij

$

% 2

.

Ridge regression is very similar to least squares, except that the coe!cients ridge regression

are estimated by minimizing a slightly di"erent quantity. In particular, the ridge regression coe!cient estimates !̂R are the values that minimize

n!

i=1

"

#yi !!0 ! p!

j=1

!jxij

$

% 2

+ " p!

j=1

!2j = RSS + " p!

j=1

!2j , (6.5)

where " " 0 is a tuning parameter, to be determined separately. Equa- tuning parameter

tion 6.5 trades o" two di"erent criteria. As with least squares, ridge regres- sion seeks coe!cient estimates that fit the data well, by making the RSS small. However, the second term, "

& j !

2 j , called a shrinkage penalty, is shrinkage penalty

small when !1, . . . , !p are close to zero, and so it has the e"ect of shrinking the estimates of !j towards zero. The tuning parameter " serves to control the relative impact of these two terms on the regression coe!cient esti- mates. When " = 0, the penalty term has no e"ect, and ridge regression will produce the least squares estimates. However, as " #$, the impact of the shrinkage penalty grows, and the ridge regression coe!cient estimates will approach zero. Unlike least squares, which generates only one set of co- e!cient estimates, ridge regression will produce a di"erent set of coe!cient estimates, !̂R! , for each value of ". Selecting a good value for " is critical; we defer this discussion to Section 6.2.3, where we use cross-validation. Note that in (6.5), the shrinkage penalty is applied to !1, . . . , !p, but

not to the intercept !0. We want to shrink the estimated association of each variable with the response; however, we do not want to shrink the intercept, which is simply a measure of the mean value of the response when xi1 = xi2 = . . . = xip = 0. If we assume that the variables — that is, the columns of the data matrix X — have been centered to have mean zero before ridge regression is performed, then the estimated intercept will take the form !̂0 = ȳ =

&n i=1 yi/n.

1e−02 1e+00 1e+02 1e+04

− 3

0 0

− 1

0 0

0 1

0 0

2 0

0 3

0 0

4 0

0

S ta

n d a rd

iz e d C

o e ff ic

ie n ts

Income Limit Rating Student

0.0 0.2 0.4 0.6 0.8 1.0

− 3

0 0

− 1

0 0

0 1

0 0

2 0

0 3

0 0

4 0

0

S ta

n d a rd

iz e d C

o e ff ic

ie n ts

λ ‖β̂R λ ‖2/‖β̂‖2

1e−01 1e+01 1e+03

0 1

0 2

0 3

0 4

0 5

0 6

0

M e

a n

S q

u a

re d

E rr

o r

0.0 0.2 0.4 0.6 0.8 1.0

0 1

0 2

0 3

0 4

0 5

0 6

0

M e

a n

S q

u a

re d

E rr

o r

λ ‖β̂R λ ‖2/‖β̂‖2

6.2 Shrinkage Methods 221

Ridge regression also has substantial computational advantages over best subset selection, which requires searching through 2p models. As we dis- cussed previously, even for moderate values of p, such a search can be computationally infeasible. In contrast, for any fixed value of !, ridge re- gression only fits a single model, and the model-fitting procedure can be performed quite quickly. In fact, one can show that the computations re- quired to solve (6.5), simultaneously for all values of !, are almost identical to those for fitting a model using least squares.

6.2.2 The Lasso

Ridge regression does have one obvious disadvantage. Unlike best subset, forward stepwise, and backward stepwise selection, which will generally select models that involve just a subset of the variables, ridge regression will include all p predictors in the final model. The penalty !

! "2j in (6.5)

will shrink all of the coe!cients towards zero, but it will not set any of them exactly to zero (unless ! = !). This may not be a problem for prediction accuracy, but it can create a challenge in model interpretation in settings in which the number of variables p is quite large. For example, in the Credit data set, it appears that the most important variables are income, limit, rating, and student. So we might wish to build a model including just these predictors. However, ridge regression will always generate a model involving all ten predictors. Increasing the value of ! will tend to reduce the magnitudes of the coe!cients, but will not result in exclusion of any of the variables. The lasso is a relatively recent alternative to ridge regression that over-

lasso comes this disadvantage. The lasso coe!cients, "̂L! , minimize the quantity

n"

i=1

#

$yi ""0 " p"

j=1

"jxij

%

& 2

+ ! p"

j=1

|"j| = RSS + ! p"

j=1

|"j|. (6.7)

Comparing (6.7) to (6.5), we see that the lasso and ridge regression have similar formulations. The only di"erence is that the "2j term in the ridge regression penalty (6.5) has been replaced by |"j| in the lasso penalty (6.7). In statistical parlance, the lasso uses an #1 (pronounced “ell 1”) penalty instead of an #2 penalty. The #1 norm of a coe!cient vector " is given by #"#1 =

! |"j|.

As with ridge regression, the lasso shrinks the coe!cient estimates to- wards zero. However, in the case of the lasso, the #1 penalty has the e"ect of forcing some of the coe!cient estimates to be exactly equal to zero when the tuning parameter ! is su!ciently large. Hence, much like best subset se- lection, the lasso performs variable selection. As a result, models generated from the lasso are generally much easier to interpret than those produced by ridge regression. We say that the lasso yields sparse models — that is, sparse

20 50 100 200 500 2000 5000

− 2

0 0

0 1

0 0

2 0

0 3

0 0

4 0

0

S ta

n d a rd

iz e d C

o e ff ic

ie n ts

0.0 0.2 0.4 0.6 0.8 1.0

− 3

0 0

− 1

0 0

0 1

0 0

2 0

0 3

0 0

4 0

0

S ta

n d a rd

iz e d C

o e ff ic

ie n ts

Income Limit Rating Student

λ ‖β̂L λ ‖1/‖β̂‖1

5e−03 5e−02 5e−01 5e+00

2 5

.0 2

5 .2

2 5

.4 2

5 .6

C ro

s s −

V a

li d

a ti o

n E

rr o

r

5e−03 5e−02 5e−01 5e+00

− 3

0 0

− 1

0 0

0 1

0 0

3 0

0

S ta

n d

a rd

iz e

d C

o e

ff ic

ie n

ts

λλ