mirror of
https://github.com/gsi-upm/sitc
synced 2024-11-18 04:22:28 +00:00
501 lines
695 KiB
Plaintext
501 lines
695 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {
|
||
|
"slideshow": {
|
||
|
"slide_type": "skip"
|
||
|
}
|
||
|
},
|
||
|
"source": [
|
||
|
"![](images/EscUpmPolit_p.gif \"UPM\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {
|
||
|
"slideshow": {
|
||
|
"slide_type": "skip"
|
||
|
}
|
||
|
},
|
||
|
"source": [
|
||
|
"# Course Notes for Learning Intelligent Systems"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {
|
||
|
"slideshow": {
|
||
|
"slide_type": "skip"
|
||
|
}
|
||
|
},
|
||
|
"source": [
|
||
|
"Department of Telematic Engineering Systems, Universidad Politécnica de Madrid, © Carlos A. Iglesias"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {
|
||
|
"slideshow": {
|
||
|
"slide_type": "skip"
|
||
|
}
|
||
|
},
|
||
|
"source": [
|
||
|
"## [Introduction to Visualization](00_Intro_Visualization.ipynb)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {
|
||
|
"slideshow": {
|
||
|
"slide_type": "subslide"
|
||
|
}
|
||
|
},
|
||
|
"source": [
|
||
|
"# Relational charts\n",
|
||
|
"Charts for showing correlations.\n",
|
||
|
"\n",
|
||
|
"We have already seen correlation charts in the distribution charts (**lmplot**)."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {
|
||
|
"slideshow": {
|
||
|
"slide_type": "subslide"
|
||
|
}
|
||
|
},
|
||
|
"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>year</th>\n",
|
||
|
" <th>month</th>\n",
|
||
|
" <th>passengers</th>\n",
|
||
|
" </tr>\n",
|
||
|
" </thead>\n",
|
||
|
" <tbody>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>0</th>\n",
|
||
|
" <td>1949</td>\n",
|
||
|
" <td>Jan</td>\n",
|
||
|
" <td>112</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>1</th>\n",
|
||
|
" <td>1949</td>\n",
|
||
|
" <td>Feb</td>\n",
|
||
|
" <td>118</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>2</th>\n",
|
||
|
" <td>1949</td>\n",
|
||
|
" <td>Mar</td>\n",
|
||
|
" <td>132</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>3</th>\n",
|
||
|
" <td>1949</td>\n",
|
||
|
" <td>Apr</td>\n",
|
||
|
" <td>129</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>4</th>\n",
|
||
|
" <td>1949</td>\n",
|
||
|
" <td>May</td>\n",
|
||
|
" <td>121</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>5</th>\n",
|
||
|
" <td>1949</td>\n",
|
||
|
" <td>Jun</td>\n",
|
||
|
" <td>135</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>6</th>\n",
|
||
|
" <td>1949</td>\n",
|
||
|
" <td>Jul</td>\n",
|
||
|
" <td>148</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>7</th>\n",
|
||
|
" <td>1949</td>\n",
|
||
|
" <td>Aug</td>\n",
|
||
|
" <td>148</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>8</th>\n",
|
||
|
" <td>1949</td>\n",
|
||
|
" <td>Sep</td>\n",
|
||
|
" <td>136</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>9</th>\n",
|
||
|
" <td>1949</td>\n",
|
||
|
" <td>Oct</td>\n",
|
||
|
" <td>119</td>\n",
|
||
|
" </tr>\n",
|
||
|
" </tbody>\n",
|
||
|
"</table>\n",
|
||
|
"</div>"
|
||
|
],
|
||
|
"text/plain": [
|
||
|
" year month passengers\n",
|
||
|
"0 1949 Jan 112\n",
|
||
|
"1 1949 Feb 118\n",
|
||
|
"2 1949 Mar 132\n",
|
||
|
"3 1949 Apr 129\n",
|
||
|
"4 1949 May 121\n",
|
||
|
"5 1949 Jun 135\n",
|
||
|
"6 1949 Jul 148\n",
|
||
|
"7 1949 Aug 148\n",
|
||
|
"8 1949 Sep 136\n",
|
||
|
"9 1949 Oct 119"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import pandas as pd\n",
|
||
|
"from matplotlib import pyplot as plt\n",
|
||
|
"import seaborn as sns\n",
|
||
|
"\n",
|
||
|
"flights = sns.load_dataset('flights')\n",
|
||
|
"flights.head(10)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {
|
||
|
"slideshow": {
|
||
|
"slide_type": "slide"
|
||
|
}
|
||
|
},
|
||
|
"source": [
|
||
|
"### Heatmaps"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 3,
|
||
|
"metadata": {
|
||
|
"slideshow": {
|
||
|
"slide_type": "subslide"
|
||
|
}
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"<Axes: xlabel='year', ylabel='month'>"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 3,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAhsAAAHGCAYAAADdb0nRAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAABQlUlEQVR4nO3df3yN9f8/8Md19uPsl539tB9+zDDENoT3/KgU5kc0Iiq/oyLeJERLhcWWVfRm33q/JW36YSLeb5QQmkTFhLEs2iJsVplh5mw75/X9w8ep04bZzrXXdbbH3e263Zzrus51PTA7z71er+v1UoQQAkREREQq0ckOQERERLUbiw0iIiJSFYsNIiIiUhWLDSIiIlIViw0iIiJSFYsNIiIiUhWLDSIiIlIViw0iIiJSFYsNIiIiUpWj7ABq0Ls0kh0BOkV+HVffzSA7AnydPWVHAAD4OLrLjgBnxUF2BIToPGRHQKhwlh0BDUplJwD8TWWyI8DgUCI7Apq0/EN2BATsSlP9HqW/Z9vkOk5+TW1ynZpWK4sNIiIiTTGbZCeQSv6P30RERFSrsWWDiIhIbcIsO4FULDaIiIjUZmaxQURERCoSbNmQy2w24+TJk8jPz4f5b5XffffdJykVERER2YrUYuPbb7/F8OHDcerUKQghrI4pigKTqW6P3iUiolqC3SjyTJw4ER07dsRnn32GoKAgKIoiMw4REZE62I0iz4kTJ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RVlaGlJQU5OXlyY5CRESkDrPZNpudkl5sODo64plnnoHRaJQdhYi
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 2 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"df = flights.pivot(index=\"month\", columns=\"year\", values=\"passengers\")\n",
|
||
|
"sns.heatmap(df)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 4,
|
||
|
"metadata": {
|
||
|
"slideshow": {
|
||
|
"slide_type": "subslide"
|
||
|
}
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"<Axes: xlabel='year', ylabel='month'>"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAhsAAAHGCAYAAADdb0nRAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOyddVhUW9uH76GG7lRCUFRELFTs7u6uY3d3d3cePXa3HvPY3S0KioBId/cQ3x+jgyMoo+IZz/fu+7q4dK/8zZ49ez/7Wc9aS5SdnZ2NgICAgICAgMAvQkXZAgQEBAQEBAT+fyMYGwICAgICAgK/FMHYEBAQEBAQEPilCMaGgICAgICAwC9FMDYEBAQEBAQEfimCsSEgICAgICDwSxGMDQEBAQEBAYFfimBsCAgICAgICPxSBGNDQEBAQEBA4JeipmwBvwKxpo2yJaAiUr4dZ65toGwJmGjoK1sCAMZqOsqWgIZIVdkSsFPRVbYE7LM1lC2BwhJlKwCzzAxlS8BANV3ZEihSIkrZErC4du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+pzlLqCaPv27fH09KRv375UqlSJcuXKUb58edm/vzsGBnrExyf+64GsnTu3ISDgGU+eXGLRomno6hbcvh8ikYjVmxayed1O3r31+Wq5Nh2a8czrBpfuHGfanHHo6GoXmIbPMTY1okb9apw8cPaXtJ8XGmKp0ZuelvNWmpWVhSRdQunK0h+goYkBThWciI2MZc2JVRx5epAVR5ZRupJznm0qgo6e9HtMiJUOy1naWmJsbszTmzkPoYz0DNwfuOPkmuOuF2uKmbR+EptmbCImIuaH+wfQ0pN
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 2 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"sns.heatmap(df, annot=True, fmt=\"d\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {
|
||
|
"slideshow": {
|
||
|
"slide_type": "slide"
|
||
|
}
|
||
|
},
|
||
|
"source": [
|
||
|
"## Parallel coordinates"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 5,
|
||
|
"metadata": {
|
||
|
"slideshow": {
|
||
|
"slide_type": "subslide"
|
||
|
}
|
||
|
},
|
||
|
"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>total_bill</th>\n",
|
||
|
" <th>tip</th>\n",
|
||
|
" <th>sex</th>\n",
|
||
|
" <th>smoker</th>\n",
|
||
|
" <th>day</th>\n",
|
||
|
" <th>time</th>\n",
|
||
|
" <th>size</th>\n",
|
||
|
" </tr>\n",
|
||
|
" </thead>\n",
|
||
|
" <tbody>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>0</th>\n",
|
||
|
" <td>16.99</td>\n",
|
||
|
" <td>1.01</td>\n",
|
||
|
" <td>Female</td>\n",
|
||
|
" <td>No</td>\n",
|
||
|
" <td>Sun</td>\n",
|
||
|
" <td>Dinner</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>1</th>\n",
|
||
|
" <td>10.34</td>\n",
|
||
|
" <td>1.66</td>\n",
|
||
|
" <td>Male</td>\n",
|
||
|
" <td>No</td>\n",
|
||
|
" <td>Sun</td>\n",
|
||
|
" <td>Dinner</td>\n",
|
||
|
" <td>3</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>2</th>\n",
|
||
|
" <td>21.01</td>\n",
|
||
|
" <td>3.50</td>\n",
|
||
|
" <td>Male</td>\n",
|
||
|
" <td>No</td>\n",
|
||
|
" <td>Sun</td>\n",
|
||
|
" <td>Dinner</td>\n",
|
||
|
" <td>3</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>3</th>\n",
|
||
|
" <td>23.68</td>\n",
|
||
|
" <td>3.31</td>\n",
|
||
|
" <td>Male</td>\n",
|
||
|
" <td>No</td>\n",
|
||
|
" <td>Sun</td>\n",
|
||
|
" <td>Dinner</td>\n",
|
||
|
" <td>2</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>4</th>\n",
|
||
|
" <td>24.59</td>\n",
|
||
|
" <td>3.61</td>\n",
|
||
|
" <td>Female</td>\n",
|
||
|
" <td>No</td>\n",
|
||
|
" <td>Sun</td>\n",
|
||
|
" <td>Dinner</td>\n",
|
||
|
" <td>4</td>\n",
|
||
|
" </tr>\n",
|
||
|
" </tbody>\n",
|
||
|
"</table>\n",
|
||
|
"</div>"
|
||
|
],
|
||
|
"text/plain": [
|
||
|
" total_bill tip sex smoker day time size\n",
|
||
|
"0 16.99 1.01 Female No Sun Dinner 2\n",
|
||
|
"1 10.34 1.66 Male No Sun Dinner 3\n",
|
||
|
"2 21.01 3.50 Male No Sun Dinner 3\n",
|
||
|
"3 23.68 3.31 Male No Sun Dinner 2\n",
|
||
|
"4 24.59 3.61 Female No Sun Dinner 4"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 5,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"from pandas.plotting import parallel_coordinates\n",
|
||
|
"\n",
|
||
|
"df = sns.load_dataset('tips')\n",
|
||
|
"df.head(5)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 6,
|
||
|
"metadata": {
|
||
|
"slideshow": {
|
||
|
"slide_type": "subslide"
|
||
|
}
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA+EAAAORCAYAAACdm6MnAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdd3iUVfr/8fczPWXSCCQESELvNRQVO/aCBbvrT3ftShMUxIIoiIpKt2Dbdb9rWXtbCxasKCVUKdICgUACCSGZ1MmU3x8TBmJIUJgJBj6v6+KSzDzPOWcm47r3nHPft+H3+/2IiIiIiIiISNiZjvQCRERERERERI4VCsJFREREREREGoiCcBEREREREZEGoiBcREREREREpIEoCBcRERERERFpIArCRURERERERBqIgnARERERERGRBqIgXERERERERKSBKAgXERERERERaSAKwkVE5C/l1FNPxTAMJkyY8KeeOxzffvsthmFgGEZIxz3WTJgwAcMwOPXUU2s9d8MNN2AYBjfccEODr0tEROSvREG4iEgjtDfY+f0fh8NBy5YtGTx4MG+99RZ+v/9IL/WYs2LFCsaOHUv//v1JSkrCZrMRGxtLly5duP766/nwww+pqqo60suUah988AETJkzggw8+ONJLERGRY4TlSC9AREQOT1JSUvDvRUVF5OTkkJOTw8cff8y//vUv3n//fex2+xFc4bHB5XJx22238cYbbwS//DAMg9jYWMrLy1mzZg1r1qzh3//+N23btuW1115jwIABR3jVDad58+Z07NiR5s2bH+ml1PDBBx/w6quvcv3113PxxRcf6eWIiMgxQDvhIiKNXG5ubvBPaWkpv/76K2eeeSYAn332GQ888MARXuHRr7CwkOOPP57XX38dgKuuuorvvvuOiooKCgsLqaioICcnh5deeokePXqwceNGfv755yO86ob12GOPsXbtWh577LEjvRQREZEjSkG4iMhRxGQy0bVrVz766CPatWsHwJw5c/B4PEd4ZUe3a6+9llWrVmGxWPjvf//LG2+8wcknn4zNZgtek5KSwo033siyZct49tlncTgcR3DFIiIicqQoCBcROQo5HA4uv/xyIHBMeu3atUDguPqbb77JtddeS/fu3UlISMDhcJCWlsY111zDL7/8UueYvy+69e6773LWWWfRrFkzTCZTjWJpv/32G08++SRnnHEGbdu2JSIigpiYGHr37s0DDzxAfn5+2F77xo0bGTZsGJ07dyY6OprIyEg6d+7MyJEjyc7ODvl8n332GZ999hkA48ePD77vdTEMg9tvv51bbrml1nNer5dXXnmF008/ncTEROx2Oy1atODyyy/n22+/Pehavv32Wy6//HJatGiB3W4nMTGRQYMG8c9//hOv13vAe/7M73Xv6z3zzDOJi4sjOjqanj17MmXKlIPmuddXmG3/gnt+v58XX3yRAQMGEBMTg9Pp5Pjjj+c///lPnWPv3LmTV155hUsvvZTOnTsTGxtLREQE7dq146abbmLVqlUHfK8Mw+DVV18F4NVXX61VY+FA7/mhfr7Wrl3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lxQ/4ExIS/F6v9w+Ne+edd/oB/4033ljvnKNGjTrktbtcLn9SUpIf8P/www+1nj+UnfDKykp/ixYt/ID/5ZdfrnPuwYMH+wH/iBEjajx+qDvhGzZsCN736KOP/ql797dgwYLgOHPmzDngNUOGDPED/sTERH95eXnw8bKyMn9CQoIf8F999dUHvHfmzJnB8RctWlTjuT/6e+3SpUtwl/tAn6fnn38+OM6h7oQD/m+++abW8xUVFcHP86RJk+pcY13OP/98P+CfOHHin1rXXofz+crLywu+tu3bt//ptYuIyNFHO+EiIkeRPXv28PXXX3P66acHd/1GjBiByfTH/uf+/PPPB+DHH3+s8xqTycTYsWMPeY3R0dGccsopB53nz/jss8/IyckhKSmpxo787/2///f/APjiiy9CMm9BQUHw73tPGxyKN998E4CWLVty0003HfCaiRMnApCfn8+XX34ZfPzLL79k9+7dALXyt/e64447gq3B3njjjQNeU9/vdcWKFaxevRqABx544ICfp5tvvpkWLVoc8P4/auDAgZx22mm1Hrfb7Zx99tnBtfxZf+RzXZ/D+Xw5nc7g+7Vjx45Dml9ERI4u6hMuItLIGYZR53N/+9vfuP/++2s8tmnTJp599lnmzZvHxo0bcblc+Hy+Gtds27atzjHbtWtHs2bNDrquTz75hP/7v/9j0aJF5OXlUVZWVuua+ub5M/YGV4WFhfX2oXa73QBs2bIlJPP6q/uBQ/2/h4NZvHgxAKeddlqdX5h07tyZFi1akJOTw+LFi4NHtPfe26pVKzp06HDAe81mM6effjqvvfZa8Prfq+/3uvcei8XCSSeddMBrTCYTp556Kq+99lodr/Lg6uubnpKSAhD8wuH3li9fzpw5c/jxxx/ZvHkzJSUlNX4/cOift8P5fEVERDBo0CC+/PJLzjnnHG677TbOP/98evfuXaN6voiIHDsUhIuINHJJSUnBv++tiN27d2+uvfbaWruK77//PldffTWVlZXBx2JiYnA4HBiGEcxVLS0trXO+gwXgPp+Pv/3tbzV2XC0WC/Hx8cGgo6ioiIqKinrn+TP27vq73W7y8vIOen15eXlI5k1MTAz+ff9d8T9r586dAAfdSW7ZsiU5OTnB6//svftf/3v1/V733rO3YvvB5jhUTqezzucslsD/ZTlQFfbZs2czYsSI4JdJhmEQGxsbXGt5eTnFxcWH/Hk73M/XSy+9xODBg1m+fDkTJ05k4sSJ2Gw2+vXrx0UXXcSNN954WCcpRESkcdFxdBGRRm7/QlJbtmwhMzOTl156qVYAXlBQwA033EBlZSWnn3463377LWVlZRQVFZGXl0dubi5vv/32Qeczm831Pv/yyy/zxhtvYDabGT9+POv
|
||
|
"text/plain": [
|
||
|
"<Figure size 1200x1000 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"fig = plt.figure(figsize=(12, 10))\n",
|
||
|
"title = fig.suptitle(\"Parallel Coordinates\", fontsize=18)\n",
|
||
|
"fig.subplots_adjust(top=0.93, wspace=0)\n",
|
||
|
"\n",
|
||
|
"pc = parallel_coordinates(df, \n",
|
||
|
" 'smoker', # class name \n",
|
||
|
" ['total_bill', 'tip', 'size'],# numeric columns to show\n",
|
||
|
" color=('skyblue', 'firebrick'))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {
|
||
|
"slideshow": {
|
||
|
"slide_type": "skip"
|
||
|
}
|
||
|
},
|
||
|
"source": [
|
||
|
"# References\n",
|
||
|
"* [Data Preprocessing for Machine learning in Python, GeeksForGeeks](https://www.geeksforgeeks.org/data-preprocessing-machine-learning-python/)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {
|
||
|
"slideshow": {
|
||
|
"slide_type": "skip"
|
||
|
}
|
||
|
},
|
||
|
"source": [
|
||
|
"## Licence\n",
|
||
|
"The notebook is freely licensed under under the [Creative Commons Attribution Share-Alike license](https://creativecommons.org/licenses/by/2.0/). \n",
|
||
|
"\n",
|
||
|
"© Carlos A. Iglesias, Universidad Politécnica de Madrid."
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"datacleaner": {
|
||
|
"position": {
|
||
|
"top": "50px"
|
||
|
},
|
||
|
"python": {
|
||
|
"varRefreshCmd": "try:\n print(_datacleaner.dataframe_metadata())\nexcept:\n print([])"
|
||
|
},
|
||
|
"window_display": false
|
||
|
},
|
||
|
"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.13"
|
||
|
},
|
||
|
"latex_envs": {
|
||
|
"LaTeX_envs_menu_present": true,
|
||
|
"autocomplete": true,
|
||
|
"bibliofile": "biblio.bib",
|
||
|
"cite_by": "apalike",
|
||
|
"current_citInitial": 1,
|
||
|
"eqLabelWithNumbers": true,
|
||
|
"eqNumInitial": 1,
|
||
|
"hotkeys": {
|
||
|
"equation": "Ctrl-E",
|
||
|
"itemize": "Ctrl-I"
|
||
|
},
|
||
|
"labels_anchors": false,
|
||
|
"latex_user_defs": false,
|
||
|
"report_style_numbering": false,
|
||
|
"user_envs_cfg": false
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 4
|
||
|
}
|