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

1168 lines
563 KiB

2 years ago
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"___\n",
"\n",
"<a href='http://www.pieriandata.com'><img src='../Pierian_Data_Logo.png'/></a>\n",
"___\n",
"<center><em>Copyright by Pierian Data Inc.</em></center>\n",
"<center><em>For more information, visit us at <a href='http://www.pieriandata.com'>www.pieriandata.com</a></em></center>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# DBSCAN Project \n",
"\n",
"## The Data\n",
"\n",
"\n",
"Source: https://archive.ics.uci.edu/ml/datasets/Wholesale+customers\n",
"\n",
"Margarida G. M. S. Cardoso, margarida.cardoso '@' iscte.pt, ISCTE-IUL, Lisbon, Portugal\n",
"\n",
"\n",
"Data Set Information:\n",
"\n",
"Provide all relevant information about your data set.\n",
"\n",
"\n",
"Attribute Information:\n",
"\n",
" 1) FRESH: annual spending (m.u.) on fresh products (Continuous);\n",
" 2) MILK: annual spending (m.u.) on milk products (Continuous);\n",
" 3) GROCERY: annual spending (m.u.)on grocery products (Continuous);\n",
" 4) FROZEN: annual spending (m.u.)on frozen products (Continuous)\n",
" 5) DETERGENTS_PAPER: annual spending (m.u.) on detergents and paper products (Continuous)\n",
" 6) DELICATESSEN: annual spending (m.u.)on and delicatessen products (Continuous);\n",
" 7) CHANNEL: customers Channel - Horeca (Hotel/Restaurant/Café) or Retail channel (Nominal)\n",
" 8) REGION: customers Region Lisnon, Oporto or Other (Nominal)\n",
" \n",
"\n",
"Relevant Papers:\n",
"\n",
"Cardoso, Margarida G.M.S. (2013). Logical discriminant models – Chapter 8 in Quantitative Modeling in Marketing and Management Edited by Luiz Moutinho and Kun-Huang Huarng. World Scientific. p. 223-253. ISBN 978-9814407717\n",
"\n",
"Jean-Patrick Baudry, Margarida Cardoso, Gilles Celeux, Maria José Amorim, Ana Sousa Ferreira (2012). Enhancing the selection of a model-based clustering with external qualitative variables. RESEARCH REPORT N° 8124, October 2012, Project-Team SELECT. INRIA Saclay - Île-de-France, Projet select, Université Paris-Sud 11\n",
"\n",
"\n",
"\n",
"-----"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## DBSCAN and Clustering Examples\n",
"\n",
"**COMPLETE THE TASKS IN BOLD BELOW:**\n",
"\n",
"**TASK: Run the following cells to import the data and view the DataFrame.**"
]
},
{
"cell_type": "code",
"execution_count": 61,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import seaborn as sns"
]
},
{
"cell_type": "code",
"execution_count": 62,
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv('../DATA/wholesome_customers_data.csv')"
]
},
{
"cell_type": "code",
"execution_count": 78,
"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>Channel</th>\n",
" <th>Region</th>\n",
" <th>Fresh</th>\n",
" <th>Milk</th>\n",
" <th>Grocery</th>\n",
" <th>Frozen</th>\n",
" <th>Detergents_Paper</th>\n",
" <th>Delicassen</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>12669</td>\n",
" <td>9656</td>\n",
" <td>7561</td>\n",
" <td>214</td>\n",
" <td>2674</td>\n",
" <td>1338</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>7057</td>\n",
" <td>9810</td>\n",
" <td>9568</td>\n",
" <td>1762</td>\n",
" <td>3293</td>\n",
" <td>1776</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>6353</td>\n",
" <td>8808</td>\n",
" <td>7684</td>\n",
" <td>2405</td>\n",
" <td>3516</td>\n",
" <td>7844</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>1</td>\n",
" <td>3</td>\n",
" <td>13265</td>\n",
" <td>1196</td>\n",
" <td>4221</td>\n",
" <td>6404</td>\n",
" <td>507</td>\n",
" <td>1788</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>22615</td>\n",
" <td>5410</td>\n",
" <td>7198</td>\n",
" <td>3915</td>\n",
" <td>1777</td>\n",
" <td>5185</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Channel Region Fresh Milk Grocery Frozen Detergents_Paper Delicassen\n",
"0 2 3 12669 9656 7561 214 2674 1338\n",
"1 2 3 7057 9810 9568 1762 3293 1776\n",
"2 2 3 6353 8808 7684 2405 3516 7844\n",
"3 1 3 13265 1196 4221 6404 507 1788\n",
"4 2 3 22615 5410 7198 3915 1777 5185"
]
},
"execution_count": 78,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": 79,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 440 entries, 0 to 439\n",
"Data columns (total 8 columns):\n",
" # Column Non-Null Count Dtype\n",
"--- ------ -------------- -----\n",
" 0 Channel 440 non-null int64\n",
" 1 Region 440 non-null int64\n",
" 2 Fresh 440 non-null int64\n",
" 3 Milk 440 non-null int64\n",
" 4 Grocery 440 non-null int64\n",
" 5 Frozen 440 non-null int64\n",
" 6 Detergents_Paper 440 non-null int64\n",
" 7 Delicassen 440 non-null int64\n",
"dtypes: int64(8)\n",
"memory usage: 27.6 KB\n"
]
}
],
"source": [
"df.info()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## EDA\n",
"\n",
"**TASK: Create a scatterplot showing the relation between MILK and GROCERY spending, colored by Channel column.**"
]
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {},
"outputs": [],
"source": [
"#CODE HERE"
]
},
{
"cell_type": "code",
"execution_count": 68,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot:xlabel='Milk', ylabel='Grocery'>"
]
},
"execution_count": 68,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZEAAAEGCAYAAACkQqisAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAABJ3klEQVR4nO3dd3hUVfrA8e+ZmjbpvZEQOohIU6xYULF3UVdxVfztiru66lpWXeu6ir0rit0V17a6duxlUWlKL6GEJKQnpE8/vz/mMiQkQBJSJvB+nmeezJy598w7JMw791SltUYIIYToClNfByCEEKL/kiQihBCiyySJCCGE6DJJIkIIIbpMkogQQogus/R1AL0tMTFR5+Tk9HUYQgjRbyxatKhSa53U3nP7XBLJyclh4cKFfR2GEEL0G0qpgp09J81ZQgghukySiBBCiC6TJCKEEKLL9rk+ESGE6Ckej4eioiKcTmdfh9IlYWFhZGZmYrVaO3yOJBEhhOgmRUVFOBwOcnJyUEr1dTidorWmqqqKoqIicnNzO3yeJBEhxE5tzC9g9cp8/H4/w0YOJm9wTl+HFNKcTme/TCAASikSEhKoqKjo1HmSRIQQ7VqzMp9Lp11NXW09AI7oKJ5/42GGjxrSx5GFtv6YQLbpSuzSsS6EaNen//0qmEAA6usaeP/tT/swIhGKJIkIIdq1cf3mNmUb1u10zpnYhdLSUqZNm0ZeXh7jxo3jhBNOYPbs2Zx00kl9FtPkyZO7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9C9JbGhibuu/1xvv3yfwCsXLaGb+b
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**TASK: Use seaborn to create a histogram of MILK spending, colored by Channel. Can you figure out how to use seaborn to \"stack\" the channels, instead of have them overlap?**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#CODE HERE"
]
},
{
"cell_type": "code",
"execution_count": 73,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot:xlabel='Milk', ylabel='Count'>"
]
},
"execution_count": 73,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEGCAYAAACKB4k+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAZEUlEQVR4nO3deZRedZ3n8ffXLERMQkiIGFNAIm4kKJiULIKcAM2IaVxYmgkHMEKU47A0DjPdwjgOQW2PMmonIio5IuDSLE3rEBmnVTD0OHR3MKxZ2CImUhHIIhjCnu7v/PHcXCqpqtRTT56tqPfrnOfUvb97n3u/xVPh89z7u/d3IzORJAngda0uQJLUPgwFSVLJUJAklQwFSVLJUJAklYa3uoBdsddee+WUKVNaXYYkDSp33333xsyc2NuyQR0KU6ZMYdmyZa0uQ5IGlYhY29cyTx9JkkqGgiSpZChIkkqDuk9BkhrplVdeoaurixdffLHVpdRk1KhRdHR0MGLEiKrfYyhIUh+6uroYM2YMU6ZMISJaXc6AZCabNm2iq6uLqVOnVv0+Tx9JUh9efPFFJkyYMOgCASAimDBhwoCPcgwFSdqJwRgI29RSu6EgSSoZCpI0AE8++SRz5sxh//33Z+bMmcyePZtFixZxwgkntKymWbNm1e1G3iHb0XzBeeeyZfPmHu2jx47liiu/1YKKJLW7zOTEE09k7ty53HDDDQDcf//9LF68uMWV1c+QDYUtmzezcP7nerRfOP8LLahG0mCwZMkSRowYwac+9amy7aCDDuLpp5/m9ttv55RTTmHFihXMnDmTH/7wh0QEn//85/npT3/KCy+8wPve9z6uuuoqIoJZs2Zx6KGHsmTJEp555hmuvvpq3v/+93PttdeyePFinn/+eX77299y4okncvnllwPwi1/8gksvvZSXXnqJ/fffn2uuuYbRo0fX9Xf09JEkVWnb//B7c++997JgwQJWrVrFY489xp133gnA+eefz29+8xtWrFjBCy+8wK233lq+Z+vWrdx1110sWLCAyy67rGy/7777uPHGG1m+fDk33ngjjz/+OBs3buSLX/wit912G/fccw+dnZ18/etfr/vvOGSPFCSpng455BA6OjoAOPjgg1mzZg1HHnkkS5Ys4fLLL+f555/nj3/8I9OnT+dDH/oQACeddBIAM2fOZM2aNeW2jj32WPbYYw8Apk2bxtq1a3nmmWdYtWoVRxxxBAAvv/wyhx9+eN1/D0NBkqo0ffp0br755l6X7bbbbuX0sGHD2Lp1Ky+++CLnnnsuy5YtY5999mH+/Pnb3Tew7T3b1t/ZtjKT4447juuvv77ev9Z2PH0kSVU65phjeOmll1i0aFHZ9sADD/DrX/+61/W3BcBee+3Fli1b+gyUahx22GHceeedrF69GoDnnnuORx55pObt9cVQkKQqRQQ/+clPuO2229h///2ZPn06l1xyCW9605t6XX/cuHF88pOf5MADD+QDH/gA733ve2ve98SJE7n22ms57bTTePe7383hhx/OQw89VPP2+hKZWfeNNktnZ2fWem3uWWee0efVR9f84Ie7Wpqk14AHH3yQAw44oNVl7JLefoeIuDszO3tb3yMFSVLJUJAklQwFSVLJUJAklQwFSVLJUJAklRoWChHxvYhYHxErurWNj4hfRsSjxc89i/aIiG9ExOqIeCAiZjSqLkmqhyn77UdE1O01Zb/9+t3n2WefzRvf+EYOPPDAhv1ejRzm4lrgm8D3u7VdDNyemV+OiIuL+c8AHwTeVrwOBb5d/JSktrT297/nT6vrd/PYHm99Z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dpkdR+XZ/D1BTKGTmfUBnL4uOrWV7kqT6qPb00QXd54ubz25oREGSpNapdejs56hcWipJeg2ptk/hp7x6iegw4AD
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**TASK: Create an annotated clustermap of the correlations between spending on different cateogires.**"
]
},
{
"cell_type": "code",
"execution_count": 85,
"metadata": {},
"outputs": [],
"source": [
"# CODE HERE"
]
},
{
"cell_type": "code",
"execution_count": 86,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Correlation Between Spending Categories\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAsgAAALJCAYAAACp99XTAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAABtYklEQVR4nO3dd5hU5d3G8e9vlypN6UVUFNRYQVeMHQt2o7FHjZpgiS2JLSoaxd5NMZaYYkli1ERfWzT2Fguwir2h2JAmvUjdfd4/doCzFGVV9sws38917eWcc57Zvc+4y977zDNnIqWEJEmSpBpleQeQJEmSiokFWZIkScqwIEuSJEkZFmRJkiQpw4IsSZIkZViQJUmSpIwGXZAj4q8RMS4i3lzK8YiI30fEBxHxekRsUt8ZJUmSVFwadEEGbgF2/YrjuwG9Ch/HADfUQyZJkiQVsQZdkFNKzwITv2LI3sBtqcZLwMoR0aV+0kmSJKkYNeiCvAy6AZ9ltkcW9kmSJGkF1agug+eOH1FU70vdpMNax1KzNGK+m1JKN+WVR5IkSaWvTgWZ6qrlFOObKZThb1OIPwe6Z7ZXLeyTJEnSCqpuBblq3nKKkZv7gRMj4g5gc2BKSml0zpm0AquoqDgTaJZ3Dknf2KzKysrL8g4h6dupU0FOJVaQI+KfQD+gfUSMBM4DGgO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o1uYO/+LlWNqxQuF9H9iRmiI8FDgkpfRWZswJwIYppZ8VXqS3b0rpwOUcu6jMHT+iqP6flpq5t1ySd4SSVj1qXN4RStortzfNO0LJu7rJzLwjlLRmUad5Ni3BnZ/cu9Quo/yU9AzyVymsKT4ReISay7z9NaX0VkRcAFSmlO4H/gL
"text/plain": [
"<Figure size 720x720 with 4 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**TASK: Create a PairPlot of the dataframe, colored by Region.**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#CODE HERE"
]
},
{
"cell_type": "code",
"execution_count": 75,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<seaborn.axisgrid.PairGrid at 0x2d711759c40>"
]
},
"execution_count": 75,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABQ0AAATXCAYAAABEVlNkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdd3hcV53/8feZ3tW75F7iGsdxekhCEpIQSuidhBqWGsqy9M3S+W0BFlhKWAKE3kMgEAgsECANp9pOHBfJlmWra9Sml/P7Q7JiRXKTJc1I+ryeZx5b59577veOjmbufOcUY61FRERERERERERE5DBHoQMQERERERERERGR4qKkoYiIiIiIiIiIiIyjpKGIiIiIiIiIiIiMo6ShiIiIiIiIiIiIjKOkoYiIiIiIiIiIiIyjpKGIiIiIiIiIiIiMo6ThqKuuusoCeugxE49poTaqxww+poXaqB4z+JgWaqN6zOBjWqiN6jGDj2mhNqrHDD6mhdqoHjP4WJCUNBzV09NT6BBEjkltVIqd2qgUO7VRKXZqo1Ls1Eal2KmNikwvJQ1FRERERERERERknDmXND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wW4PrSzZwdOId72v82ljAE6E9FebzvMSr9IzcY6ys3jCUM/S4/2XxmLGEIkMgmeLj7IQ4NH2JN+dqRePp3sTu6azqfEikiB6K9/Kbt+2TzWeqC9WMJQxj5lvtXzbeRyCXYUnsWt+29FYsdS0oAdCe6GU4PEfaM9Kjb0buD+lA9F9RfwM93/3QsYQiwrW8bhy5aQ/4/v8RQRx//87t9YwlDgPv2DdK6+Wn
"text/plain": [
"<Figure size 1302.38x1260 with 56 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## DBSCAN\n",
"\n",
"**TASK: Since the values of the features are in different orders of magnitude, let's scale the data. Use StandardScaler to scale the data.**"
]
},
{
"cell_type": "code",
"execution_count": 87,
"metadata": {},
"outputs": [],
"source": [
"#CODE HERE"
]
},
{
"cell_type": "code",
"execution_count": 89,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 90,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 1.44865163, 0.59066829, 0.05293319, ..., -0.58936716,\n",
" -0.04356873, -0.06633906],\n",
" [ 1.44865163, 0.59066829, -0.39130197, ..., -0.27013618,\n",
" 0.08640684, 0.08915105],\n",
" [ 1.44865163, 0.59066829, -0.44702926, ..., -0.13753572,\n",
" 0.13323164, 2.24329255],\n",
" ...,\n",
" [ 1.44865163, 0.59066829, 0.20032554, ..., -0.54337975,\n",
" 2.51121768, 0.12145607],\n",
" [-0.69029709, 0.59066829, -0.13538389, ..., -0.41944059,\n",
" -0.56977032, 0.21304614],\n",
" [-0.69029709, 0.59066829, -0.72930698, ..., -0.62009417,\n",
" -0.50488752, -0.52286938]])"
]
},
"execution_count": 90,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**TASK: Use DBSCAN and a for loop to create a variety of models testing different epsilon values. Set min_samples equal to 2 times the number of features. During the loop, keep track of and log the percentage of points that are outliers. For reference the solutions notebooks uses the following range of epsilon values for testing:**\n",
"\n",
" np.linspace(0.001,3,50)"
]
},
{
"cell_type": "code",
"execution_count": 95,
"metadata": {},
"outputs": [],
"source": [
"#CODE HERE"
]
},
{
"cell_type": "code",
"execution_count": 96,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 97,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**TASK: Create a line plot of the percentage of outlier points versus the epsilon value choice.**"
]
},
{
"cell_type": "code",
"execution_count": 98,
"metadata": {},
"outputs": [],
"source": [
"#CODE HERE"
]
},
{
"cell_type": "code",
"execution_count": 99,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Text(0.5, 0, 'Epsilon Value')"
]
},
"execution_count": 99,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEGCAYAAACKB4k+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAs7klEQVR4nO3deXxU5b3H8c8vOyQhBJKwRyIgCMou7nWhrihWS622rrW1tr2lrXaxra21t3bR2l6XW5VWq7WtV6vWBa0bgmulsiubIIuACEGBsJPld/+YkxgxmRySTE4y832/Xuc1M2dmcr7HwfnNeZ5znsfcHREREYC0qAOIiEj7oaIgIiJ1VBRERKSOioKIiNRRURARkToZUQdoiaKiIu/fv3/UMUREOpTZs2dvcvfihp7r0EWhf//+zJo1K+oYIiIdipmtbuw5NR+JiEgdFQUREamjoiAiInVUFEREpE6TRcHMPmdm+cH9a8zsETMbnfhoIiLS1sIcKfzE3beZ2THAp4G7gNubepOZ3W1mG83srXrrupnZc2a2LLgtDNabmd1iZsvNbIGKjohINMIUhergdgIwxd2fBLJCvO8e4NR91l0NTH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sUSkA4l3pJAfLGOBrxEboK4PcAUwOvHRpDlOO7QXf/nSON7bspsL75qpIwYR2S+NFgV3v87dryM2DtFod7/K3a8CxgCaMLgdO+LA7vzxorGs2LSDi+7+DxW7K5t+k4gI4foUegD1f27uDdZJO3bMoCLuuGA0S96v4NI/v8GOPVVNv0lEUl6YovAX4D9m9jMz+xkwk9gkONLOnTikB7ecN4q5727my/fOYnelZm0Tkfj
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## DBSCAN with Chosen Epsilon\n",
"\n",
"**TASK: Based on the plot created in the previous task, retrain a DBSCAN model with a reasonable epsilon value. Note: For reference, the solutions use eps=2.**"
]
},
{
"cell_type": "code",
"execution_count": 102,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"DBSCAN(eps=2)"
]
},
"execution_count": 102,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**TASK: Create a scatterplot of Milk vs Grocery, colored by the discovered labels of the DBSCAN model.**"
]
},
{
"cell_type": "code",
"execution_count": 127,
"metadata": {},
"outputs": [],
"source": [
"#CODE HERE"
]
},
{
"cell_type": "code",
"execution_count": 128,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot:xlabel='Grocery', ylabel='Milk'>"
]
},
"execution_count": 128,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZEAAAEGCAYAAACkQqisAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAABNgUlEQVR4nO3dd3gc1fXw8e/ZolXvvdiSbLnbuOEGGDDFYAiGhFBScOgJ/RcSShoh5E1ITyCEhAQSS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2P6YWEGdbzRIKLUEOTsodoqLCkVsWubiDoy2iai1BDkCI8gKnc0bVUV+P1eQhOScUREDnSx1CCkQUSpIUhEcEZG4YyMGnQzzapji1ZnKTXEaQBRR0ODiFJKqV7TIKKUUqrXNIgopZTqtaAGERHZJSLrRGS1iORbafEiskREtll/46x0EZEHRKRARNaKyNRO51lk5d8mIos6pU+zzl9gHauVu0op1Y/6407kdGPMZGNM+1rrdwHvGWPygPesbYBzgTzrcR3wMASCDnAPMBOYAdzTHnisPNd2Ou6c4L8cpZRS7QaiOmsh8Lj1/HHgwk7pT5iAZUCsiKQB84ElxphqY0wNsAQ4x9oXbYxZZgKLGD/R6VxKKaX6QbCDiAHeEZGVInKdlZZijCmxnpcCKdbzDGBPp2OLrLSDpRf1kN6NiFwnIvkikj+Y1jtWSqljXbAHG55sjCkWkWRgiYhs7rzTGGNEJOiz9RhjHgEeAZg+fbrODqSUUn0kqHcixphi62858BKBNo0yqyoK62+5lb0YyOp0eKaVdrD0zB7SlVJK9ZOgBRE
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**TASK: Create a scatterplot of Milk vs. Detergents Paper colored by the labels.**"
]
},
{
"cell_type": "code",
"execution_count": 133,
"metadata": {},
"outputs": [],
"source": [
"#CODE HERE"
]
},
{
"cell_type": "code",
"execution_count": 134,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot:xlabel='Detergents_Paper', ylabel='Milk'>"
]
},
"execution_count": 134,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZEAAAEHCAYAAABvHnsJAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAABROElEQV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psQxqZNEkotQJxNvYQN2enWCNXWiSQiLHTMAZHjHMkaljlVZnKXUCaa4obU8gABhDS3Vlzwco1QdNIkqdIIwx+L3eruW+rmVK9ZcmEaVOECJCSHxil3JXbPwwRKOOF9omotQJxBEeSXjWGDylRSBCaFIqzjBtD1EDp0lEqROIzeHAHROHMzI68NxuH+aI1LFOk4hSJyBNHmqwaJuIUkqpAdMkopRSasA0iSillBqwoCYREdknIptFZIOIrLXK4kRklYjkWt9jrXIRkTtFJE9ENonIrA7nWW7tnysiyzuUz7bOn2cdq3M3KKXUEBqKO5EzjTEzjTFta63fCLxhjMkB3rCeA5wH5FhfK4C/QiDpADcB84CTgZvaEo+1z9c7HLc0+C9HKaVUm+GozloGPGw9fhi4uEP5IyZgNRAjIqnAucAqY0ylMaYKWAUstbZFGWNWm8Aixo90OJdSSqkhEOwkYoDXRGSdiKywypKNMUXW42Ig2XqcDhzscGy+VdZbeX435UoppYZIsMeJLDTGFIhIErBKRHZ03GiMMSJiejh20FgJbAVAVlZWsC+nlFInjKDeiRhjCqzvpcCzBNo0SqyqKKzvpdbuBUBmh8MzrLLeyjO6Ke8ujvu
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**TASK: Create a new column on the original dataframe called \"Labels\" consisting of the DBSCAN labels.**"
]
},
{
"cell_type": "code",
"execution_count": 106,
"metadata": {},
"outputs": [],
"source": [
"#CODE HERE"
]
},
{
"cell_type": "code",
"execution_count": 107,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 108,
"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>Channel</th>\n",
" <th>Region</th>\n",
" <th>Fresh</th>\n",
" <th>Milk</th>\n",
" <th>Grocery</th>\n",
" <th>Frozen</th>\n",
" <th>Detergents_Paper</th>\n",
" <th>Delicassen</th>\n",
" <th>Labels</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>12669</td>\n",
" <td>9656</td>\n",
" <td>7561</td>\n",
" <td>214</td>\n",
" <td>2674</td>\n",
" <td>1338</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>7057</td>\n",
" <td>9810</td>\n",
" <td>9568</td>\n",
" <td>1762</td>\n",
" <td>3293</td>\n",
" <td>1776</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>6353</td>\n",
" <td>8808</td>\n",
" <td>7684</td>\n",
" <td>2405</td>\n",
" <td>3516</td>\n",
" <td>7844</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>1</td>\n",
" <td>3</td>\n",
" <td>13265</td>\n",
" <td>1196</td>\n",
" <td>4221</td>\n",
" <td>6404</td>\n",
" <td>507</td>\n",
" <td>1788</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>22615</td>\n",
" <td>5410</td>\n",
" <td>7198</td>\n",
" <td>3915</td>\n",
" <td>1777</td>\n",
" <td>5185</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Channel Region Fresh Milk Grocery Frozen Detergents_Paper \\\n",
"0 2 3 12669 9656 7561 214 2674 \n",
"1 2 3 7057 9810 9568 1762 3293 \n",
"2 2 3 6353 8808 7684 2405 3516 \n",
"3 1 3 13265 1196 4221 6404 507 \n",
"4 2 3 22615 5410 7198 3915 1777 \n",
"\n",
" Delicassen Labels \n",
"0 1338 0 \n",
"1 1776 0 \n",
"2 7844 0 \n",
"3 1788 1 \n",
"4 5185 0 "
]
},
"execution_count": 108,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**TASK: Compare the statistical mean of the clusters and outliers for the spending amounts on the categories.**"
]
},
{
"cell_type": "code",
"execution_count": 109,
"metadata": {},
"outputs": [],
"source": [
"# CODE HERE"
]
},
{
"cell_type": "code",
"execution_count": 114,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 115,
"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>Fresh</th>\n",
" <th>Milk</th>\n",
" <th>Grocery</th>\n",
" <th>Frozen</th>\n",
" <th>Detergents_Paper</th>\n",
" <th>Delicassen</th>\n",
" </tr>\n",
" <tr>\n",
" <th>Labels</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>-1</th>\n",
" <td>30161.529412</td>\n",
" <td>26872.411765</td>\n",
" <td>33575.823529</td>\n",
" <td>12380.235294</td>\n",
" <td>14612.294118</td>\n",
" <td>8185.411765</td>\n",
" </tr>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>8200.681818</td>\n",
" <td>8849.446970</td>\n",
" <td>13919.113636</td>\n",
" <td>1527.174242</td>\n",
" <td>6037.280303</td>\n",
" <td>1548.310606</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>12662.869416</td>\n",
" <td>3180.065292</td>\n",
" <td>3747.250859</td>\n",
" <td>3228.862543</td>\n",
" <td>764.697595</td>\n",
" <td>1125.134021</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Fresh Milk Grocery Frozen \\\n",
"Labels \n",
"-1 30161.529412 26872.411765 33575.823529 12380.235294 \n",
" 0 8200.681818 8849.446970 13919.113636 1527.174242 \n",
" 1 12662.869416 3180.065292 3747.250859 3228.862543 \n",
"\n",
" Detergents_Paper Delicassen \n",
"Labels \n",
"-1 14612.294118 8185.411765 \n",
" 0 6037.280303 1548.310606 \n",
" 1 764.697595 1125.134021 "
]
},
"execution_count": 115,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**TASK: Normalize the dataframe from the previous task using MinMaxScaler so the spending means go from 0-1 and create a heatmap of the values.**"
]
},
{
"cell_type": "code",
"execution_count": 119,
"metadata": {},
"outputs": [],
"source": [
"#CODE HERE"
]
},
{
"cell_type": "code",
"execution_count": 120,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 121,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 122,
"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>Fresh</th>\n",
" <th>Milk</th>\n",
" <th>Grocery</th>\n",
" <th>Frozen</th>\n",
" <th>Detergents_Paper</th>\n",
" <th>Delicassen</th>\n",
" </tr>\n",
" <tr>\n",
" <th>Labels</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>-1</th>\n",
" <td>1.000000</td>\n",
" <td>1.000000</td>\n",
" <td>1.000000</td>\n",
" <td>1.000000</td>\n",
" <td>1.000000</td>\n",
" <td>1.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0.000000</td>\n",
" <td>0.239292</td>\n",
" <td>0.341011</td>\n",
" <td>0.000000</td>\n",
" <td>0.380758</td>\n",
" <td>0.059938</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>0.203188</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.156793</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Fresh Milk Grocery Frozen Detergents_Paper Delicassen\n",
"Labels \n",
"-1 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000\n",
" 0 0.000000 0.239292 0.341011 0.000000 0.380758 0.059938\n",
" 1 0.203188 0.000000 0.000000 0.156793 0.000000 0.000000"
]
},
"execution_count": 122,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "code",
"execution_count": 123,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot:ylabel='Labels'>"
]
},
"execution_count": 123,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAWsAAAFLCAYAAAAQ6q1OAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcn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ImYNo76PJvRbujcxbfwmSXsDvwc2GU5IERGjV3o1yISPStoYeDfwOWAjqlmKERGzwljL+6z7Xcjp1PrLO4HnAUh655BiiogYuZbv6tV3n/VUDuv9koiIMoyjvo8mzGTVvcla/nsoIqJ/s2Uhp6m0/e8WEdG3ogcYJd3N1ElZVGtbR0TMCuNqd2dBr+nm2RQ3IuaEtq/d3O6tESIiRmRc/R+9SNpT0jWSVnTbd1bSKyVZ0k69nrkmfdYREbPGoKo8JM0HjgX2AG4AlklaYvuqSa/bEHgHcGE/z03LOiKCanCu36OHnYEVtq+1vRI4iWoPgMk+Anwc+M9+4kuyjohgZt0gkhZJWt5xLOp41BY8sPcsVK3rLTrfS9KOwJa2T+s3vnSDREQws9I924uBxavzPpLmAccAb5rJ9yVZR0QAY4Or3LsR2LLjfEF9bcKGwFOAs1WVCz4aWCJpH9vLp3toknVEBAOdFLMMWChpa6ok/Tpg/4mbtu8ENp04l3Q28J5uiRrSZx0RAQxu8wHbq4BDgTOAq4GTbV8p6WhJ+6xufGlZR0QAg9yC0fZSYOmka0dM89rd+3lmknVEBIWvDRIRMVe0fbp5knVEBO3ffCDJOiKCdINERBQhyToiogBt300lyToigvRZR0QUIdUgq2nvR+/QdAgzcuJNfS1JG2to1822azqEGTnk5rOaDiH6NN7yjpDWJuuIiFHKAGNERAH
"text/plain": [
"<Figure size 432x288 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**TASK: Create another heatmap similar to the one above, but with the outliers removed**"
]
},
{
"cell_type": "code",
"execution_count": 125,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<AxesSubplot:ylabel='Labels'>"
]
},
"execution_count": 125,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAFHCAYAAAC8k8cXAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlc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5Pqta6HH8i66ZOpmbp4ibubHunHn0Ipx59COMnTeM39zzJdV87kRv/8RhnDjmcbl06Zx1eu3HaF07gtC+cwH0TH+Xm39/BD6/8NtNmzKS8rIxH/vEnVqx8n7PO+zaHH3wgA/rtmHW49SovL2e/Qz7CyOPPZ83qtfz8rp8yc9qrPPfUC20eS+S4aqW1EnkNyTwBb9Y5vmN6rl6Fnew7de7Xot9fFsxfxID+fTfs9++3IwsWLGrJRzRbzdIllPXsvWG/bPteVC9d8qHrKvY/iK4n/wcrLv8GVCV/GzvttS+d9v0oXY4fgbp2hU4VxJrVrLpts8YoNKr3NluxaNnyDfvvvLuCHbZtuLQ39NCP8IM/Ju090+bM56GpL/PzPz/EylVrUJnoXNGJ045ucvRxqyrFz0XvXj1Z9M7GP9Bvv7OE3r22b/D64z57JNf+9H8BGP/gY3zy8IOp6NSJ7bfdhgM+ug/TX3mtVRP54kVL6F1QXdZrx14sWVT7c7xk0RJ69+3N4oVLKC8vo3uP7ix/dwWLFy7hX5OnsfzdZMT6pEcms8dHBmWSyEuxyqRYrVVHfjHwsKT7JY1JtweAh4EGW2tb05SpL7L77gPZZZcBVFRUcPLJI7jn3olZhLJB1WuvUN63P2U79IFOndji05+h8tmna11Tvusgul/wLVZeezmx/L0Nx9//2XW899W
"text/plain": [
"<Figure size 432x288 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**TASK: What spending category were the two clusters mode different in?**"
]
},
{
"cell_type": "code",
"execution_count": 126,
"metadata": {},
"outputs": [],
"source": [
"#CODE HERE"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 1
}