housing/housing_predict.ipynb

1261 lines
2 MiB
Text
Raw Permalink Normal View History

2022-07-27 13:05:28 -04:00
{
"cells": [
{
"cell_type": "markdown",
"id": "594c8d15-68ec-466b-bec1-4d74120f8c0e",
"metadata": {},
"source": [
"# Predicting Housing Prices in Ames, Iowa\n",
"\n",
"To better understand the housing market in Ames we will create a regression model to predict the \n",
"sale price of any given house by analyzing certain features of that house. By comparing the predicted \n",
"sale price to a list of known sale prices of houses with the same features, we can test our model and \n",
"assign a score to the results. This can then be used to judge whether or not the price of a house for\n",
"sale is in line with what it should be, or to come up with a price for a new listing."
]
},
{
"cell_type": "markdown",
"id": "4018d860-3f73-4cd1-baa2-56406ddbf05f",
"metadata": {},
"source": [
"### Imports"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "2438f7a8-f9b7-4fba-9783-9c644b44362d",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-30T20:48:02.024387Z",
"iopub.status.busy": "2022-05-30T20:48:02.023868Z",
"iopub.status.idle": "2022-05-30T20:48:03.639974Z",
"shell.execute_reply": "2022-05-30T20:48:03.639485Z",
"shell.execute_reply.started": "2022-05-30T20:48:02.024310Z"
},
"tags": []
},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"from matplotlib.gridspec import GridSpec\n",
"from sklearn.preprocessing import StandardScaler, QuantileTransformer, PolynomialFeatures\n",
"from sklearn.linear_model import LinearRegression, LogisticRegression, LassoCV, Lasso, Ridge, RidgeCV\n",
"from sklearn.neighbors import KNeighborsRegressor\n",
"from sklearn.model_selection import GridSearchCV, train_test_split\n",
"from sklearn.pipeline import Pipeline\n",
"from sklearn.metrics import mean_squared_error, r2_score\n",
"import seaborn as sns\n",
"from wand.image import Image\n",
"from wand.color import Color\n"
]
},
{
"cell_type": "markdown",
"id": "3f3887bf-5bf7-4802-9c45-913d67063613",
"metadata": {},
"source": [
"### Load and Clean Data"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "262991a8-6f4f-4af5-9654-4c58763fb931",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-30T20:48:03.641159Z",
"iopub.status.busy": "2022-05-30T20:48:03.640832Z",
"iopub.status.idle": "2022-05-30T20:48:03.672779Z",
"shell.execute_reply": "2022-05-30T20:48:03.672211Z",
"shell.execute_reply.started": "2022-05-30T20:48:03.641141Z"
},
"tags": []
},
"outputs": [],
"source": [
"# Load in data from CSV\n",
"kaggle = pd.read_csv('data/test.csv')\n",
"train = pd.read_csv('data/train.csv')"
]
},
{
"cell_type": "markdown",
"id": "c78eaa1a-340a-4c00-999b-1ab5456c1021",
"metadata": {},
"source": [
"Spaces should be underscores and column names should be all lowercase to make things easier to type"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "452a5cf0-878d-4ae5-b799-201c2c082d9f",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-30T20:48:03.673849Z",
"iopub.status.busy": "2022-05-30T20:48:03.673619Z",
"iopub.status.idle": "2022-05-30T20:48:03.677612Z",
"shell.execute_reply": "2022-05-30T20:48:03.676907Z",
"shell.execute_reply.started": "2022-05-30T20:48:03.673832Z"
},
"tags": []
},
"outputs": [],
"source": [
"for df in [train,kaggle]:\n",
" df.columns = [col.lower().replace(' ','_') for col in df.columns]"
]
},
{
"cell_type": "markdown",
"id": "23670302-d9dd-4c2e-a391-0be65ddc3832",
"metadata": {},
"source": [
"### Discovery\n",
"Let's figure out what we're going to feed into the model. [The dictionary can be found here](data/dictionary.txt)<br>\n",
"First let's make a function to make plotting easier."
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "d152cb9e-3b90-42dd-87fe-9265158fce6f",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-30T20:50:35.358569Z",
"iopub.status.busy": "2022-05-30T20:50:35.357933Z",
"iopub.status.idle": "2022-05-30T20:50:35.363845Z",
"shell.execute_reply": "2022-05-30T20:50:35.362921Z",
"shell.execute_reply.started": "2022-05-30T20:50:35.358538Z"
},
"tags": []
},
"outputs": [],
"source": [
"sns.set_context('talk')\n",
"sns.set_style('darkgrid')\n",
"def discover_plot(x,y):\n",
" figname = str(x[0])+str(y[0])+'.svg'\n",
" return sns.jointplot(y=y, x=x,\n",
" kind=\"reg\", truncate=False,\n",
" color='crimson', height=7,\n",
" ).savefig(figname, backend='Cairo')"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "0217c6ad-a2d3-48de-a116-723ca1d0d41b",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-30T20:48:17.945279Z",
"iopub.status.busy": "2022-05-30T20:48:17.944876Z",
"iopub.status.idle": "2022-05-30T20:48:17.949875Z",
"shell.execute_reply": "2022-05-30T20:48:17.949042Z",
"shell.execute_reply.started": "2022-05-30T20:48:17.945247Z"
},
"tags": []
},
"outputs": [],
"source": [
"gr_liv = str(train.gr_liv_area[0])+str(train.saleprice[0])+'.png'"
]
},
{
"cell_type": "code",
"execution_count": 102,
"id": "ca94d4a7-be9c-46e7-9d70-0bc3eeb4f33f",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T08:04:32.972946Z",
"iopub.status.busy": "2022-05-29T08:04:32.972334Z",
"iopub.status.idle": "2022-05-29T08:04:32.977528Z",
"shell.execute_reply": "2022-05-29T08:04:32.976647Z",
"shell.execute_reply.started": "2022-05-29T08:04:32.972916Z"
},
"tags": []
},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "invalid syntax (3671886240.py, line 2)",
"output_type": "error",
"traceback": [
"\u001b[0;36m Input \u001b[0;32mIn [102]\u001b[0;36m\u001b[0m\n\u001b[0;31m img.\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
]
}
],
"source": [
"with Image(filename=gr_liv) as img:\n",
" img.\n",
" img.save(filename='edge-pl1.png')"
]
},
{
"cell_type": "code",
"execution_count": 103,
"id": "bcce29db-9682-4264-8fe5-616660ca82d0",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T08:04:33.168532Z",
"iopub.status.busy": "2022-05-29T08:04:33.168059Z",
"iopub.status.idle": "2022-05-29T08:04:33.177108Z",
"shell.execute_reply": "2022-05-29T08:04:33.176550Z",
"shell.execute_reply.started": "2022-05-29T08:04:33.168502Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.series.Series'>\n",
"Int64Index: 2047 entries, 0 to 2050\n",
"Series name: gr_liv_area\n",
"Non-Null Count Dtype\n",
"-------------- -----\n",
"2047 non-null int64\n",
"dtypes: int64(1)\n",
"memory usage: 96.5 KB\n"
]
}
],
"source": [
"train.gr_liv_area.info()"
]
},
{
"cell_type": "markdown",
"id": "ea5fcbc3-3180-4fd6-9990-02fb020c7e6f",
"metadata": {},
"source": [
"Above grade living area sounds like a feature with lots of influence and has no nulls. A low hanging fruit"
]
},
{
"cell_type": "code",
"execution_count": 104,
"id": "eed7245f-6dea-416d-8a8e-2542f65dd241",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T08:04:33.585261Z",
"iopub.status.busy": "2022-05-29T08:04:33.584773Z",
"iopub.status.idle": "2022-05-29T08:04:34.508102Z",
"shell.execute_reply": "2022-05-29T08:04:34.507183Z",
"shell.execute_reply.started": "2022-05-29T08:04:33.585232Z"
},
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgQAAAHfCAYAAAAvE8DnAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAADe4klEQVR4nOydeZwcVbm/n1NVvcz09GyZyZ5AyAKEHVEIRBBC2BcJyBpFFsUrqKig96dX9Hq5XpQIXEEWLwIisu8BDVsQhYSoIBAMmJAIhJBMMvt0T29VdX5/nOptpmemZzIzPct5Ph+YTHfVqdPVPX3e877f932FlFKi0Wg0Go1mX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OTWHTScfjmd3/wJzvtbSjxDjUYz2GiDQDOspB59Fvv3LwEQ/M6XMKZNKvGMNL1h1tdQftrRWKcchaivAcB+5mWiJ19C7HvXacNAoxlDaINAM2w46/9F/OpbALAWH4rvjGNLPCNNsRjTJ2OdcRwTrv8uYtokcFxSjz9P9KRLiH33Wpx/fVTqKWo0mp1EGwSaYUFGO4l9838gkURMn0zZf12uQwWjDCEE4dOOYvrzt1P7k29gTp8Erktq+YtET/4Kqcuvxv/G20gtPNRoRiVaVKgZcqSUxH50E+6/PgLLovy6f9dZBaMVV9Jw430AGCceCev/hfPaP6A9QuzZVcSeXYUxb1d8px+L7/jDMepqSjxhjUZTLNog0Aw5ydsewH76jwAEv3Mx5t5apT4WEKaBuedsjHmzcDd9iPvWemRDI+7690n8z20kfvZ/mAsOwHf0oVgLP4ExdWKpp6zRaHpBGwSaISX55EoSv1Bpbr7PHo3vvJNLPCPNYCNMA3P
"text/plain": [
"<Figure size 504x504 with 3 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"discover_plot(train.gr_liv_area,train.saleprice);"
]
},
{
"cell_type": "markdown",
"id": "694fbdfa-0e56-484f-b860-c18dedb3e6a7",
"metadata": {},
"source": [
"It looks decent, the correlation is linear and distributions are of desirable shape. But the two outliers will probably be an issue"
]
},
{
"cell_type": "markdown",
"id": "d54c95b6-6220-4cc3-8fc1-eddc6e2d58a1",
"metadata": {},
"source": [
"We can make a function to drop any outliers above a certain threshold"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "0a538ee8-5660-4551-a8a8-b410233a65dd",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-30T20:48:53.709770Z",
"iopub.status.busy": "2022-05-30T20:48:53.709081Z",
"iopub.status.idle": "2022-05-30T20:48:53.713811Z",
"shell.execute_reply": "2022-05-30T20:48:53.713075Z",
"shell.execute_reply.started": "2022-05-30T20:48:53.709739Z"
},
"tags": []
},
"outputs": [],
"source": [
"def drop_outliers(dflist,feature,threshold):\n",
" for df in dflist:\n",
" df.drop(df[feature][df[feature]>threshold].keys(),inplace=True)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "c430bccc-ed7c-4a4f-98b0-3fe523947e6c",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-30T20:50:39.651753Z",
"iopub.status.busy": "2022-05-30T20:50:39.651214Z",
"iopub.status.idle": "2022-05-30T20:50:40.476122Z",
"shell.execute_reply": "2022-05-30T20:50:40.475580Z",
"shell.execute_reply.started": "2022-05-30T20:50:39.651732Z"
},
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgQAAAHfCAYAAAAvE8DnAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAADdmklEQVR4nOydd3xc1Zm/n3PvNGlm1OWGC8WmmE4gYCA4YEwvgRCqE0IJZBeSkMQkm82GzWbZ/EhwgA2EkqWH0LuBmGYCARsngZhmwMYOYIwtq42kGWnKvff8/jh3mjSSRrKkUTnP5wOWZu4998yd0Zz3vOX7CimlRKPRaDQazYTGKPUENBqNRqPRlB5tEGg0Go1Go9EGgUaj0Wg0Gm0QaDQajUajQRsEGo1Go9Fo0AaBRqPRaDQawFPqCWj6p7Gxo9RTGNVUVpYB0NbWVeKZjD/0vR1e9P0dXurrw6WewphCewg0Go1Go9Fog0Cj0Wg0Go0OGWg0RVERMDH6EPV0hKA9buc9JpMpnE0NyKZWZFMLsi2afdJjIuprMCbXYUytR1SGB3UNjUajGSq0QaDRFIEhJVt+c3evz0/54TdwNm7Geu1N7DfXYK/9J86GjWAVt4B7Zk7FPmB34i0dGLOmIcrLCl5Do9FohgttEGg0g0SmUshNDTifbubzp/+M9cnnvR4rqiowq8NYrR2ABNuBzi71L2B9uhnr080A2EIgZkzF3GdXxHaTEUKMxMvRaDQTHG0QaDRFIqVU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fjGDvOwHPkwXgXzMOYuxPC1DoGGs1oRRsEmmEl+eRyEr9VZW7erxyJ95wTSzwjzXB
"text/plain": [
"<Figure size 504x504 with 3 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"drop_outliers([train],'gr_liv_area',4500)\n",
"discover_plot(train.gr_liv_area,train.saleprice);"
]
},
{
"cell_type": "markdown",
"id": "faa68621-e52d-4247-ac20-dc9976b03814",
"metadata": {},
"source": [
"As living area increases, so does sale price"
]
},
{
"cell_type": "markdown",
"id": "8310d45d-e9c2-4636-aa3d-1d6f1a47c491",
"metadata": {},
"source": [
"By subtracting the year a house was built from the year it was sold, we can get the age of a house at its point of sale and use this in our model"
]
},
{
"cell_type": "code",
"execution_count": 107,
"id": "0e3b4f2d-539f-488b-be4b-351735cd02cc",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T08:04:35.388421Z",
"iopub.status.busy": "2022-05-29T08:04:35.388144Z",
"iopub.status.idle": "2022-05-29T08:04:37.347017Z",
"shell.execute_reply": "2022-05-29T08:04:37.346334Z",
"shell.execute_reply.started": "2022-05-29T08:04:35.388402Z"
},
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgQAAAHfCAYAAAAvE8DnAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAADiuUlEQVR4nOy9eZwcVbn//z5VvcxMT8+WmexhTQKyBESBBBCEJIisgsomyhJF/cJV9IZ7vdfv5d7r19+9KBFREHBhUZBdCIYlbEEQsqBAWAyYsEmAZJJZe3rvqjq/P05VLzM9Mz2ZpWd6zvv1CqG7qk+dqpn0ec6zfB4hpZRoNBqNRqOZ1BjlnoBGo9FoNJryow0CjUaj0Wg02iDQaDQajUajDQKNRqPRaDRog0Cj0Wg0Gg3aINBoNBqNRgP4yj0BzeD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WPwf/YYlXj59lbsv7yq8i7++jqyvQsSKeyX38B++Y2Cz5rTm/HtNQffnrMwZ07FN6MFc0Yz5vRmzBktGOFQ0WuWUwdhtJQqNZpKRRsEmlGjlF4IA6Hr6IfHoAbZJ/ZRf77xRaSU2O9vI/3qZtKvbSb92hYyr23G6YwAKIXG7W2k1r5cdChRHcSoD2OEQ4i6EEY4hG/aFERDHSlhZD07+P2qmsPvI1rtB8smHU0ibRssR5WDpjPIVBq/Y0MmowScUmlkSr0vk97rwj+k0kjbQQT8iGCAeFUg+/9GfRijIYxRX4vRWIc5rRnfjGbM6S0YU+qL5lHo3z/NZEMbBJpRpeReCEXQdfTDY6gGmeEzqTrkY1Qd8jEAAnOmk3r9LXZcfxeyqwfZFUF2R5WAUjQB8YRSVgRkIoWdSGEPQSY6OcjxXZJ+hqGHiUw
"text/plain": [
"<Figure size 504x504 with 3 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"for df in [train,kaggle]:\n",
" df['age'] = [df.iloc[i]['yr_sold'] - df.iloc[i]['year_built'] for i in range(len(df))]\n",
"\n",
"discover_plot(train.age,train.saleprice);"
]
},
{
"cell_type": "markdown",
"id": "0f9d613b-3aa6-4e89-a5fd-fa6627c06e62",
"metadata": {},
"source": [
"As a house ages, its value goes down"
]
},
{
"cell_type": "code",
"execution_count": 108,
"id": "51e87153-ae5f-406b-95ed-d085f255abbe",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T08:04:37.348305Z",
"iopub.status.busy": "2022-05-29T08:04:37.348040Z",
"iopub.status.idle": "2022-05-29T08:04:38.355622Z",
"shell.execute_reply": "2022-05-29T08:04:38.354979Z",
"shell.execute_reply.started": "2022-05-29T08:04:37.348282Z"
},
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgQAAAHfCAYAAAAvE8DnAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6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sDkXMXYr/+XrF7p9FoNCMCLQhGOTKRwHluFfHH/g6ui6ivoere6/D/v6vw7LJjsbs3KKSyHsyvmvBfegbm/nsAqlxz5PyriVzxC5wP/1nkXmo0Gk1po7cMRjHulm3E7ngUuWUbAOZ+0yk782jE5q+Ivb2hS+bASCa1xeHGEpiHfQ1zxp44697HeWcD9oo12CvWYB60H95zTsCaOxthmcXuskaj0ZQUWhCMUmRHlNA5C5UYEALvcXMwZ+yJ8HqLnjI4HHj3m4bYfxqx1W9hv/w67rYWnNfeoeO1dxDj6/AeNwfruG9h7DNt1IgijUajGQhaEIxWbAcZaIcyL9a8Q/Ee/jXcEkwdHEqctjBMaqD83y5CbvqU6Auv4W76FLm9ldhflxH76zKMXafgPeEIzCNmYUzfRYsDjUYzZtGCYJQiqvxUP38b8YefxQ11FLs7RUUYAjmxAeuoQ7FqjiKx5m3s9zYit7bg/vNzojfdCTfdiZg4Diu53WDutTvGtF16re6YSut0R0hGhkaj0XSHFgSjGKOuBuHxAGNbEGRj1NXgOfRAvEcfhrPxU+KvvYv85+fIYAjZ1EziwWdIPPiMOtk0EA31RCePx5wwDru8HCrKEX71n1HlR274J/i8mN86GFlehvBXqOOVFVBRhjB1rIJGoxkZaEGgGZMIITAmNWAdeiCec46DbS3E3vwA+UUTbnMrclsrOC5yy3biKd+Gnrjjkfyvl/vSIiEjJio
"text/plain": [
"<Figure size 504x504 with 3 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"discover_plot(train.lot_area, train.saleprice);"
]
},
{
"cell_type": "markdown",
"id": "a0733ef0-7608-4e14-9ce9-8b041a39594e",
"metadata": {},
"source": [
"Sale price increases with lot area as well, but we have the same problem with outliers"
]
},
{
"cell_type": "code",
"execution_count": 109,
"id": "16e00fab-bda6-4d0d-bfff-9613514b7940",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T08:04:38.356770Z",
"iopub.status.busy": "2022-05-29T08:04:38.356567Z",
"iopub.status.idle": "2022-05-29T08:04:38.362415Z",
"shell.execute_reply": "2022-05-29T08:04:38.361692Z",
"shell.execute_reply.started": "2022-05-29T08:04:38.356748Z"
},
"tags": []
},
"outputs": [],
"source": [
"drop_outliers([train],'lot_area',80000)"
]
},
{
"cell_type": "code",
"execution_count": 110,
"id": "0fc710a4-102f-4f1b-a989-91c7c38f51b0",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T08:04:38.363723Z",
"iopub.status.busy": "2022-05-29T08:04:38.363540Z",
"iopub.status.idle": "2022-05-29T08:04:39.413779Z",
"shell.execute_reply": "2022-05-29T08:04:39.413306Z",
"shell.execute_reply.started": "2022-05-29T08:04:38.363707Z"
},
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgQAAAHfCAYAAAAvE8DnAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAADCNklEQVR4nOy9d3wc1bn//z4zs0VaNcuWbcB0YTo2BIINBAdsc+kt9BowgeRCEsI1997v5ZvcJDe/+02CQ7NDSAMCDi0Ug+nFhGIbE4ppBmxMAFMsW2W12pW2zMz5/XG2SquyarsrnffrRSLtzM6cHa9mPuc5z/N5hJRSotFoNBqNZlxjFHsAGo1Go9Foio8WBBqNRqPRaLQg0Gg0Go1GowWBRqPRaDQatCDQaDQajUaDFgQajUaj0WgAq9gD0PTP1q0dfW6vra0AoL29azSGM+7Q13dk0dd35Bjv17ahobrYQygrdIRAo9FoNBqNFgSa0cUwBIYhij0MjUaj0XRDCwLNqGEYAmf5CpzlK7Qo0Gg0mhJD5xBoRhU7qPIhzCKPQ6PRaDS5aEGgGRGyIwCuq9tlaDQaTamjBYFm2EktDdjBDqy6aswTjtSiQKPRaEocLQg0I4Id7MBpC4EQeJLRAp03oNFoNKWLFgSaEcWsCWA/8hzxplZ8209BCIHuuK3RaDSlhx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m1pIPPA0iQeeVjubBqKhnug2kzAnT8SuqIDKCkRA/WdUB5Dr/wk+L+Y3D0ZW+BGBSrW9qhIq/QhT5ypoNJryQAsCzbhECIExtQHr0APwnHMcbG0l9uYHyC+acFvakFvbwHGRm5uJp3wb+uKOh/O/XuFLi4S
"text/plain": [
"<Figure size 504x504 with 3 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"discover_plot(train.lot_area, train.saleprice);"
]
},
{
"cell_type": "markdown",
"id": "9c2790c8-eb24-434e-a333-ca752faaf803",
"metadata": {},
"source": [
"This is a clearer picture. There is still some noise but the scaler should be able to handle the rest"
]
},
{
"cell_type": "markdown",
"id": "2363762a-fd4c-4e1e-bdf0-c67f101980f7",
"metadata": {},
"source": [
"### Create a DataFrame for the model\n",
"Now split off price (our target) as y and list features to be included in the feature set (X) for our model. \n",
"Also create X_kaggle for creating a kaggle submission later on"
]
},
{
"cell_type": "code",
"execution_count": 151,
"id": "8207024f-87b2-4c50-b6cc-f1b0ed7f75ce",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T09:14:09.528495Z",
"iopub.status.busy": "2022-05-29T09:14:09.528007Z",
"iopub.status.idle": "2022-05-29T09:14:09.534060Z",
"shell.execute_reply": "2022-05-29T09:14:09.533301Z",
"shell.execute_reply.started": "2022-05-29T09:14:09.528468Z"
},
"tags": []
},
"outputs": [],
"source": [
"y = train.saleprice\n",
"\n",
"include = [\n",
" 'gr_liv_area',\n",
" 'age',\n",
" 'lot_area',\n",
" 'neighborhood',\n",
" 'central_air',\n",
" 'overall_qual',\n",
" 'fireplaces',\n",
" 'full_bath',\n",
" 'half_bath',\n",
" 'ms_zoning',\n",
" 'street',\n",
" # 'low_qual_fin_sf',\n",
" 'land_contour',\n",
" 'lot_config',\n",
" # 'overall_cond', # points the wrong way\n",
" ] \n",
"X = train[include]\n",
"X_kaggle = kaggle[include]"
]
},
{
"cell_type": "markdown",
"id": "969ea58d-6494-4009-b40b-e53bcf9786da",
"metadata": {},
"source": [
"From the selected features, anything that is an object we'll just convert to dummies and then drop the original column"
]
},
{
"cell_type": "code",
"execution_count": 152,
"id": "a51b40dc-0d8e-458f-bec9-268a6956f885",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T09:14:09.862460Z",
"iopub.status.busy": "2022-05-29T09:14:09.862132Z",
"iopub.status.idle": "2022-05-29T09:14:09.883430Z",
"shell.execute_reply": "2022-05-29T09:14:09.882816Z",
"shell.execute_reply.started": "2022-05-29T09:14:09.862433Z"
},
"tags": []
},
"outputs": [],
"source": [
"# convert all object type columns into dummies\n",
"def make_dummies(df):\n",
" for col_name in df.columns:\n",
" if df[col_name].dtype == 'O':\n",
" dums = pd.get_dummies(df[col_name],prefix=col_name,dtype=int,drop_first=True)\n",
" df = df.drop(labels=[col_name],axis=1)\n",
" df = df.join(dums)\n",
" return df\n",
"\n",
"X = make_dummies(X)\n",
"X_kaggle = make_dummies(X)"
]
},
{
"cell_type": "markdown",
"id": "ab6c21b8-74b2-42bc-80ab-5866066c4aad",
"metadata": {},
"source": [
"The block below can be expanded to show a plot of the linearity of every feature used in the model and provide some insight as to how each feature affects the predicted sale price"
]
},
{
"cell_type": "code",
"execution_count": 153,
"id": "13ab6821-c284-48d0-ad3d-20410420bb9c",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T09:14:09.947477Z",
"iopub.status.busy": "2022-05-29T09:14:09.946842Z",
"iopub.status.idle": "2022-05-29T09:14:09.950534Z",
"shell.execute_reply": "2022-05-29T09:14:09.949804Z",
"shell.execute_reply.started": "2022-05-29T09:14:09.947448Z"
},
"tags": []
},
"outputs": [],
"source": [
"# for col in X.columns:\n",
"# discover_plot(X[col],y)\n",
"# plt.show()"
]
},
{
"cell_type": "markdown",
"id": "fb1beba2-a5cc-47d8-9c22-76645579c9b5",
"metadata": {},
"source": [
"### Noteworthy Discoveries"
]
},
{
"cell_type": "code",
"execution_count": 154,
"id": "c8d6079a-236a-407a-90be-bea8d98610dd",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T09:14:10.013814Z",
"iopub.status.busy": "2022-05-29T09:14:10.013516Z",
"iopub.status.idle": "2022-05-29T09:14:10.941033Z",
"shell.execute_reply": "2022-05-29T09:14:10.940199Z",
"shell.execute_reply.started": "2022-05-29T09:14:10.013781Z"
},
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgQAAAHfCAYAAAAvE8DnAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAACWMklEQVR4nOzdeXxU1f34/9e5d2ayL+yogFICVEREW2UR4SOLta4VrWjdilhtK63WamtrtcvHXz+2ri2UUttaq1SttYrihgt+cWFxRVHUAG64EJYsk2SSzMy95/fHnZnMZL0JmbmT5P18PGKSO8c7J0My933PeZ/3UVprjRBCCCH6NcPrDgghhBDCexIQCCGEEEICAiGEEEJIQCCEEEIIJCAQQgghBBIQCCGEEALwed0B0bndu2u97kKPKinJA6CmpsHjnvQO8np1jbxeXdOXX68hQ4q87kKvIiMEQgghhJCAQAghhBAyZSCE6KJ8HYWGptYP5OUQUvKWIkRvJX+9QoiuaWii8o6HWh0eeOFpkC9vKUL0VjJlIIQQQggJCIQQQgghAYEQQgghkIBACCGEEEhAIIQQQggkIBBCCCEEEhAIIYQQAgkIhBBCCIEEBEIIIYRAAgIhhBBCIAGBEEIIIZCAQAghhBBIQCCEEEIIJCAQQgghBBIQCCGEEAIJCIQQQgiBBARCCCGEQAICIYQQQiABgRBCCCGQgEAIIYQQSEAghBBCCCQgEEIIIQQSEAghhBACCQiEEEIIgQQEQgghhEACAiGEEEIgAYEQQgghkIBACCGEEEhAIIQQQggkIBBCCCEEEhAIIYQQAgkIhBBCCIEEBEIIIYRAAgIhhBBCIAGBEEIIIZCAQAghhBCAz+sOCCHEvsjXUWhoaj4QaXCO+/y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DwGc8IYzIPHYBw8BmNASZv91FpDXYjCKYcS+ngn1pat2O9sw/7os/afo7gQY9gg1NBBqIJ8VH4u5ASc399ILNCIRJzfm7oQurYeXVePrgtB/T4G4Hk5qKJYcFBcgCoqjAUMBUnHnc/k5Tq/qy1pEn9rzX+PduLr5r/Z2EcggP/kY7ud+yEBQddIQNAL2HY3/om0RteHWl8sRf+lDJQvFtj4un+3p9DoptYXbpXjR7d5FXBLO8Gc1s2/t4ZyAq4OztuqP7GmKtCF/mgduyhFnQtUch/afFLlBCTxj3gw2JV+xo+3fN20dqYa4sGpbbubeui2WKCZ8uNmz/uGCvghJ6db/69h7MvvY/8jAYEQQgghpA6BEEIIISQgEEIIIQQSEAghhBACCQiEEEIIgQQEQgghhEACAiGEEEIgAYEQQgghkIBACCGEEEhAIIQQQggkIBBCCCEEEhAIIYQQAuh9+1n2Q7at2bu3zutu9BjZ/rhr5PXqGnm9uqYvv15d2e2wr73Ptqej10RGCIQQQgghAYEQQgghJCAQQgghBBIQCCGEEAIJCIQQQgiBBARCCCGEQAICIYQQQiABgRBCCCGQgEAIIYQQSEAghBBCCKR0sRCiG3RdiOiGTejqIKq0GN/UyajCfK+7JYTYBxIQCCFc01oTvu8xIiseQVs2RKPgM1Gmif/cUwicdSJKKa+7KYToBgkIhBCuhe97jPA/HoSCPJTPTBzXUcs5DuScfZJX3RNC7APJIRBCuKLrQkRWPNIqGACc7wvynJGD+pBHPRRiH4TD2Lsrve6FpyQgEEK4Et2wCW1ZrYKBOOUz0ZZFdP2mzHZMiB6gm8KE737Y6254yvOAYOPGjVx44YV89atf5bDDDuOEE07g3//+d0qbl156iTPPPJNJkyYxbdo0rrvuOoLBYKtz1dfXc/311zNjxgwmTZrE/PnzefbZZ9t8Xi/PKURvpKuDELU6bhS1nHZC9EK+unqvu+ApTwOChx56iIU
"text/plain": [
"<Figure size 504x504 with 3 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"discover_plot(train.overall_cond,y);"
]
},
{
"cell_type": "markdown",
"id": "edd6a5ff-ba1c-49f7-84b3-335451557248",
"metadata": {},
"source": [
"This feature is actually the opposite of what you may expect... As overall condition goes up, the price goes down? I think someone is lying!"
]
},
{
"cell_type": "code",
"execution_count": 155,
"id": "64e52733-3ddf-4157-9d72-caea7b509646",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T09:14:10.942849Z",
"iopub.status.busy": "2022-05-29T09:14:10.942506Z",
"iopub.status.idle": "2022-05-29T09:14:11.798102Z",
"shell.execute_reply": "2022-05-29T09:14:11.797337Z",
"shell.execute_reply.started": "2022-05-29T09:14:10.942825Z"
},
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgQAAAHfCAYAAAAvE8DnAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAB8cUlEQVR4nO3deXxU1d348c+5s2RfWMKigFICCCJgXQChUFmsxYWCe12qYtHnkVZrwWqt1vaxv8cF0RZK0fZRa617kYooyFKxsqkoiqKGpSqoBMi+z3LP74+bmWTIJJkJmdxZvu/XK5rce3LnnEnI/d5zvuccpbXWCCGEECKlGXZXQAghhBD2k4BACCGEEBIQCCGEEEICAiGEEEIgAYEQQgghkIBACCGEEIDT7gqI9h06VNWh78vLywCgoqKuM6sTV6SNySMV2ilt7FoFBTl2VyGhSA9BktJaU/XES9SueMPuqgghhEgA0kOQpPSBw5Tf8QdwGGT/628YPbvZXSUhhBBxTHoIkpTqkY9Kd4PfxP/uR3ZXRwghRJyTgCBJKbcL9yknAuB750ObayOEECLeSUCQxNLGjQbA/470EAghhGibBARJLG3cKADM3V9glpTbWxkhhBBxTQKCJJY2epiVRwCSRyCEEKJNEhAkMZXuxn3ycAD823faXBshhBDxTAKCJOcsHACA+c0hm2sihBAinklAkOQcvXsAoA+W2lwTIYQQ8U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n3128HqTJk1izJgx3HHHHZSXl9OvXz+WL1/Otm3bWLJ
"text/plain": [
"<Figure size 504x504 with 3 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"discover_plot(train.low_qual_fin_sf,y);"
]
},
{
"cell_type": "markdown",
"id": "7d00dcde-3e6a-40d3-a198-fde1fbd76948",
"metadata": {},
"source": [
"Here's an example of a feature I think is just useless, not enough meaningful data to be included"
]
},
{
"cell_type": "markdown",
"id": "80436214-6f1e-44d2-bd8a-cf7f296a593d",
"metadata": {},
"source": [
"The data set isn't huge, so we'll use a 60/40 split to try to balance representation between testing and training sets. By not specifying a random seed we can get a slightly different result each time we run the split, but since the split is defined seperately from the model, each model runs on the same data split with the same random seed. In other words, the more we split and run models, we can see how consistent the model is. This Model is quite consistent in my testing"
]
},
{
"cell_type": "code",
"execution_count": 156,
"id": "780b860f-641e-45b8-abe7-a7aff0716381",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T09:14:11.799352Z",
"iopub.status.busy": "2022-05-29T09:14:11.798934Z",
"iopub.status.idle": "2022-05-29T09:14:11.805253Z",
"shell.execute_reply": "2022-05-29T09:14:11.804579Z",
"shell.execute_reply.started": "2022-05-29T09:14:11.799326Z"
},
"tags": []
},
"outputs": [],
"source": [
"X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=.4)"
]
},
{
"cell_type": "markdown",
"id": "3abdcea3-eea9-464b-8114-f718f9d54aa6",
"metadata": {},
"source": [
"And then run the model, first just a basic LinearRegression"
]
},
{
"cell_type": "code",
"execution_count": 157,
"id": "f44d32c1-dac1-4164-9a69-9cb0750b378f",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T09:14:11.806782Z",
"iopub.status.busy": "2022-05-29T09:14:11.806456Z",
"iopub.status.idle": "2022-05-29T09:14:11.892078Z",
"shell.execute_reply": "2022-05-29T09:14:11.891386Z",
"shell.execute_reply.started": "2022-05-29T09:14:11.806761Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"--Test--\n",
"RMSE: 37720.42\n",
"R2 Score: 0.79\n",
"\n",
"--Train--\n",
"RMSE: 32402.64\n",
"R2 Score: 0.82\n"
]
}
],
"source": [
"pipe = Pipeline([\n",
" ('scale', QuantileTransformer()),\n",
" ('model', LinearRegression())\n",
"])\n",
"model = pipe.fit(X_train,y_train)\n",
"test_predict = model.predict(X_test)\n",
"train_predict = model.predict(X_train)\n",
"print(f'\\\n",
"--Test--\\n\\\n",
"RMSE: {mean_squared_error(y_test, test_predict ,squared=False):.2f}\\n\\\n",
"R2 Score: {r2_score(y_test, test_predict):.2f}\\n\\n\\\n",
"--Train--\\n\\\n",
"RMSE: {mean_squared_error(y_train, train_predict ,squared=False):.2f}\\n\\\n",
"R2 Score: {r2_score(y_train, train_predict):.2f}\\\n",
"')"
]
},
{
"cell_type": "markdown",
"id": "720d24fd-a752-4eed-b5df-3be0e62b10c6",
"metadata": {},
"source": [
"Calculating the Root Mean Squared Error will show us on average how far off our prediction is in USD. Here we're off by an amount in the mid $30,000s on average.<br>\n",
"The R2 scores show how good of a fit we have to the data. As you can see they're about equal, indicating a possible overfit. This model may not perform well with unseen data.<br>\n",
"Next try a Lasso"
]
},
{
"cell_type": "code",
"execution_count": 158,
"id": "9d11d0b6-3b2e-4054-8102-43c3f7041e52",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T09:14:11.893071Z",
"iopub.status.busy": "2022-05-29T09:14:11.892836Z",
"iopub.status.idle": "2022-05-29T09:14:12.034623Z",
"shell.execute_reply": "2022-05-29T09:14:12.033989Z",
"shell.execute_reply.started": "2022-05-29T09:14:11.893051Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"--Test--\n",
"RMSE: 37768.26\n",
"R2 Score: 0.79\n",
"\n",
"--Train--\n",
"RMSE: 32467.83\n",
"R2 Score: 0.82\n"
]
}
],
"source": [
"pipe = Pipeline([\n",
" ('scale', QuantileTransformer()),\n",
" ('model', LassoCV())\n",
"])\n",
"model = pipe.fit(X_train,y_train)\n",
"test_predict = model.predict(X_test)\n",
"train_predict = model.predict(X_train)\n",
"print(f'\\\n",
"--Test--\\n\\\n",
"RMSE: {mean_squared_error(y_test, test_predict ,squared=False):.2f}\\n\\\n",
"R2 Score: {r2_score(y_test, test_predict):.2f}\\n\\n\\\n",
"--Train--\\n\\\n",
"RMSE: {mean_squared_error(y_train, train_predict ,squared=False):.2f}\\n\\\n",
"R2 Score: {r2_score(y_train, train_predict):.2f}\\\n",
"')"
]
},
{
"cell_type": "markdown",
"id": "ea2e7079-3dfc-419f-a3c4-09077aabe272",
"metadata": {},
"source": [
"And now a Ridge"
]
},
{
"cell_type": "code",
"execution_count": 159,
"id": "891b339f-6ca5-452c-b225-3b659a5a749b",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T09:14:12.035545Z",
"iopub.status.busy": "2022-05-29T09:14:12.035290Z",
"iopub.status.idle": "2022-05-29T09:14:12.109181Z",
"shell.execute_reply": "2022-05-29T09:14:12.108432Z",
"shell.execute_reply.started": "2022-05-29T09:14:12.035527Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"--Test--\n",
"RMSE: 37818.28\n",
"R2 Score: 0.79\n",
"\n",
"--Train--\n",
"RMSE: 32482.25\n",
"R2 Score: 0.82\n"
]
}
],
"source": [
"pipe = Pipeline([\n",
" ('scale', QuantileTransformer()),\n",
" ('model', RidgeCV())\n",
"])\n",
"model = pipe.fit(X_train,y_train)\n",
"test_predict = model.predict(X_test)\n",
"train_predict = model.predict(X_train)\n",
"print(f'\\\n",
"--Test--\\n\\\n",
"RMSE: {mean_squared_error(y_test, test_predict ,squared=False):.2f}\\n\\\n",
"R2 Score: {r2_score(y_test, test_predict):.2f}\\n\\n\\\n",
"--Train--\\n\\\n",
"RMSE: {mean_squared_error(y_train, train_predict ,squared=False):.2f}\\n\\\n",
"R2 Score: {r2_score(y_train, train_predict):.2f}\\\n",
"')"
]
},
{
"cell_type": "markdown",
"id": "a0f0de54-b8c0-4999-bf5f-f66ebfc7cfde",
"metadata": {},
"source": [
"There is hardly any difference in output, I believe due to the relatively clean input and the type of scaling applied. This can be demonstrated below. Brighter dots are higher price predictions"
]
},
{
"cell_type": "code",
"execution_count": 160,
"id": "e9f73528-d63e-4932-b961-9f92a1b53b59",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T09:14:12.110114Z",
"iopub.status.busy": "2022-05-29T09:14:12.109871Z",
"iopub.status.idle": "2022-05-29T09:14:12.114997Z",
"shell.execute_reply": "2022-05-29T09:14:12.114440Z",
"shell.execute_reply.started": "2022-05-29T09:14:12.110094Z"
},
"tags": []
},
"outputs": [],
"source": [
"def model_scatter(x,y):\n",
" figname = str(x)+'-'+str(y)+'.png'\n",
" f, ax = plt.subplots(figsize=(8, 7))\n",
" plt.scatter(X_trans[:,x], X_trans[:,y], c=new_predict, cmap='rocket_r', alpha=0.5)\n",
" plt.xlabel(X.columns[x])\n",
" plt.ylabel(X.columns[y])\n",
" plt.title('Predicted Sale Price')\n",
" f.savefig(figname, backend='Cairo')\n",
" plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 161,
"id": "d008af5d-50d3-4981-b9b8-b234fce79405",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T09:14:12.115799Z",
"iopub.status.busy": "2022-05-29T09:14:12.115615Z",
"iopub.status.idle": "2022-05-29T09:14:14.157868Z",
"shell.execute_reply": "2022-05-29T09:14:14.157349Z",
"shell.execute_reply.started": "2022-05-29T09:14:12.115783Z"
},
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgcAAAHQCAYAAAA1cskxAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOy9d5AkaXnn/3nfzCzf1d7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CADAwNnnf9M6vW6vPWtb5WBgQG588475ed+7ufkT/7kT+Rb3/qWNBqNs44vl8tnvRbHsbzjHe+Ql7zkJQs+80//9E8yMDAgjz/++Pxrf/M3fyMDAwPy9a9/fcE5isWivPKVr5R3vOMd5x3z3Hn/8R//USYnJ2ViYkKeeeYZed/73icDAwPyy7/8y/PHzt2Hb33rW0ue5/Tx/cVf/IUMDAzI7//+7y86zzl+4zd+Q3bv3i179uxZcMzg4KDccccdZ30nDsdycJYDh2OZfPjDH15gutda8+pXv/qsYMS2tjYefvjhBa/t27ePffv28Qu/8As0Go15UzPAnXfeSSaT4Vvf+hYPP/wwk5OTPPXUU7zuda9j48aN88clEgl+8id/kve///3nHetnP/tZAN7//vefFY+glFrWfD/72c+SzWZ57Wtfu2C8YN0nH/7whzl69CgbN27kkUceAeA973nPguNe+9rXsnHjRo4cOXLe6yUSCT72sY/x//7f/+Pf//3f+Y//+A++9rWvAdDZ2ckHP/jBBS6aTCYz/9/1ep1KpYKIcN999/HEE09w+PDhc6ZQfvazn2XTpk3s2rXrrPnde++9/PM//zO1Wu28FgzgrBiJIAh461vfyoc+9KEFr2/fvp177733vOcD+NznPkdrays///M/f9Z7WluPsIjwuc99jpe+9KX09PQsmEc6neb222+/INeOwzGHEwcOxzJ5+9vfzkMPPYRSinQ6zYYNG2hrazvruLVr154VXHbo0CHgbIFxOhMTEwDzfuJNmzaddcyWLVuWNdZjx46hlGL79u3LOn4xDh06RLlcPudiNjk5ycaNGzlx4gRaazZs2HDWMZs3b16WOADIZrO8733v433vex+lUolnn32WRx55hE9+8pN84AMfoL+/f979US6X+ZM/+RP+/d//neHh4bPOVSgUzju/Wq22ZIwDwPT0NKtWrTrvuH/+53+eu+66az6VcdOmTYsGoS52f5bi2LFj7Nix45zBplNTU8zMzPDNb35zyXnMCQmH40Jw4sDhWCbr169f1q4vnU4v+d5P//RP88ADDyz63pxvWkSAxXf4c++dDxFZtoXgXOfo6Ojg93//95c8ZuvWrcs6z8WQy+W49957uffee9m+fTsf+tCH+PSnPz0vDt7//vfzta99jR/90R/lpS99Ka2trfi+z3/8x3/wt3/7txhjzjuugYGBBXUKzqSjo2NZYx0YGLjkZ+NimLu39957Lz/7sz97Wc/tuLlx4sDhuAqsX78esLu48y0i69atA05ZG05nsdcWY+PGjXzjG99g37593HrrrUsedy4BsX79eo4ePcptt91GNps95/XWrl2LMYajR4+eJRgOHz68rDGfi9tuuw2A0dFRwFoFvva1r/GWt7yF//W//teCYx977LFlnXP9+vVMT09z9913X5O76w0bNnD48GEajQaJRGLRYzo6Osjn85RKpWW7KxyO5XDt/UU4HDcgO3fuZGBggH/4h39YNL0siiJmZmYA61+//fbbefTRRxeY4xuNBn/7t3+7rOu96U1vAuAP/uAPaDQaZ70/t+Oc89vPzs6edcwP/dAPYYzhD/7gDxa9xpwbBJjPWvjrv/7rBcc88sgjy3Yp7Nmzh7G
"text/plain": [
"<Figure size 576x504 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgcAAAHQCAYAAAA1cskxAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdeXhdV3no/+/ae5950DzLkizZ8hTbcSbHzkQGIBBCSICEAEkYCiXloS2lPNByube37aW3pQHapL0MLVDgl4YwBBJCBpKQkMRxRju241myZM2zdOZp7/X749iyFcm27FjW4PfzPH4Sn72197tk6ez3rPWutZTWWiOEEEIIcYgx2wEIIYQQYm6R5EAIIYQQE0hyIIQQQogJJDkQQgghxASSHAghhBBiAkkOhBBCCDGBJAdCzCOdnZ0sW7aMu++++7ivzSVf/vKXWbZs2azG8Mtf/pJly5bx4osvzmocxzLX4xNnH2u2AxBirnvxxRe5/fbbJ7zm9/tZvHgxN9xwAx/96EcxTXOWontrOjs7eeCBB7jmmmtYsWLFbIdDOp3m/vvv51e/+hWdnZ2kUimKi4tpbGxk/fr1fPrTn57tECf45S9/yV/91V+N/10pRSAQoLm5mVtuuYX3ve99sxecEG+BJAdCTNN73vMeLr/8crTW9Pf388ADD/C1r32N/fv383d/93ezFldNTQ3btm07pQSlq6uLe+65h5qamllPDnK5HHfccQdbtmzhiiuu4Prrr8fv99PZ2ckrr7zCt7/97TmXHBx22223sXr1arTWdHZ28rOf/YwvfelL9Pb28pnPfOaEX3/DDTdw3XXX4XK5zkC0QpyYJAdCTNPKlSu54YYbxv/+4Q9/mHe961387Gc/48/+7M8oLS2d8utisRjBYHDG4lJK4fF4Zuz6Z8qTTz7Jli1buOOOO/jrv/7rScd7e3tnIarpueCCC7j22mvH//7+97+fa6+9lu9973v80R/9EZY19Vvt4Z8N0zTnbe+TWJik5kCIUxQMBlm3bh1aazo6OgC46qqruO2229i5cyef/OQnOf/883nve987/jVtbW188Ytf5NJLL+Wcc87hqquu4h//8R9JJBKTrv/KK6/woQ99iDVr1rBx40b+9m//dsrzjldz8Nhjj3HbbbdxwQUXsHbtWt75znfy93//92QyGX75y1+OD5f81V/9FcuWLWPZsmXcdttt41+vtebee+/lpptuYu3ataxbt47bbruNzZs3T7pXOp3mH//xH7n00ktZs2YNH/jAB3juueem/f1sb28HYMOGDVMer6ysnPD3lpYW/uZv/obrrruOdevWsXbtWm666Sbuv//+ad8zk8nw7W9/m+uuu47Vq1dzwQUX8JnPfIadO3dO+xpTqaqqoqmpiVgsxvDwMADLli3jy1/+Mi+88AK33nor69at48477wSOXXOQyWT43ve+xw033MDatWs5//zzuemmm/jJT34y4bxoNMrXv/513v72t3POOedw8cUX8xd/8RfjP5dCnCzpORDiFGmtxx9oRUVF4693d3dzxx13cO211/KOd7xj/IG+Y8cO7rjjDsLhMLfccgsVFRXs3r2bH//4x2zZsoUf//jH493Kr7/+Oh//+McJBAJ86lOfIhQK8dvf/pYvfelL047vm9/8Jt/+9rdZsmQJH/vYxygrK+PgwYM8/vjj/Omf/ikXXnghn/nMZ/j2t7/NLbfcwvnnnw8woQfki1/8Ig8//DDvfOc7uemmm8hkMjz00EN84hOf4O677+bqq68eP/cv/uIveOKJJ7jyyiu57LLLOHjwIJ/73Oeora2dVryLFi0C4MEHH2TDhg14vd7jnv/SSy/xyiuv8La3vY3a2lqSySSPPvooX/3qVxkZGeGP//iPj/v12WyWT37yk2zZsoUbbriBj3zkI8RiMe6//35uvfVWfvKTn7B69eppxf5mmUyGnp4eLMsiHA6Pv75jxw4ee+wxbr75Zm688cYTXuOTn/wkL730Epdeeinvfe978Xg87N27l8cff5yPfvSjQD4x+NCHPkR3dzfvf//7Wbp0KQMDA9x777188IMf5Be/+AU1NTWn1A5xFtNCiOPavHmzbm5u1nfffbceGhrSQ0NDeteuXforX/mKbm5u1jfffPP4uVdeeaVubm7W999//6TrXH/99fqd73ynjkajE15//PHHdXNzs/7FL34x/tott9yiV61apVtbW8dfS6fT+v3vf79ubm7W//qv/zr+ekdHx6TXXn/9dd3c3Kxvu+02nUqlJtzPcRztOM6Eth197zfHdd999014PZvN6htvvFFfeeWV49d59tlndXNzs/7Sl7404dzf/e53urm5WTc3N0+6/pul02l944036ubmZn3++efrT3/60/qee+7Rzz//vM5kMpPOj8fjk16zbVt/9KMf1eedd96Er/nFL36hm5ub9ebNm8df+8EPfqCbm5v1H/7whwnXiEaj+oorrtAf/ehHTxjz4ev+/Oc/10NDQ3pwcFC//vrr+s4779TNzc3685///Pi5h78Pzz///DGvc3R83/3ud3Vzc7O+6667pmznYX/3d3+nV69erXft2jXhnM7OTr1u3bpJ/yZCTIf0HAgxTXffffeErnvDMLjqqqsmFSMWFhZy0003TXhtz5497Nmzh8997nNkMpnxrmaA888/H7/fz/PPP89NN93E0NAQW7Zs4Z3vfCeLFy8eP8/tdvOxj32ML3zhCyeM9cEHHwTgC1/4wqR6BKXUtNr74IMPEggEuOaaaybEC/nhk7vvvpu2tjYWL17ME088AcAnP/nJCeddc801LF68mAMHDpzwfm63mx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HVY4ecz9af38/P/vZz6Z1v/e9730MDAzwgx/8YMrjR7dvNlx//fWMjY3x7//+75OOHW63YRhcf/31bNu2jUcffXTK6wwNDc1onGJhkp4DIc4ApRT/9E//xB133MF
"text/plain": [
"<Figure size 576x504 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgkAAAHQCAYAAAAru/mCAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOz9eZRdV3ngf3/3PsOdb82lkkqz5JLnmcETxgyxCYPBJCF0mAKBhpWVzkCnIZ3F+mV1emVcBDrQCQkJydtkEYZmCIQOEDAYjDGOwROeZM1VqpJqvnXnM+zn/WNXlSSrSpZlWaqS9mctY6vuqXP3OSXqPHfvZz+PEhHBcRzHcRznafTZHoDjOI7jOCuTCxIcx3Ecx1mSCxIcx3Ecx1mSCxIcx3Ecx1mSCxIcx3Ecx1mSCxIcx3Ecx1mSCxIcZxUZGRlhx44dfOxjHzvh11aSD37wg+zYseOsjuFLX/oSO3bs4Mc//vFZHcdyVvr4nPOXf7YH4Dgr3Y9//GPe9ra3HfO1fD7Pli1buP3223nLW96C53lnaXTPzcjICF/+8pd5xStewUUXXXS2h0O73ebzn/88X/nKVxgZGaHVatHd3c3WrVt50YtexHve856zPcRjfOlLX+L3fu/3Fv+slKJQKDA0NMSb3vQmXv/615+9wTnOaeCCBMc5Sa95zWt4yUtegogwPj7Ol7/8Zf7oj/6IXbt28Yd/+IdnbVyDg4M8/PDDpxSoHDx4kI9//OMMDg6e9SAhSRLe/va388ADD3DzzTfz2te+lnw+z8jICPfffz+f+MQnVlyQsOCtb30rl112GSLCyMgIX/jCF/jABz7AoUOHeO973/uM33/77bfz6le/miAIzsBoHefkuSDBcU7SxRdfzO2337745//0n/4Tr3rVq/jCF77Ab/7mb9Lb27vk99VqNYrF4vM2LqUUmUzmeTv/mfKd73yHBx54gLe//e389//+3497/dChQ2dhVCfn2muv5bbbblv88xvf+EZuu+02PvnJT/Jrv/Zr+P7Sv2oX/m54nrdqZ6Occ5vLSXCcU1QsFrnqqqsQEYaHhwF42ctexlvf+lYee+wx3vWud3HNNdfwute9bvF79u3bx+/+7u9y4403cumll/Kyl72MP/3TP6XRaBx3/vvvv59f/uVf5vLLL+f666/nf/yP/7HkcSfKSfjmN7/JW9/6Vq699lquuOIKbr31Vv7n//yfRFHEl770pcVllN/7vd9jx44d7Nixg7e+9a2L3y8ifOYzn+GOO+7giiuu4KqrruKtb30r995773Hv1W63+dM//VNuvPFGLr/8cn7hF36Bu++++6Tv5/79+wG47rrrlnx9YGDgmD/v3r2bP/iDP+DVr341V111FVdccQV33HEHn//850/6PaMo4hOf+ASvfvWrueyyy7j22mt573vfy2OPPXbS51jK2rVr2bZtG7VajenpaQB27NjBBz/4QX70ox/x5je/mauuuor3ve99wPI5CVEU8clPfpLbb7+dK664gmuuuYY77riDf/qnfzrmuGq1yp//+Z/zyle+kksvvZQXv/jF/M7v/M7i30vHOVVuJsFxTpGILD7Yurq6Fr8+OjrK29/+dm677TZ+7ud+bvHB/rOf/Yy3v/3tlMtl3vSmN7FmzRqeeOIJPv3pT/PAAw/w6U9/enG6+aGHHuJXf/VXKRQKvPvd76ZUKvH//t//4wMf+MBJj+8jH/kIn/jEJ9i+fTvveMc76Ovr48CBA3zrW9/iv/yX/8ILXvAC3vve9/KJT3yCN73pTVxzzTUAx8yI/O7v/i5f//rXufXWW7njjjuIooivfe1rvPOd7+RjH/sYL3/5yxeP/Z3f+R2+/e1vc8stt3DTTTdx4MABfuM3foP169ef1Hg3bNgAwFe/+lWuu+46stnsCY+/7777uP/++3npS1/K+vXraTabfOMb3+BDH/oQMzMz/Of//J9P+P1xHPOud72LBx54gNtvv51f+ZVfoVar8fnPf543v/nN/NM//ROXXXbZSY396aIoYmxsDN/3KZfLi1//2c9+xje/+U1+6Zd+iTe84Q3PeI53vetd3Hfffdx444287nWvI5PJsHPnTr71rW/xlre8BbABwi//8i8zOjrKG9/4Ri644AImJib4zGc+wy/+4i/yxS9+kcHBwVO6DsdBHMc5oXvvvVeGhobkYx/7mExNTcnU1JQ8/vjj8vu///syNDQkv/RLv7R47C233CJDQ0Py+c9//rjzvPa1r5Vbb71VqtXqMV//1re+JUNDQ/LFL35x8WtvetOb5JJLLpE9e/Ysfq3dbssb3/hGGRoakr/8y79c/Prw8PBxX3vooYdkaGhI3vrWt0qr1Trm/YwxYow55tqOfu+nj+uzn/3sMV+P41je8IY3yC233LJ4nh/84AcyNDQkH/jAB4459t///d9laGhIhoaGjjv/07XbbXnDG94gQ0NDcs0118h73vMe+fjHPy4//OEPJYqi446v1+vHfS1NU3nLW94iV1999THf88UvflGGhobk3nvvXfzaP/zDP8jQ0JB8//vfP+Yc1WpVbr75ZnnLW97yjGNeOO///b//V6ampmRyclIeeughed/73idDQ0Py27/924vHLtyHH/7wh8ue5+jx/e3f/q0MDQ3Jhz/84SWvc8Ef/uEfymWXXSaPP/74MceMjIzIVVddddzPxHGeDTeT4Dgn6WMf+9gxU/paa172spcdl7TY2dnJHXfccczXnnzySZ588kl+4zd+gyiKFqegAa655hry+Tw//OEPueOOO5iamuKBBx7g1ltvZcuWLYvHhWHIO97xDt7//vc/41i/+tWvAvD+97//uHwFpdRJXe9Xv/pVCoUCr3jFK44ZL9hllY997GPs27ePLVu28O1vfxuAd73rXccc94pXvIItW7awd+/eZ3y/MAz59Kc/zf/5P/+Hf/u3f+Ouu+7ie9/7HgA9PT188IMfPGbpJp/PL/53u92m0WggItxwww3cd9997Nmz54RbL7/61a+ydetWLrnkkuOu7/rrr+crX/kKrVbrGWc0gONyKIIg4A1veAMf+tCHjvn6hRdeyPXXX/+M5wP42te+RkdHB7/+679+3Gta25ViEeFrX/saL3jBC+jv7z/mOnK5HFdeeeWzWvJxnKdzQYLjnKQ3velN3HbbbSilyOVybN68mc7OzuOO27Bhw3FJaLt37waODzSONjk5CbC4jrx169bjjtm+fftJjXX//v0opbjwwgtP6vil7N69m3q9fsKH2tTUFFu2bGF4eBitNZs3bz7umG3btp1UkABQKBR43/vex/ve9z5qtRoPP/ww3/72t/n85z/PBz7wAQYHBxeXRer1Oh//+Mf5t3/7N8bGxo4719zc3DNeX6vVWjYHAmBmZoa1a9c+47h//dd/nWuvvXZxC+TWrVuXTFZd6v4sZ//+/Vx00UUnTEqdnp5mdnaWu+++e9nrWAgoHOdUuCDBcU7Spk2bTupTYC6XW/a1d77zndx0001Lvrawdi0iwNKf+BdeeyYictIzBic6R3d3Nx/+8IeXPeaCCy44qfOcimKxyPXXX8/111/PhRdeyIc+9CG+9KUvLQYJ73//+/ne977HL/3SL/GCF7yAjo4OfN/nrrvu4h//8R8xxjzjuIaGho6pc/B03d3dJzXWoaGh5/x341Qs3Nvrr7+ed7/73af13I4DLkhwnDNi06ZNgP1U90wPk40bNwJHZh+OttTXlrJlyxZ+8IMf8OSTT3L55Zcve9yJAolNmzaxb98+rrjiCgqFwgnfb8OGDRhj2Ldv33GBw549e05qzCdyxRVXAHD48GHAzhJ873vf4/bbb+d//I//ccyx99xzz0mdc9OmTczMzPDiF794RX7a3rx5M3v27CGKIsIwXPKY7u5uyuUytVrtpJcxHOfZWHn/z3Ccc9DFF1/M0NAQn/3sZ5fclpYkCbOzs4Bdf7/yyiu58847j5mmj6KIf/zHfzyp93vta18LwF/8xV8QRdFxry98Al1Y169UKscd8/rXvx5jDH/xF3+x5HssLI8Ai7sc/v7v//6YY7797W+f9FLD448/zvj
"text/plain": [
"<Figure size 576x504 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"new_predict = model.predict(X)\n",
"X_trans = StandardScaler().fit_transform(X)\n",
"\n",
"model_scatter(0,1)\n",
"model_scatter(0,2)\n",
"model_scatter(2,1)"
]
},
{
"cell_type": "markdown",
"id": "548cb174-4c66-4fdc-ba4b-ddeea123a1e5",
"metadata": {},
"source": [
"If you stare at it long enough you can make some sense of it, but it's not a clear picture. You don't get the full story.<br>\n",
"But if we change the scaler..."
]
},
{
"cell_type": "code",
"execution_count": 162,
"id": "60a2f70e-b778-4251-99b0-43d4ba2cf1e0",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T09:14:14.158763Z",
"iopub.status.busy": "2022-05-29T09:14:14.158528Z",
"iopub.status.idle": "2022-05-29T09:14:14.163957Z",
"shell.execute_reply": "2022-05-29T09:14:14.162995Z",
"shell.execute_reply.started": "2022-05-29T09:14:14.158746Z"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"array([[-0.03310339, -0.06938842, 0.6904143 , ..., -0.17377076,\n",
" -0.0664537 , -1.66010942],\n",
" [ 1.2909327 , -0.76451772, 0.30382328, ..., -0.17377076,\n",
" -0.0664537 , -1.66010942],\n",
" [-0.90206642, 0.69194368, -0.37772237, ..., -0.17377076,\n",
" -0.0664537 , 0.60236993],\n",
" ...,\n",
" [ 0.86056949, 1.48637717, -0.4472133 , ..., -0.17377076,\n",
" -0.0664537 , 0.60236993],\n",
" [-0.60760739, 0.5595381 , 0.09535049, ..., -0.17377076,\n",
" -0.0664537 , -1.66010942],\n",
" [ 0.63612169, -0.83072051, -0.45828603, ..., -0.17377076,\n",
" -0.0664537 , 0.60236993]])"
]
},
"execution_count": 162,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"X_trans"
]
},
{
"cell_type": "code",
"execution_count": 163,
"id": "fb712bcb-5d39-47bd-9ea3-fae66621552b",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T09:14:14.166982Z",
"iopub.status.busy": "2022-05-29T09:14:14.166410Z",
"iopub.status.idle": "2022-05-29T09:14:16.306778Z",
"shell.execute_reply": "2022-05-29T09:14:16.306017Z",
"shell.execute_reply.started": "2022-05-29T09:14:14.166950Z"
},
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAg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pwB4NWvfjV33303Tz31FO9617u46aabeNOb3rT2m1OnTvEbv/Eb3H777VxzzTW8+tWv5v3vfz+tVuuc7X/3u9/lJ3/yJ7nuuuu47bbb+O3f/u0tv3chTcIXv/hF7r77bm6++WYOHTrE6173Ov77f//v+L7Ppz71qbU0ym/+5m9y8OBBDh48yN133732exHhYx/7GHfddReHDh3ihhtu4O677+b+++8/Z1/dbpf3v//93H777Vx33XX82I/9GN/85jcv+XyePn0agJe97GVbfj46Orrp38ePH+e//tf/yhve8AZuuOEGDh06xF133cXHP/7xS96n7/t8+MMf5g1veAPXXnstN998M+9+97t56qmnLnkbW2FsbIx9+/bRaDRYWVkB4ODBg7zvfe/j29/+Nm9/+9u54YYbeM973gOcX5Pg+z5//ud/zpvf/GYOHTrETTfdxF133cVHP/rRTd+r1+v8/u//Pj/8wz/MNddcw6233sqv/dqvrd2XPfTwbNGLJPTQw/OEiKxNbH19fWt/n5mZ4Z3vfCd33nknP/IjP7I2sT/xxBO8853vpFAo8La3vY2RkREOHz7MRz7yER5++GE+8pGPrIWbH330UX7u536ObDbLL/zCL5DP5/m///f/8t73vveSx/eHf/iHfPjDH2b//v387M/+LENDQ0xOTvKlL32Jf//v/z233HIL7373u/nwhz/M2972Nm666SaATRGR3/iN3+Cf/umfeN3rXsddd92F7/t87nOf4+d//uf54Ac/yGte85q17/7ar/0a99xzD3fccQeveMUrmJyc5Jd/+ZfZvn37JY13x44dAHz2s5/lZS97GalU6oLff/DBB/nud7/LD/3QD7F9+3ba7TZf+MIX+K3f+i3K5TL/7t/9uwv+PggC3vWud/Hwww/z5je/mZ/+6Z+m0Wjw8Y9/nLe//e189KMf5dprr72ksZ8N3/eZnZ3FdV0KhcLa35944gm++MUv8hM/8RO85S1vueg23vWud/Hggw9y++2386Y3vYlkMsnRo0f50pe+xDve8Q7AEoSf/MmfZGZmhre+9a0cOHCAxcVFPvaxj/HjP/7jfPKTn2R8fPw5HUcP/w9Deuihh0vC/fffLxMTE/LBD35QlpeXZXl5WZ5++mn5L//lv8jExIT8xE/8xNp377jjDpmYmJCPf/zj52znjW98o7zuda+Ter2+6e9f+tKXZGJiQj75yU+u/e1tb3ubXH311XLixIm1v3W7XXnrW98qExMT8sd//Mdrfz9z5sw5f3v00UdlYmJC7r77bul0Opv2Z4wRY8ymY9u477PH9fd///eb/h4EgbzlLW+RO+64Y2073/jGN2RiYkLe+973bvruP//zP8vExIRMTEycs/2z0e125S1veYtMTEzITTfdJL/4i78of/InfyLf+ta3xPf9c77fbDbP+VsURfKOd7xDbrzxxk2/+eQnPykTExNy//33r/3tr//6r2ViYkK+/vWvb9pGvV6XV73qVfKOd7zjomNe3e7//t//W5aXl2VpaUkeffRRec973iMTExPyq7/6q2vfXT0P3/rWt867nY3j+7M/+zOZmJiQD3zgA1se5yr+23/7b3LttdfK008/vek7U1NTcsMNN5xzTXro4VLQiyT00MOzxAc/+MFNIX2tNa9+9avPES2WSiXuuuuuTX87cuQIR44c4Zd/+ZfxfX8tBA1w0003kclk+Na3vsVdd93F8vIyDz/8MK973evYs2fP2vcSiQQ/+7M/y6//+q9fdKyf/exnAfj1X//1c/QKSqlLOt7PfvazZLNZXvva124aL9i0ygc/+EFOnTrFnj17uOeeewB417vetel7r33ta9mzZw8nT5686P4SiQQf+chH+Nu//Vs+//nP87WvfY2vfvWrAAwMDPC+971vU+omk8ms/f9ut0ur1UJEePnLX86DDz7IiRMnLlh6+dnPfpa9e/dy9dVXn3N8t912G5/5zGfodDoXjWgA52goPM/jLW95C7/1W7+16e9XXHEFt91220W3B/C5z32OYrHIL/3SL53zmdY2YywifO5zn+OWW25heHh403Gk02muv/76Z5Xy6aGHVfRIQg89PEu87W1v484770QpRTqdZvfu3ZRKpXO+t2PHjnNEaMePHwfOJRobsbS0BLCWR967d+8539m/f/8ljfX06dMopbjiiisu6ftb4fjx4zSbzQtOasvLy+zZs4czZ86gtWb37t3nfGffvn2XRBIAstks73nPe3jPe95Do9Hgscce45577uHjH/84733vexkfH19LizSbTf7kT/6Ez3/+88zOzp6zrVqtdtHj63Q659VAAJTLZcbGxi467l/6pV/i5ptvXiuB3Lt375Zi1a3Oz/lw+vRprrzyyguKUldWVqhUKnzzm98873GsEooeeng26JGEHnp4lti1a9clrQLT6fR5P/v5n/95XvGKV2z52WruWkSArVf8q59dDCJyyRGDC22jv7+fD3zgA+f9zoEDBy5pO88FuVyO2267jdtuu40rrriC3/qt3+JTn/rUGkn49V//db761a/yEz/xE9xyyy0Ui0Vc1+VrX/saf/M3f4Mx5qLjmpiY2ORzcDb6+/svaawTExPP+954Llg9t7fddhu/8Au/cFm33cP/2+iRhB56+BfErl27ALuqu9hksnPnTmA9+rARW/1tK+zZs4dvfOMbHDlyhOuuu+6837sQkdi1axenTp3i0KFDZLPZC+5vx44dGGM4derUOcThxIkTlzTmC+HQoUMAzM/PAzZK8NWvfpU3v/nN/PZv//am7953332XtM1du3ZRLpe59dZbvy9X27t37+bEiRP4vk8ikdjyO/39/RQKBRqNxiWnMXro4VLw/fdE9NDDv2JcddVVTExM8Pd///dblqWFYUilUgFs/v3666/n3nvv3RSm932fv/mbv7mk/b3xjW8E4A/+4A/
"text/plain": [
"<Figure size 576x504 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgkAAAHQCAYAAAAru/mCAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOy9d5BlZ32n/7zvSTeHvp17cugJmtFoFEAoIESSMAaBsMHYyNhm8cK6vF7b68XeLVftb+3yLnZhu4xrwfbauAxmsViCSSYISUgoh5E0o8nTM53jzfGk9/39cXpa05oeaZQQ2PehVEzfe+457znn3vN+3m8UWmtNly5dunTp0qXLs5Cv9gC6dOnSpUuXLj+edEVCly5dunTp0mVNuiKhS5cuXbp06bImXZHQpUuXLl26dFmTrkjo0qVLly5duqxJVyR06dKlS5cuXdakKxK6dPkJZGpqih07dvDJT37yOV/7ceJ3f/d32bFjx6s6hi9/+cvs2LGDhx566FUdx4X4cR9fl397mK/2ALp0+UnhoYce4hd/8RdXvZZIJNi8eTO33HILH/jABzAM41Ua3UtjamqKr3zlK7z5zW9m165dr/ZwcF2X22+/na9+9atMTU3R6XTo6elhy5YtvPa1r+VXf/VXX+0hruLLX/4yv/d7v7fytxCCZDLJ6Ogo73vf+3jXu9716g2uS5eXQFckdOnyAvnpn/5pXv/616O1ZmFhga985Sv80R/9ESdPnuQP/uAPXrVxjYyM8NRTT70ooTI9Pc1f/uVfMjIy8qqLhCAI+OAHP8iBAwe44YYbeMc73kEikWBqaopHH32UT3/60z92IuEst912G3v37kVrzdTUFF/84hf52Mc+xtzcHB/5yEee9/O33HILb3/727Es60cw2i5dnp+uSOjS5QWye/dubrnllpW/f/7nf563ve1tfPGLX+Q3fuM36O3tXfNzjUaDVCr1io1LCIHjOK/Y/n9UfP/73+fAgQN88IMf5L/+1/963vtzc3OvwqgujiuvvJKbb7555e/3vOc93HzzzfzN3/wN/+7f/TtMc+1H7tnvhmEYP7HWqC7/OunGJHTp8hJJpVLs378frTWTk5MAvPGNb+S2227j8OHDfOhDH+KKK67gne9858pnzpw5w+/8zu9w3XXXsWfPHt74xjfy8Y9/nFardd7+H330UX7u536OSy+9lGuuuYb/8T/+x5rbPVdMwne+8x1uu+02rrzySvbt28dNN93EH/7hH+J5Hl/+8pdX3Ci/93u/x44dO9ixYwe33Xbbyue11nz+85/n1ltvZd++fezfv5/bbruNBx988Lxjua7Lxz/+ca677jouvfRSfuZnfoYf/vCHF309x8fHAXjd61635vuDg4Or/j516hT//b//d97+9rezf/9+9u3bx6233srtt99+0cf0PI9Pf/rTvP3tb2fv3r1ceeWVfOQjH+Hw4cMXvY+1GBoaYuvWrTQaDUqlEgA7duzgd3/3d3nggQd4//vfz/79+/noRz8KXDgmwfM8/uZv/oZbbrmFff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777Lrifc8f313/913p0dFR/4hOfWPM8z/IHf/AHeu/evfrIkSOrtpmamtL79+8/75506XIxdC0JXbq8QD75yU+uMulLKXnjG994XtBiLpfj1ltvXfXasWPHOHbsGL/+67+O53krJmiAK664gkQiwX333cett95KsVjkwIED3HTTTWzevHllO9u2+aVf+iV++7d/+3nH+rWvfQ2A3/7t3z4vXkEIcVHn+7WvfY1kMsmb3/zmVeOFyK3yyU9+kjNnzrB582buuOMOAD70oQ+t2u7Nb34zmzdv5vTp0897PNu2+exnP8s//MM/8C//8i/84Ac/4O677wagUCjwu7/7u6tcN4lEYuXfruvSarXQWnPttdfy8MMPMzY29pypl1/72tfYsmULl1xyyXnnd8011/DVr36VTqfzvBYN4LwYCsuyePe7383v//7vr3p9586dXHPNNc+7P4Cvf/3rZLNZfu3Xfu2896SMPMZaa77+9a9z1VVX0d/fv+o84vE4l1122Qty+XTpcpauSOjS5QXyvve9j5tvvhkhBPF4nE2bNpHL5c7bbv369ecFoZ06dQo4X2icy9LSEsCKH3nLli3nbbNt27aLGuv4+DhCCHbu3HlR26/FqVOnaDabzzmpFYtFNm/ezOTkJFJKNm3adN42W7duvSiRAJBMJvnoRz/KRz/6URqNBk899RR33HEHt99+Ox/72McYGRlZcYs0m03+8i//kn/5l39hdnb2vH3VarXnPb9Op3PBGAiAcrnM0NDQ8477137t17jyyitXUiC3bNmyZrDqWtfnQoyPj7Nr167nDEotlUpUKhV++MMfXvA8zgqKLl1eCF2R0KXLC2Tjxo0XtQqMx+MXfO9XfuVXuP7669d876zvWmsNrL3iP/ve86G1vmiLwXPto6enh0984hMX3Gb79u0XtZ8XQyqV4pprruGaa65h586d/P7v/z5f/vKXV0TCb//2b3P33Xfz3ve+l6uuuopsNotpmvzgBz/g7//+71FKPe+4RkdHV9U5eDY9PT0XNdbR0dGX/N14MZy9ttdccw0f/vCHX9Z9d/m3TVckdOnyI2Tjxo1AtKp7vslkw4YNwDPWh3NZ67W12Lx5M/feey/Hjh3j0ksvveB2zyUkNm7cyJkzZ9i3bx/JZPI5j7d+/XqUUpw5c+Y84TA2NnZRY34u9u3bB8D8/DwQWQnuvvtubrnlFv7H//gfq7a9//77L2qfGzdupFwuc/XVV/9YrrY3bdrE2NgYnudh2/aa2/T09JDJZGg0GhftxujS5WL48ftFdOnyr5jdu3czOjrKF77whTXT0oIgoFKpAJH//bLLLuPOO+9cZab3PI+///u/v6jjveMd7wDgT//0T/E877z3z65Az/r1q9Xqedu8613vQinFn/7pn655jLPuEWAly+Fv//ZvV21
"text/plain": [
"<Figure size 576x504 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgkAAAHQCAYAAAAru/mCAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOz9eZBkV3nmj3/OuUvulbUvXb0v1a3W0lqREBIgwCAPBoEYG2MjY5uxB8Lh8dgeD3gmHDFfz4TH2IHtMI4B7/4ZzNgwgA3GbEJskhBC+9b7Ut21b5mVe97lvL8/TtbWVb0ItdTCzicC1JV5895zzz33nPe87/M+rxIRoY022mijjTbaaOMs6MvdgDbaaKONNtpo4+WJtpHQRhtttNFGG21siLaR0EYbbbTRRhttbIi2kdBGG2200UYbbWyItpHQRhtttNFGG21siLaR0EYbbbTRRhttbIi2kdBGGz+EGBsbY+/evXzkIx8572cvJ3zwgx9k7969l7UNn/3sZ9m7dy/f+973Lms7zoWXe/va+LcH93I3oI02fljwve99j5/5mZ9Z81k6nWbHjh3cddddvPvd78ZxnMvUuheGsbExPve5z/GGN7yBK6644nI3h2azyac+9Sn+8R//kbGxMRqNBt3d3ezcuZObb76ZX/zFX7zcTVyDz372s/zmb/7m8t9KKTKZDCMjI7zzne/kbW972+VrXBttvAC0jYQ22nie+LEf+zFe/epXIyLMzMzwuc99jt/5nd/h2LFj/M//+T8vW7uGh4d56qmnfiBDZXx8nD/5kz9heHj4shsJURTxnve8h8cff5zXvOY1vOUtbyGdTjM2NsYjjzzCxz72sZedkbCEe+65h6uvvhoRYWxsjE9/+tN84AMfYGpqive9730X/P1dd93Fm9/8ZjzPewla20YbF0bbSGijjeeJ/fv3c9dddy3//VM/9VP86I/+KJ/+9Kf5lV/5FXp7ezf8XaVSIZvNvmjtUkqRSCRetPO/VPj617/O448/znve8x7+23/7b+u+n5qaugytujjceOON3Hnnnct/v+Md7+DOO+/kz//8z/kP/+E/4LobT7lLY8NxnB9ab1Qb/zrR5iS00cYLRDab5brrrkNEOHPmDACve93ruOeee3juued473vfyw033MBb3/rW5d+cOnWK3/iN3+C2227jqquu4nWvex0f+tCHqNVq687/yCOP8JM/+ZNcc8013Hrrrfz2b//2hsedj5Pwla98hXvuuYcbb7yRAwcO8KY3vYn/9b/+F0EQ8NnPfnY5jPKbv/mb7N27l71793LPPfcs/15E+OQnP8ndd9/NgQMHuO6667jnnnt46KGH1l2r2WzyoQ99iNtuu41rrrmGf//v/z3333//Rffn6OgoAK985Ss3/H5wcHDN38ePH+d//I//wZvf/Gauu+46Dhw4wN13382nPvWpi75mEAR87GMf481vfjNXX301N954I+973/t47rnnLvocG2FoaIhdu3ZRqVRYWFgAYO/evXzwgx/ku9/9Lu9617u47rrreP/73w+cm5MQBAF//ud/zl133cWBAwe44YYbuPvuu/nEJz6x5rhyuczv//7v8yM/8iNcddVV3HLLLfzar/3a8rhso43ni7YnoY02XiBEZHlh6+rqWv58YmKC97znPdx555288Y1vXF7Yn3nmGd7znvfQ0dHBO9/5TgYGBjh06BAf//jHefzxx/n4xz++7G5+8skn+bmf+zkymQy/8Au/QC6X41/+5V/4wAc+cNHt+8M//EM+9rGPsXv3bn72Z3+Wvr4+Tp8+zVe/+lX+03/6T9x00028733v42Mf+xjvfOc7ueGGGwDWeER+4zd+gy9+8Yu86U1v4u677yYIAr7whS/w8z//83zkIx/h9a9//fKxv/Zrv8a9997LHXfcwe23387p06f55V/+ZTZv3nxR7d2yZQsAn//853nlK19JMpk87/EPP/wwjzzyCK997WvZvHkz9XqdL3/5y/zWb/0WhUKB//gf/+N5fx+GIe9973t5/PHHueuuu/jpn/5pKpUKn/rUp3jXu97FJz7xCa6++uqLavvZCIKAyclJXNelo6Nj+fNnnnmGr3zlK/zET/wEb3/72y94jve+9708/PDD3Hbbbbz1rW8lkUhw5MgRvvrVr/Lud78bsAbCT/7kTzIxMcE73vEO9uzZw+zsLJ/85Cf58R//cT7zmc8wPDz8A91HG/+GIW200cZF4aGHHpKRkRH5yEc+IvPz8zI/Py8HDx6U//7f/7uMjIzIT/zETywfe8cdd8jIyIh86lOfWneet7zlLfKmN71JyuXyms+/+tWvysjIiHzmM59Z/uyd73ynXHnllXLixInlz5rNprzjHe+QkZER+eM//uPlz8+cObPusyeffFJGRkbknnvukUajseZ6xhgxxqy5t9XXPrtdf//3f7/m8zAM5e1vf7vccccdy+f5zne+IyMjI/KBD3xgzbFf+9rXZGRkREZGRtad/2w0m015+9vfLiMjI3LDDTfIL/7iL8qf/MmfyAMPPCBBEKw7vlqtrvssjmN597vfLddff/2a33zmM5+RkZEReeihh5Y/++u//msZGRmRb3/722vOUS6X5TWveY28+93vvmCbl877//7f/5P5+XmZm5uTJ598Ut7//vfLyMiI/Oqv/urysUv98MADD5zzPKvb92d/9mcyMjIiH/7whze8zyX8z//5P+Xqq6+WgwcPrjlmbGxMrrvuunXPpI02LgZtT0IbbTxPfOQjH1nj0tda87rXvW4dabGzs5O77757zWeHDx/m8OHD/PIv/zJBECy7oAFuuOEG0uk0DzzwAHfffTfz8/M8/vjjvOlNb2LHjh3Lx/m+z8/+7M/y67/+6xds6+c//3kAfv3Xf30dX0EpdVH3+/nPf55MJsMb3vCGNe0FG1b5yEc+wqlTp9ixYwf33nsvAO9973vXHPeGN7yBHTt2cPLkyQtez/d9Pv7xj/O3f/u3fOlLX+Jb3/oW3/zmNwHo6enhgx/84JrQTTqdXv53s9mkVqshIrzqVa/i4Ycf5sSJE+dNvfz85z/Pzp07ufLKK9fd36233so//uM/0mg0LujRANZxKDzP4+1vfzu/9Vu/tebzffv2ceutt17wfABf+MIXyOfz/NIv/dK677S2EWMR4Qtf+AI33XQT/f39a+4jlUpx7bXXPq+QTxttLKFtJLTRxvPEO9/5Tu68806UUqRSKbZv305nZ+e647Zs2bKOhHb8+HFgvaGxGnNzcwDLceSdO3euO2b37t0X1dbR0VGUUuzbt++ijt8Ix48fp1qtnndRm5+fZ8eOHZw5cwatNdu3b193zK5duy7KSADIZDK8//3v5/3vfz+VSoWnnnqKe++9l0996lN84AMfYHh4eDksUq1W+ZM/+RO+9KUvMTk5ue5cpVLpgvfXaDTOyYEAKBQKDA0NXbDdv/RLv8SNN964nAK5c+fODcmqG/XPuTA6OsoVV1xxXlLqwsICxWKR+++//5z3sWRQtNHG80HbSGijjeeJbdu2XdQuMJVKnfO7n//5n+f222/f8Lul2LWIABvv+Je+uxBE5KI9Buc7R3d3Nx/+8IfPecyePXsu6jw/CLLZLLfeeiu33nor+/bt47d+67f47Gc/u2wk/Pqv/zrf/OY3+Ymf+Aluuukm8vk8ruvyrW99i7/5m7/BGHPBdo2MjKzROTgb3d3dF9XWkZGRFzw2fhAs9e2tt97KL/zCL1zSc7fxbxttI6GNNl5CbNu2DbC7ugstJlu3bgVWvA+rsdFnG2HHjh185zvf4fDhw1xzzTXnPO58hsS2bds4deoUBw4cIJPJnPd6W7ZswRjDqVOn1hkOJ06cuKg2nw8HDhwAYHp6GrBegm9+85vcdddd/PZv//aaYx988MGLOue2bdsoFArccsstL8vd9vbt2zlx4gRBEOD7/obHdHd309HRQaVSuegwRhttXAxefm9EG238K8b+/fsZGRnh7//+7zdMS4uiiGKxCNj4+7XXXst99923xk0fBAF/8zd/c1HXe8tb3gLAH/zBHxAEwbrvl3agS3H9xcX
"text/plain": [
"<Figure size 576x504 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"X_trans = QuantileTransformer().fit_transform(X)\n",
"\n",
"model_scatter(0,1)\n",
"model_scatter(0,2)\n",
"model_scatter(2,1)"
]
},
{
"cell_type": "markdown",
"id": "436079ee-9e80-45b9-906c-efcd3e157317",
"metadata": {},
"source": [
"The quantile transformer scales the data based on quantiles, reducing the effect of outliers and creating a clear picture of the data. You can clearly see\n",
"for instance in the first picture that the predicted sale price for an old shed is the lowest, and a new mansion is worth lots of money. The model can see this clearer as well"
]
},
{
"cell_type": "code",
"execution_count": 164,
"id": "5dfafaa7-499b-4779-8c62-e222b9783940",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T09:14:16.308442Z",
"iopub.status.busy": "2022-05-29T09:14:16.307969Z",
"iopub.status.idle": "2022-05-29T09:14:16.615516Z",
"shell.execute_reply": "2022-05-29T09:14:16.614871Z",
"shell.execute_reply.started": "2022-05-29T09:14:16.308412Z"
},
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAArYAAAIGCAYAAAChycyZAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdeZzcVZXw/8/91tJVva/Zl07SSSdkY98FIZBhERlwEBUEBY04Rh8GYUaGAR3xN/AMCDggoiiugw+LLMIIAUFh2CMQCCTpbJ10J530Xr3W+r3398ftrnSl96R6See8Xy9fTldVV9261RlPne+55yhjjEEIIYQQQohDnDPWCxBCCCGEECIdJLAVQgghhBATggS2QgghhBBiQpDAVgghhBBCTAgS2AohhBBCiAlBAlshhBBCCDEhSGArhBhTZ555Jl/84hfH7PXvvfdeysvL2bVr16CPLS8v5zvf+c4orGp8G86e9eWJJ56gvLyct99+O80rE0Ic7iSwFUKkXTgc5le/+hVf+MIXOP7441m8eDEnn3wyX/3qV3niiSdIJBJjvcRDVndQWF5ezi9+8Ys+H7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GHHko+rq2tjc997nPU1NTwmc98hvnz51NfX8/DDz/MJZdcwh/+8AemT58O2KD26quv5p133uHUU0/l05/+NBkZGWzevJkXXniByy+/vM+1RCIRrrvuOl599VX+7//9v1x44YWDrn/jxo1cc801XHzxxXzqU5/inXfe4fHHH8dxHG699dbk4/72t79x1VVXkZeXx6pVq8jJyeG5557jvffeG9Z+AXi9Xi644AKeeOIJbrzxRgKBAAB/+MMfOOKII1i4cGGfv3fHHXfw85//nGXLlnHdddfR3t7Oo48+ypVXXsn999/P6aefnnzsbbfdxm9+8xuOO+44vvSlL9HY2Mj3v/99Zs6c2et5a2pquPTSS4nH4/zDP/wDs2bNYufOnfz+97/n7bff5g9/+AM5OTnDeo/RaJS//vWvTJkyhdNOO63fx332s5/l+eef54UXXuCMM84Y1mvMmzePG2+8kdtuu42zzz6bs88+G4CsrKyUx/3lL3/h17/+NZdddhnFxcW8/PLL3HfffdTU1HDbbbcN6zUBjjvuOK655hoeeOABLr30Uo455hiAAy6nEEJYEtgKIdJmy5YtZGVl9Rn4DGTnzp3cfffdnHfeecnbHMfh4YcfZtu2bcybNw+AH/3oR1RXV/Poo4+mBG4XXXQRF1xwAffeey+33347AL/+9a955513+NrXvsZ1112X8npa6z7XEQqFuOaaa6ioqOCBBx7g1FNPHdL6Kyoq+H//7/9x5JFHAvC5z32O9vZ2nnjiCb7zne8kg6Tbb78dpRT/7//9v+QefeELXzjgLN1nPvMZfv3rX/Piiy9ywQUXsHfvXt544w1uuummPh+/fft2fvGLX3D00Ufz61//Gr/fD8All1zC+eefz7//+7/z4osv4vF42L59O7/97W858cQTeeihh/B4PACsXLmyz2zwrbfeSiKR4KmnnmLKlCnJ288555zkIa9vfvObw3p/O3bsIBaLsWjRogFLDI444gjAfg7DVVxczFlnncVtt91GeXl5v19kNm7cyOOPP87ixYsBuPzyy1m9ejVPPPEEl156afKzH6qZM2dy8skn88ADD3DkkUcO6QuUEGJwUooghEib9vZ2srOzh/17kyZNSglqAU488UQAqqqqADDG8Mwzz3DccccxadIkmpqakv8JBoMceeSRvPbaa8nff+aZZ8jLy+Mb3/hGr9fr6wBYTU0Nn//856muruZ3v/vdkINagCOPPLJXYHPiiSeSSCTYvXs3AA0NDaxfv54VK1akBP4+ny95SXq4ysvLWbJkCU888QQATz75JF6vl0996lN9Pv6ll17CGMNXvvKVZFALMHnyZC666CJ2797Nhg0bUh775S9/ORnUAixevJhTTjkl5Xnb2tr461//yplnnonf70/5bKZPn86sWbN4/fXXh/3+2tvbAQbN9Hbf3/34kXDyyScng1oApRRf+cpXAHjxxRdH7HWFEMMjGVshRNpkZ2f3WVc6mL4yvPn5+YDNogI0NTURCoV47bXXOOmkk/p8np4B686dO1m0aNGQD3xdc801uK7LH//4R2bPnp329Xf3fJ0zZ06vx86dO3dYr9fTxRdfzK233sru3bt58sknWbFiBfn5+TQ1NfV6bPca5s+f3+u+BQsWALat1tKlS5M1y32tbd68eSlfIiorK9Fa8/jjj/P444/3uc7hZvGB5Jektra2AR/XHdAeyJeqoeq+atBTWVkZQJ/13UKIsSGBrRAibebPn8/atWuprq4eViDTMyO4P2NMyn9398NNt0996lM88sgj3H///dx2223Daus1nPWn2wUXXMD//b//l5tvvpmdO3dy8803D7qW4eirBGD/5+n++dOf/jQXXXRRn89zIB0lSktL8fv9g/Z57c4y9zws1l/pwoH2UD7Ybguu6x7U7wshhkYCWyFE2qxcuZK1a9fy2GOP9aprPViFhYXk5ubS3t7OySefPOjjS0tL2b59O7FYLOWye39WrVrF7Nmz+c///E8SiQT/+Z//OWDAOlzdgX5lZWWv+7Zv337Az5ubm5ts7TV16tReZQI9dXcV2LJlS68OA1u3bk1ZZ/d/b9u2rdeXlP3XO2vWLJRSxOPxIX02Q5WRkcFpp53Gn//8Z1599dV+D5A99thjAMmDXwB5eXmAzZh3Z8+h7+zqUILW7v3p67ae+5Ofn8/HH3/c67EH+rpCiOGRGlshRNpccsklzJkzh4ceeog///nPfT7mo48+4r//+7+H/dyO43DBBRfw4Ycf8vzzz/f5mJ5tpS644AJaWlq4//77ez2uv8zl1Vdfzb/+67/y7LPP8u1vfzutE9KKi4tZsmQJL730UkqQE4/H+c1vfnNQz/3Vr36V1atXc/PNNw+
"text/plain": [
"<Figure size 792x576 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"\n",
"f, ax = plt.subplots(figsize=(11, 8))\n",
"plt.scatter(new_predict/1000,y/1000, alpha=0.5, color='crimson')\n",
"plt.xlabel('Predicted Price (x1000)')\n",
"plt.ylabel('Actual Price (x1000)')\n",
"plt.title('Checking Model Output')\n",
"f.savefig('mod_out.png', backend='Cairo')\n",
"plt.show()\n"
]
},
{
"cell_type": "markdown",
"id": "88e661d4-47dd-4758-8c4c-6dce06e20b86",
"metadata": {},
"source": [
"The model seems to be a little fuzzy working with higher prices. But this is about the shape we're looking for. \"Perfect\" would be a solid straight line"
]
},
{
"cell_type": "markdown",
"id": "f99b8a37-f856-423e-ba19-b79a5526ec8f",
"metadata": {},
"source": [
"Finally, output results to csv for kaggle submission"
]
},
{
"cell_type": "code",
"execution_count": 165,
"id": "59c5e4cc-470c-4503-9c17-0e80aba31f1a",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T09:14:16.616517Z",
"iopub.status.busy": "2022-05-29T09:14:16.616255Z",
"iopub.status.idle": "2022-05-29T09:14:16.639735Z",
"shell.execute_reply": "2022-05-29T09:14:16.638937Z",
"shell.execute_reply.started": "2022-05-29T09:14:16.616491Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 878 entries, 0 to 877\n",
"Data columns (total 2 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 Id 878 non-null int64 \n",
" 1 SalePrice 878 non-null float64\n",
"dtypes: float64(1), int64(1)\n",
"memory usage: 13.8 KB\n"
]
}
],
"source": [
"results = pd.DataFrame(kaggle.pid)\n",
"kpredict = model.predict(X_kaggle)\n",
"results['SalePrice'] = pd.Series(kpredict)\n",
"results.columns = ['Id','SalePrice']\n",
"results.to_csv('data/results.csv',index=False)\n",
"results.info()"
]
},
{
"cell_type": "markdown",
"id": "45fb58be-3c77-455e-8b17-59af514e81ce",
"metadata": {},
"source": [
"### Conclusion"
]
},
{
"cell_type": "markdown",
"id": "f95059af-53da-43be-ae20-fd1633c46b19",
"metadata": {},
"source": [
"This model was designed with a focus on quality and consistency. With some more refinement the margin of error should be able to be reduced\n",
"to a reasonable number and reliable, accurate predictions can be made for any application where there is a need to assess the value of a property.<br>\n",
"I think a big limiting factor here is the size of the data set compared to quality of the features provided. There are more features from this data set\n",
"that can be added but I think the biggest gains will be had from simply feeding in more data for the chosen features. The new added features will also\n",
"scale with more data. As you stray from the \"low hanging fruit\" features the quality of your data starts to go down: "
]
},
{
"cell_type": "code",
"execution_count": 166,
"id": "a082eb49-6b3f-4d1a-8132-110998919ec9",
"metadata": {
"execution": {
"iopub.execute_input": "2022-05-29T09:14:16.640736Z",
"iopub.status.busy": "2022-05-29T09:14:16.640476Z",
"iopub.status.idle": "2022-05-29T09:14:17.552167Z",
"shell.execute_reply": "2022-05-29T09:14:17.551321Z",
"shell.execute_reply.started": "2022-05-29T09:14:16.640718Z"
},
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgQAAAHfCAYAAAAvE8DnAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAACWGUlEQVR4nOzdeXxU1f34/9e5d2ayLywBlE1KgIqIqFVAET6yWOtasRWtWxGrXWi1Vltbq10+/vqxdW2hFG1rrVK3WkVxwwW/WGVxRVHUsLjgwpplkkySmbn3/P64M5OZrDeQmTtJ3s/HIyRz53DnZJLMvO857/M+SmutEUIIIUSfZnjdASGEEEJ4TwICIYQQQkhAIIQQ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iGEEEIgAYEQQgghkIBACCGEEEhAIIQQQggkIBBCCCEEUrpYCLEPdF2I6LoN6OogqrQY35RJqMJ8r7slhNgPEhAIIVzTWhO+/wkiyx5DWzZEo+AzUaaJ/7zTCJx9Mkopr7sphNgHEhAIIVwL3/8E4X88DAV5KJ+ZOK6jlnMcyDnnFK+6J4TYD5JDIIRwRdeFiCx7rFUwADi3C/KckYP6kEc9FGI/hMPYuyu97oWnJCAQQrgSXbcBbVmtgoE45TPRlkV07YbMdkyIbqCbwoTvedTrbnjK84Bg/fr1XHTRRXzlK1/hsMMO46STTuKBBx5IafPyyy9z1llnMXHiRKZOncp1111HMBhsda76+nquv/56pk2bxsSJE5k7dy7PP/98m4/r5TmF6Il0dRCiVseNopbTTogeyFdX73UXPOVpQPDII48wf/5
"text/plain": [
"<Figure size 504x504 with 3 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"discover_plot(train.overall_cond,y);"
]
},
{
"cell_type": "markdown",
"id": "ab113dc6-42df-466a-a869-dde532b80be2",
"metadata": {},
"source": [
"In the case of overall condition of property, everyone wants to say their house is of highest condition and most houses sold are sold for less money than the mean of all sales prices. So this will drive the score down and skew predictions"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}