mirror of
https://github.com/gsi-upm/sitc
synced 2024-12-22 03:38:13 +00:00
Added visualization notebooks
This commit is contained in:
parent
0d4c0c706d
commit
21819abeae
185
ml21/visualization/00_Intro_Visualization.ipynb
Normal file
185
ml21/visualization/00_Intro_Visualization.ipynb
Normal file
@ -0,0 +1,185 @@
|
||||
{
|
||||
"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": "slide"
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"# Introduction to Visualization\n",
|
||||
" \n",
|
||||
"In this session, we will get more insight regarding how to visualize data.\n",
|
||||
"\n",
|
||||
"# Objectives\n",
|
||||
"\n",
|
||||
"The main objectives of this session are:\n",
|
||||
"* Understanding how to visualize data\n",
|
||||
"* Understanding the purpose of different charts \n",
|
||||
"* Experimenting with several environments for visualizing data\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"slideshow": {
|
||||
"slide_type": "slide"
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"# Seaborn\n",
|
||||
"\n",
|
||||
"Seaborn is a library that visualizes data in Python. The main characteristics are:\n",
|
||||
"\n",
|
||||
"* A dataset-oriented API for examining relationships between multiple variables\n",
|
||||
"* Specialized support for using categorical variables to show observations or aggregate statistics\n",
|
||||
"* Options for visualizing univariate or bivariate distributions and for comparing them between subsets of data\n",
|
||||
"* Automatic estimation and plotting of linear regression models for different kinds of dependent variables\n",
|
||||
"* Convenient views of the overall structure of complex datasets\n",
|
||||
"* High-level abstractions for structuring multi-plot grids that let you quickly build complex visualizations\n",
|
||||
"* Concise control over matplotlib figure styling with several built-in themes\n",
|
||||
"* Tools for choosing color palettes that faithfully reveal patterns in your data\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"slideshow": {
|
||||
"slide_type": "slide"
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"## Install\n",
|
||||
"Use:\n",
|
||||
"\n",
|
||||
"**conda install seaborn**\n",
|
||||
"\n",
|
||||
"or \n",
|
||||
"\n",
|
||||
"**pip install seaborn**"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"slideshow": {
|
||||
"slide_type": "slide"
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"# Table of Contents"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"slideshow": {
|
||||
"slide_type": "fragment"
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"1. [Home](00_Intro_Visualization.ipynb)\n",
|
||||
"2. [Dataset](01_Dataset.ipynb)\n",
|
||||
"3. [Comparison Charts](02_Comparison_Charts.ipynb)\n",
|
||||
" 1. [More Comparison Charts](02_01_More_Comparison_Charts.ipynb)\n",
|
||||
"4. [Distribution Charts](03_Distribution_Charts.ipynb)\n",
|
||||
"5. [Hierarchical charts](04_Hierarchical_Charts.ipynb)\n",
|
||||
"6. [Relational charts](05_Relational_Charts.ipynb)\n",
|
||||
"7. [Spatial charts](06_Spatial_Charts.ipynb)\n",
|
||||
"8. [Temporal charts](07_Temporal_Charts.ipynb)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"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.11.7"
|
||||
},
|
||||
"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
|
||||
}
|
363
ml21/visualization/01_Dataset.ipynb
Normal file
363
ml21/visualization/01_Dataset.ipynb
Normal file
@ -0,0 +1,363 @@
|
||||
{
|
||||
"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": [
|
||||
"# Dataset\n",
|
||||
"Seaborn includes several datasets. We can consult the available datasets and load them. \n",
|
||||
"\n",
|
||||
"The datasets are also available at https://github.com/mwaskom/seaborn-data."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"slideshow": {
|
||||
"slide_type": "fragment"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import pandas as pd\n",
|
||||
"from matplotlib import pyplot as plt\n",
|
||||
"import seaborn as sns"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"slideshow": {
|
||||
"slide_type": "subslide"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"['anagrams',\n",
|
||||
" 'anscombe',\n",
|
||||
" 'attention',\n",
|
||||
" 'brain_networks',\n",
|
||||
" 'car_crashes',\n",
|
||||
" 'diamonds',\n",
|
||||
" 'dots',\n",
|
||||
" 'dowjones',\n",
|
||||
" 'exercise',\n",
|
||||
" 'flights',\n",
|
||||
" 'fmri',\n",
|
||||
" 'geyser',\n",
|
||||
" 'glue',\n",
|
||||
" 'healthexp',\n",
|
||||
" 'iris',\n",
|
||||
" 'mpg',\n",
|
||||
" 'penguins',\n",
|
||||
" 'planets',\n",
|
||||
" 'seaice',\n",
|
||||
" 'taxis',\n",
|
||||
" 'tips',\n",
|
||||
" 'titanic']"
|
||||
]
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"sns.get_dataset_names()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"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",
|
||||
" <tr>\n",
|
||||
" <th>5</th>\n",
|
||||
" <td>25.29</td>\n",
|
||||
" <td>4.71</td>\n",
|
||||
" <td>Male</td>\n",
|
||||
" <td>No</td>\n",
|
||||
" <td>Sun</td>\n",
|
||||
" <td>Dinner</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>6</th>\n",
|
||||
" <td>8.77</td>\n",
|
||||
" <td>2.00</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>7</th>\n",
|
||||
" <td>26.88</td>\n",
|
||||
" <td>3.12</td>\n",
|
||||
" <td>Male</td>\n",
|
||||
" <td>No</td>\n",
|
||||
" <td>Sun</td>\n",
|
||||
" <td>Dinner</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>8</th>\n",
|
||||
" <td>15.04</td>\n",
|
||||
" <td>1.96</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>9</th>\n",
|
||||
" <td>14.78</td>\n",
|
||||
" <td>3.23</td>\n",
|
||||
" <td>Male</td>\n",
|
||||
" <td>No</td>\n",
|
||||
" <td>Sun</td>\n",
|
||||
" <td>Dinner</td>\n",
|
||||
" <td>2</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\n",
|
||||
"5 25.29 4.71 Male No Sun Dinner 4\n",
|
||||
"6 8.77 2.00 Male No Sun Dinner 2\n",
|
||||
"7 26.88 3.12 Male No Sun Dinner 4\n",
|
||||
"8 15.04 1.96 Male No Sun Dinner 2\n",
|
||||
"9 14.78 3.23 Male No Sun Dinner 2"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"df = sns.load_dataset('tips')\n",
|
||||
"df.head(10)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"slideshow": {
|
||||
"slide_type": "skip"
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"# References\n",
|
||||
"* [Seaborn](http://seaborn.pydata.org/index.html) documentation"
|
||||
]
|
||||
},
|
||||
{
|
||||
"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
|
||||
}
|
3192
ml21/visualization/02_01_More_Comparison_Charts.ipynb
Normal file
3192
ml21/visualization/02_01_More_Comparison_Charts.ipynb
Normal file
File diff suppressed because one or more lines are too long
561
ml21/visualization/02_Comparison_Charts.ipynb
Normal file
561
ml21/visualization/02_Comparison_Charts.ipynb
Normal file
File diff suppressed because one or more lines are too long
1235
ml21/visualization/03_Distribution_Charts.ipynb
Normal file
1235
ml21/visualization/03_Distribution_Charts.ipynb
Normal file
File diff suppressed because one or more lines are too long
2126
ml21/visualization/04_Hierarchical_Charts.ipynb
Normal file
2126
ml21/visualization/04_Hierarchical_Charts.ipynb
Normal file
File diff suppressed because one or more lines are too long
500
ml21/visualization/05_Relational_Charts.ipynb
Normal file
500
ml21/visualization/05_Relational_Charts.ipynb
Normal file
File diff suppressed because one or more lines are too long
689
ml21/visualization/06_Spatial_Charts.ipynb
Normal file
689
ml21/visualization/06_Spatial_Charts.ipynb
Normal file
File diff suppressed because one or more lines are too long
451
ml21/visualization/07_Temporal_Charts.ipynb
Normal file
451
ml21/visualization/07_Temporal_Charts.ipynb
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user