Skip to content

Instantly share code, notes, and snippets.

@pb111
Created November 16, 2018 07:52
Show Gist options
  • Save pb111/1a9c3759804ba14e01b65063d3ef3edd to your computer and use it in GitHub Desktop.
Save pb111/1a9c3759804ba14e01b65063d3ef3edd to your computer and use it in GitHub Desktop.
SLR
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"% matplotlib inline\n",
"\n",
"# The above command sets the backend of matplotlib to the 'inline' backend. \n",
"# It means the output of plotting commands is displayed inline."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# Import necessary libraries\n",
"\n",
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# Import the data\n",
"\n",
"url = \"C:/project_datasets/SALES.txt\"\n",
"df = pd.read_csv(url, sep='\\t', header=None)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(36, 2)\n"
]
}
],
"source": [
"# Exploratory data analysis\n",
"\n",
"# View the dimensions of df\n",
"\n",
"print(df.shape)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0 1\n",
"0 12.0 15.0\n",
"1 20.5 16.0\n",
"2 21.0 18.0\n",
"3 15.5 27.0\n",
"4 15.3 21.0\n"
]
}
],
"source": [
"# View the top 5 rows of df\n",
"\n",
"print(df.head())"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"# Rename columns of df dataframe\n",
"\n",
"df.columns = ['Sales', 'Advertising']"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Sales Advertising\n",
"0 12.0 15.0\n",
"1 20.5 16.0\n",
"2 21.0 18.0\n",
"3 15.5 27.0\n",
"4 15.3 21.0\n"
]
}
],
"source": [
"# View the top 5 rows of df with column names renamed\n",
"\n",
"print(df.head())"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 36 entries, 0 to 35\n",
"Data columns (total 2 columns):\n",
"Sales 36 non-null float64\n",
"Advertising 36 non-null float64\n",
"dtypes: float64(2)\n",
"memory usage: 656.0 bytes\n",
"None\n"
]
}
],
"source": [
"# View dataframe summary\n",
"\n",
"print(df.info())"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Sales Advertising\n",
"count 36.000000 36.000000\n",
"mean 24.255556 28.527778\n",
"std 6.185118 18.777625\n",
"min 12.000000 1.000000\n",
"25% 20.300000 15.750000\n",
"50% 24.250000 23.000000\n",
"75% 28.600000 41.000000\n",
"max 36.500000 65.000000\n"
]
}
],
"source": [
"# View descriptive statistics\n",
"\n",
"print(df.describe())"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"# Declare feature variable and target array\n",
"\n",
"X = df['Sales'].values\n",
"y = df['Advertising'].values\n",
"\n",
"# Sales and Advertising data values are given by X and y respectively.\n",
"\n",
"# Values attribute of pandas dataframe returns the numpy arrays."
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(36,)\n",
"(36,)\n"
]
}
],
"source": [
"# Print the dimensions of X and y\n",
"\n",
"print(X.shape)\n",
"print(y.shape)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"# Reshape X and y\n",
"\n",
"X = X.reshape(-1,1)\n",
"y = y.reshape(-1,1)\n",
"\n",
"# Since we are working with only one feature variable, so we need to do reshaping using NumPy's reshape() method. \n",
"# It specifies first dimension to be -1, which means \"unspecified\". \n",
"# Its value is inferred from the length of the array and the remaining dimensions. \n",
" "
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(36, 1)\n",
"(36, 1)\n"
]
}
],
"source": [
"# Print the dimensions of X and y after reshaping\n",
"\n",
"print(X.shape)\n",
"print(y.shape)\n",
"\n",
"# We can see the difference in dimensions of X and y before and after reshaping.\n",
"# It is essential in this case because getting the feature and target variable arrays into the right format for scikit-learn \n",
"# is an important precursor to model building."
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEWCAYAAABrDZDcAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3Xm8HGWd7/HPNwkhBKIhEGIgGzrInoR4QFzAgICoIMvAIEYnIFdcGWfmjgIyIM7IvcGrRq8zwkQRIgYIAyiIXAWUsCjbCQSERBYhgZgQToBgEggk4Xf/qOcknUOfc/os1dXL9/169au7q6uqf7V0/bqep56nFBGYmVnzGlB0AGZmViwnAjOzJudEYGbW5JwIzMyanBOBmVmTcyIwM2tyTgRVJmmqpKV9mP5iSef2Z0xlviMk/U0nn02TdHMv53u+pJ/1LbrGJOkySd8sOo7O9HW/LTO/qu4Lkh6VNLWbccZJWiNpYJXCqhlOBL0gabGkV9NO81z6EW+Xw/ecIumu0mER8bmI+Pf+/q5KRcSciDii2t9bD0lE0hhJ10paKellSX+UdErRcVWLMk9JWlhwHG9KqhGxd0TM62q6iHgmIraLiI25BliDnAh67+iI2A6YDOwHnF1wPFa8y4FngfHADsDfAysKjai6DgZ2At4uaf8iAmjGf/P9wYmgjyL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eeeCJHH300RxxxRJexHnTQQTz55JNbDIsIvvKVr7DPPvuw7777Mnfu3DfFM3PmzN6voHIqOW0o+tHoRUPjx29Z1NL+GD++6MjerJ5itWL0pGgoj/1p9erVMWnSpNhtt93i85//fMybNy8iIl577bXYdddd47777ouIiJdffjnWr18fa9eujVdffTUiIh5//PFoP97cdttt8dGPfnTTfC+99NL44he/uOn92WefHZdffnlERLz00kux2267xZo1a+LSSy+NXXbZJV544YWy8bUXAa1fvz4+9rGPxQ9/+MMthl9zzTVx2GGHxYYNG+K5556LsWPHxrJly94UT0cuGqpz9XRlSD3FarUvjzPM7bbbjvnz5zNr1ixGjhzJSSedxGWXXcZjjz3G6NGj2X///QF4y1vewqBBg1i/fj2f+cxn2HfffTnxxBNZuHBhRd9z8803M2PGDCZPnszUqVNZt24dz6TADz/8cEaMGFF2uldffZXJkyfT0tLCuHHjOO2007b4/K677uLkk09m4MCBjBo1ig984APcf//9vV8hFXCDshrQfgXIOedkP4Bx47IDa2dXhsyZU/m4Rcdq1pVx48q3nO5rO4mBAwcydepUpk6dyr777svs2bOZMmVK2cssZ86cyahRo3jooYd44403GDJkSEXfERFce+217L777ltRHKnVAAAHQElEQVQMv/fee9l22207na69jqCr+VabzwhqRKUdeOVRpppXrGbdyeMM87HHHuOJJ57Y9H7BggWMHz+ePfbYg2XLlm36d7169Wo2bNjAyy+/zOjRoxkwYACXX345GzduBGDYsGGsXr1603w6vv/Qhz7ED37wg00H7gcffLD3QZc4+OCDmTt3Lhs3bqStrY077riDAw444E3f35+cCOqMr9qxRpJHO4k1a9Ywffp09tprLyZOnMjChQs5//zzGTx4MHPnzuWMM85g0qRJHH744axbt44vfOELzJ49mwMPPJDHH39807/5iRMnMmjQICZNmsTMmTM55JBDWLhw4abK4nPPPZf169czceJE9tlnH84999x+WSfHHXccEydOZNKkSRx66KF861vf4m1ve9ub4ulPhXQ6J+lI4PvAQODHETGjq/GbtdO5cgYMyM4EOpKyf+hmRVu0aBF77rln0WE0nXLrvdJ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HI3yzYHiIhVwDzgQGC4pPbu7hv6boQly31kKiKMiHgNuJQa395OBAVoPxAmxwGPdDZuvUqVaJcAiyLiuyUf3QBMT6+nA9dXO7Y8dbbcjb7NJY2UNDy93gY4jKx+5DbghDRaI27vcsv9p5I/OyKrF6np7e2rhnIm6UpgKlm3tCuAr6f3k8lOkxcDn20vN28Ukt4P3An8EXgjDf4aWXn51cA44BngxIhomMr0Lpb7ZBp4m0uaSFYZPJDsD+bVEfFvkt4OXEVWPPIg8Mn0L7khdLHcvwNGAgIWAJ8rqVSuOU4EZmZNzkVDZmZNzonAzKzJORGYmTU5JwIzsybnRGBm1uScCMw6kHRO6kny4dRz5Lu7GPcySSd09rlZPRjU/ShmzUPSe4CjgCkR8ZqkHYGG6jrZrCOfEZhtaTSwsr3RU0SsjIhlks6TdL+kRyTNSi1GtyDpXZJulzRf0m9KWpf+g6SF6Qzjqiovj1m33KDMrETqLO4uYChwKzA3Im6XNKK9BbSky8lakP5S0mXAjWRdJ9wOHBMRbZJOAj4UEZ+WtAzYNZ1hDE990pjVDBcNmZVINxh5F3AQcAgwN91AZ7Wkr5IliBHAo8AvSybdHdgHuCWdLAwk62UU4GFgjqRfAL+oyoKY9YATgVkHEbGRrBfJeZL+CHwWmAi0RMSz6Q5zQzpMJuDRiHhPmVl+FDgY+BhwrqS9S/roNyuc6wjMSkjaXdJuJYMmA4+l1ytT0VG5q4QeA0amymYkbSVpb0kDgLERcRvwVWA4sF1+S2DWcz4jMNvSdsAPUtfCG4AngdOBVWQ9ii4G7u84UUS8ni4j/b+S3kr22/oe8DjwszRMwEzXEVitcWWxmVmTc9GQmVmTcyIwM2tyTgRmZk3OicDMrMk5EZiZNTknAjOzJudEYGbW5P4/kkA+VxUYcxYAAAAASUVORK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Visualizing the relationship between X and y by scatterplot\n",
"\n",
"# Plot scatter plot between X and y\n",
"\n",
"plt.scatter(X, y, color = 'blue', label='Scatter Plot')\n",
"plt.title('Relationship between Sales and Advertising')\n",
"plt.xlabel('Sales')\n",
"plt.ylabel('Advertising')\n",
"plt.legend(loc=4)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"# Split X and y into training and test data sets\n",
"\n",
"from sklearn.model_selection import train_test_split\n",
"X_train,X_test,y_train,y_test = train_test_split(X, y, test_size=0.33, random_state=42)\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(24, 1)\n",
"(24, 1)\n",
"(12, 1)\n",
"(12, 1)\n"
]
}
],
"source": [
"# Print the dimensions of X_train,X_test,y_train,y_test\n",
"\n",
"print(X_train.shape)\n",
"print(y_train.shape)\n",
"print(X_test.shape)\n",
"print(y_test.shape)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"# Fit the linear model\n",
"\n",
"# Instantiate the linear regression object lm\n",
"from sklearn.linear_model import LinearRegression\n",
"lm = LinearRegression()\n",
"\n",
"\n",
"# Train the model using training data sets\n",
"lm.fit(X_train,y_train)\n",
"\n",
"\n",
"# Predict on the test data\n",
"y_pred=lm.predict(X_test)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"RMSE value: 11.2273\n"
]
}
],
"source": [
"# Calculate and print Root Mean Square Error(RMSE)\n",
"\n",
"from sklearn.metrics import mean_squared_error\n",
"mse = mean_squared_error(y_test, y_pred)\n",
"rmse = np.sqrt(mse)\n",
"print(\"RMSE value: {:.4f}\".format(rmse))\n"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"R2 Score value: 0.5789\n"
]
}
],
"source": [
"# Calculate and print r2_score\n",
"\n",
"from sklearn.metrics import r2_score\n",
"print (\"R2 Score value: {:.4f}\".format(r2_score(y_test, y_pred)))\n"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Estimated model slope, a: [[1.60509347]]\n",
"Estimated model intercept, b: (array([-11.16003616]),)\n"
]
}
],
"source": [
"# Compute model slope and intercept\n",
"\n",
"a = lm.coef_\n",
"b = lm.intercept_,\n",
"print(\"Estimated model slope, a:\" , a)\n",
"print(\"Estimated model intercept, b:\" , b) \n"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
"# So, our fitted regression line is \n",
"\n",
"# y = 1.60509347 * x - 11.16003616 \n",
"\n",
"# That is our linear model."
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 8.10108551],\n",
" [21.74438002],\n",
" [22.54692675],\n",
" [13.71891266],\n",
" [13.39789396]])"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Predicting Advertising values\n",
"\n",
"lm.predict(X)[0:5]\n",
"\n",
"# Predicting Advertising values on first five Sales values."
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[27.36220717]]\n"
]
}
],
"source": [
"# To make an individual prediction using the linear regression model.\n",
"\n",
"print(str(lm.predict(24)))"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEWCAYAAABrDZDcAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3XmYFOW59/HvbwaQVVlVZBnQoIgIAwxEjSIxblF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WK65ppruOmmm3YafsghhzR72i3BWxY755pk7Vp4+22YNy94Xru28dNo164dCxcu5N1336Vr167cfvvtLRJbVVVVi0znqaeeonPnzi0yrWj+9a9/JW3ajeGJwDmHpEY/uncXQ4eKkSOD5+7do5dL1MEHH8znn39e9/7GG29k5MiRDBkyhKuvvrpu+G9/+1sGDhzIUUcdxbhx4+r2tMeMGcMVV1zB4Ycfzq233kp5eTmnnXYaI0eOZOTIkfzzn/8E4OWXX6a4uJji4mKGDRtGRUUFK1euZPTo0XVHJ3PnzgWgX79+rFmzBoDf//73DB48mMGDB3PLLbcAUFZWxv7778+kSZM44IADOProo9myZUvC89yxY0cA5syZw5gxYzj99NMZOHAg48ePxyy4WHL+/PkcfvjhjBgxgmOOOYaVK1cmPP2EmVnGP0aMGGHOuZa1ePHiutdA0h6xdOjQwczMqqqq7PTTT7enn37azMyeffZZmzRpktXU1Fh1dbUdf/zx9vLLL9sbb7xhQ4cOtc2bN9vGjRvtG9/4ht14441mZnb44Yfbj370o7ppjxs3zubOnWtmZsuWLbOBAweamdkJJ5xgr776qpmZVVRU2LZt2+ymm26ya6+9ti6WjRs3mplZUVGRlZeX27x582zw4MFWWVlpFRUVNmjQIHvzzTftk08+scLCQluwYIGZmZ1xxhn2t7/9baf5vPrqq+vijDb/s2fPtl133dU+++wzq66utoMOOsjmzp1rX3/9tR188MG2evVqMzObOXOmnXvuuXHXZy1gniWwjc3YdgTOudy3ZcsWiouLKSsrY8SIERx11FEAPPfcczz33HMMGzYMgMrKSj788EMqKio46aSTaNeuHQBjx47dYXpnnnlm3esXXniBxYsX173fuHEjFRUVfOtb3+LnP/8548eP59RTT6V3796MHDmS8847j23btnHyySdTXFy8w3RfffVVTjnlFDp06ADAqaeeyty5cznxxBPp379/XfkRI0ZQVlbWpGUxatQoevfuDVC3TDp37sy7775bt1yqq6vp2bNnk6YfiycC51xdNUSi3n4bvv565+Ft2sCQIYlPp/YcwZdffskJJ5zA7bffzk9+8hPMjMsvv5wf/OAHO5S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OgMdkzcHzjWeHxE4t6OOwG1h18JVwFJgMrCBoEfRMuCN+iOZ2dfhZaR/kLQbwX/rFuADYHo4TMAUP0fgMo2fLHbOuTznVUPOOZfnPBE451ye80TgnHN5zhOBc87lOU8EzjmX5zwROOdcnvNE4Jxzee7/Aw9qUPVSLSEmAAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Plot the Regression Line\n",
"\n",
"\n",
"plt.scatter(X, y, color = 'blue', label='Scatter Plot')\n",
"plt.plot(X_test, y_pred, color = 'black', linewidth=3, label = 'Regression Line')\n",
"plt.title('Relationship between Sales and Advertising')\n",
"plt.xlabel('Sales')\n",
"plt.ylabel('Advertising')\n",
"plt.legend(loc=4)\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEICAYAAABcVE8dAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAHoVJREFUeJzt3X+UVOWd5/H3BwUBxRCQ+IMG2jHGFQ200PFH9DgZg4oxhuxu3Jgl0SgR9cQddbJng+FkUGdJnONkTNyYnWGNhtl0dDyTiRonGQNG1+RsDLQJapBhQcOPVpQGJWJQfsh3/7i3oWga+kfdqrpV9/M6p07Xfe6te59bFN966rnP872KCMzMrPENqnUFzMysOhzwzcwKwgHfzKwgHPDNzArCAd/MrCAc8M3MCsIB3xqKpOWSPnKAdR+R1JHRcZ6U9IUs9mVWLYfWugJWTJLWAEcD7wJvAf8KXB8Rb5Wz34g4pfzamTUmt/Ctli6JiCOAFuA04OYa16fqJO3X6OqprL/7MOuJA77VXES8CjxGEvgBkHSYpL+RtE7Sa5L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ce++9vPrqq71ut3r1alpaWg66zUsvvcQDDzzQ52NXQrmjdE4sWfwE8G/p80eAy9PROmcCf3D/vZkdSNaZHvqSHrkv+hrw+yIPAb/cPvzbJZ0E7AbWAtem5T8BPgasBrYBV5Z5HDNrUF2ZHrom/3ZleoDKXFdeuHAhd999Nzt27ODDH/4w3/72t9m9ezdXXnkly5YtIyKYPXs2Rx99NMuWLePTn/40w4YNY8mSJft8WSxdupRZs2Zx+OGH7zND98UXX+Tzn/88b731FoMGDeI73/kOZ5xxBnPmzGHVqlW0tLRw1VVXcfHFF/e4XUX1JaVmtR5Oj2zWGHpLj1xqwoSKZkfeJz3y888/HzNmzIidO3dGRMTVV18dbW1t8fTTT8f06dP3vKYrrXFXiuSeTJw4MX75y19GRMSNN94YkydPjogktfHbb78dERErVqyI008/PSIiFi1aFDNmzNjz+gNt15ty0iP7JuZmVlMHyoJciezIixcvZunSpbS2JlkI3n77bcaNG8eFF17IypUrueGGG/jYxz7GBRdccND9bNq0ibfffntPy/5zn/scTzzxBADbt2/n+uuv59lnn+XQQw89YIrjvm6XJadWMKu1PKUqroFqZnqICK666qo9/fkrV67kq1/9KqNHj+a5557jnHPO4a677uKaa67pdV89pUIG+MY3vsG4ceN4/vnnWbJkCdu3by9ruyw54JvVUt5SFddANTM9TJs2jQcffJBNmzYByWiedevW0dnZSURw6aWXcuutt/Kb3/wGgBEjRuxJc1zqqKOOYujQofzqV78C2JMWGZI0x8ceeyySWLhw4Z5bHXbf14G2qyQHfLNayluq4hqoZqaHD37wg8ybN49p06YxadIkLrjgAl577TXWr1/PueeeS0tLC1dffTVf+9rXALjyyiv5whe+0ONwzvvuu49rrrmGs846iyOOOGJP+fXXX88999zDmWeeydq1aznssMMAOO2003j33XeZPHkyd9111wG3qySnRzarpSqkKq4Fp0euHKdHNqtXTlVsVeSAb1ZLTlVsVeSAb1ZLDZyqOE/dxY2i3PfU4/DNaq0BUxUPHTqUzZs3M3r06AMOX7T+iQg2b97M0KFDB7wPB3wzy1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CHBvRMyvcZUyJ+l+4CMkKVRfA+YBDwEPAuOBdcClEdH9wm7dknQO8Avgefb2736FpB+/Ic9b0iSSC3aHkDTIHoyI2yT9CUkLeBTwW+CzEbG9djXNXtql818j4uONfL7puf0oXTwU+EFEzJc0mgp/rhsi4JuZWe8aoUvHzMz6wAHfzKwgHPDNzArCAd/MrCAc8M3MCsIB38ysIBzwzcwK4v8Dyf/lH6xKsGYAAAAASUVORK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Plotting residual errors\n",
"\n",
"plt.scatter(lm.predict(X_train), lm.predict(X_train) - y_train, color = 'red', label = 'Train data')\n",
"plt.scatter(lm.predict(X_test), lm.predict(X_test) - y_test, color = 'blue', label = 'Test data')\n",
"plt.hlines(xmin = 0, xmax = 50, y = 0, linewidth = 3)\n",
"plt.title('Residual errors')\n",
"plt.legend(loc = 4)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Training set score: 0.2861\n",
"Test set score: 0.5789\n"
]
}
],
"source": [
"# Checking for Overfitting or Underfitting the data\n",
"\n",
"print(\"Training set score: {:.4f}\".format(lm.score(X_train,y_train)))\n",
"\n",
"print(\"Test set score: {:.4f}\".format(lm.score(X_test,y_test)))"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['lm_regressor.pkl']"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Save model for future use\n",
"\n",
"from sklearn.externals import joblib\n",
"joblib.dump(lm, 'lm_regressor.pkl')\n",
"\n",
"# To load the model\n",
"\n",
"# lm2=joblib.load('lm_regressor.pkl')"
]
}
],
"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.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment