Compare commits

...

5 Commits

Author SHA1 Message Date
Carlos A. Iglesias 743c57691f
Delete sna/t.txt 2 weeks ago
Carlos A. Iglesias 2c53b81299
Uploaded SNA files 2 weeks ago
Carlos A. Iglesias dd6c053109
Add files via upload 2 weeks ago
Carlos A. Iglesias e35e0a11e9
Create t.txt 2 weeks ago
Carlos A. Iglesias 7315b681e4
Update README.md 2 weeks ago

@ -1,7 +1,7 @@
# sitc
Exercises for Intelligent Systems Course at Universidad Politécnica de Madrid, Telecommunication Engineering School. This material is used in the subjects
- SITC (Sistemas Inteligentes y Tecnologías del Conocimiento) - Master Universitario de Ingeniería de Telecomunicación (MUIT)
- TIAD (Tecnologías Inteligentes de Análisis de Datos) - Master Universitario en Ingeniera de Redes y Servicios Telemáticos)
- CDAW (Ciencia de datos y aprendizaje en automático en la web de datos) - Master Universitario de Ingeniería de Telecomunicación (MUIT)
- ABID (Analítica de Big Data) - Master Universitario en Ingeniera de Redes y Servicios Telemáticos)
For following this course:
- Follow the instructions to install the environment: https://github.com/gsi-upm/sitc/blob/master/python/1_1_Notebooks.ipynb (Just install 'conda')
@ -9,11 +9,13 @@ For following this course:
- Run in a terminal in the folder sitc: jupyter notebook (and enjoy)
Topics
* Python: quick introduction to Python
* Python: a quick introduction to Python
* ML-1: introduction to machine learning with scikit-learn
* ML-2: introduction to machine learning with pandas and scikit-learn
* ML-21: preprocessing and visualizatoin
* ML-3: introduction to machine learning. Neural Computing
* ML-4: introduction to Evolutionary Computing
* ML-5: introduction to Reinforcement Learning
* NLP: introduction to NLP
* LOD: Linked Open Data, exercises and example code
* SNA: Social Network Analysis

@ -0,0 +1,154 @@
{
"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 Network Analysis\n",
" \n",
"In this session, we are going to get more insight regarding how to analyze and visualize social networks.\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"# Objectives\n",
"\n",
"The main objectives of this session are:\n",
"* Understanding why networks are important in data science\n",
"* Experimenting with network analysis with networkx."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"# Table of Contents"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"1. [Home](0_Intro_Network_Analysis.ipynb)\n",
"2. [First Steps](1_First_Steps.ipynb)\n",
"3. [Working_with_Graphs](2_Working_with_Graphs.ipynb)\n",
"4. [Network Analysis](3_Network_Analysis.ipynb)\n",
"5. [Social Networks](4_Social_Networks.ipynb)\n",
"6. [Pandas integration](5_Pandas.ipynb)\n"
]
},
{
"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": {
"celltoolbar": "Slideshow",
"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
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,374 @@
{
"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 Network Analysis](0_Intro_Network_Analysis.ipynb)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Exercise: Florentine families"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import networkx as nx\n",
"import warnings\n",
"warnings.simplefilter(action='ignore', category=FutureWarning)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"G_florentine = nx.florentine_families_graph()"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"# Exercise: Star Wars"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import networkx as nx\n",
"\n",
"# Taken from https://gist.github.com/codingthat/be03565bd97e789a3835b50235ad562f\n",
"# The original dataset is from:\n",
"# Gabasova, E. (2016). Star Wars social network. DOI: https://doi.org/10.5281/zenodo.1411479\n",
"# \n",
"# Simplified by Federico Albanese.\n",
"\n",
"characters = [\"R2-D2\",\n",
" \"CHEWBACCA\",\n",
" \"C-3PO\",\n",
" \"LUKE\",\n",
" \"DARTH VADER\",\n",
" \"CAMIE\",\n",
" \"BIGGS\",\n",
" \"LEIA\",\n",
" \"BERU\",\n",
" \"OWEN\",\n",
" \"OBI-WAN\",\n",
" \"MOTTI\",\n",
" \"TARKIN\",\n",
" \"HAN\",\n",
" \"DODONNA\",\n",
" \"GOLD LEADER\",\n",
" \"WEDGE\",\n",
" \"RED LEADER\",\n",
" \"RED TEN\"]\n",
"\n",
"\n",
"edges = [(\"CHEWBACCA\", \"R2-D2\"),\n",
" (\"C-3PO\",\"R2-D2\"),\n",
" (\"BERU\", \"R2-D2\"),\n",
" (\"LUKE\", \"R2-D2\"),\n",
" (\"OWEN\", \"R2-D2\"),\n",
" (\"OBI-WAN\", \"R2-D2\"),\n",
" (\"LEIA\", \"R2-D2\"),\n",
" (\"BIGGS\", \"R2-D2\"),\n",
" (\"HAN\", \"R2-D2\"),\n",
" (\"CHEWBACCA\", \"OBI-WAN\"),\n",
" (\"C-3PO\", \"CHEWBACCA\"),\n",
" (\"CHEWBACCA\", \"LUKE\"),\n",
" (\"CHEWBACCA\", \"HAN\"),\n",
" (\"CHEWBACCA\", \"LEIA\"),\n",
" (\"CAMIE\", \"LUKE\"),\n",
" (\"BIGGS\", \"CAMIE\"),\n",
" (\"BIGGS\", \"LUKE\"),\n",
" (\"DARTH VADER\", \"LEIA\"),\n",
" (\"BERU\", \"LUKE\"),\n",
" (\"BERU\", \"OWEN\"),\n",
" (\"BERU\", \"C-3PO\"),\n",
" (\"LUKE\", \"OWEN\"),\n",
" (\"C-3PO\", \"LUKE\"),\n",
" (\"C-3PO\", \"OWEN\"),\n",
" (\"C-3PO\", \"LEIA\"),\n",
" (\"LEIA\", \"LUKE\"),\n",
" (\"BERU\", \"LEIA\"),\n",
" (\"LUKE\", \"OBI-WAN\"),\n",
" (\"C-3PO\", \"OBI-WAN\"),\n",
" (\"LEIA\", \"OBI-WAN\"),\n",
" (\"MOTTI\", \"TARKIN\"),\n",
" (\"DARTH VADER\", \"MOTTI\"),\n",
" (\"DARTH VADER\", \"TARKIN\"),\n",
" (\"HAN\", \"OBI-WAN\"),\n",
" (\"HAN\", \"LUKE\"),\n",
" (\"C-3PO\", \"HAN\"),\n",
" (\"LEIA\", \"MOTT\"),\n",
" (\"LEIA\", \"TARKIN\"),\n",
" (\"HAN\", \"LEIA\"),\n",
" (\"DARTH VADER\", \"OBI-WAN\"),\n",
" (\"DODONNA\", \"GOLD LEADER\"),\n",
" (\"DODONNA\", \"WEDGE\"),\n",
" (\"DODONNA\", \"LUKE\"),\n",
" (\"GOLD LEADER\", \"WEDGE\"),\n",
" (\"GOLD LEADER\", \"LUKE\"),\n",
" (\"LUKE\", \"WEDGE\"),\n",
" (\"BIGGS\", \"LEIA\"),\n",
" (\"LEIA\", \"RED LEADER\"),\n",
" (\"LUKE\", \"RED LEADER\"),\n",
" (\"BIGGS\", \"RED LEADER\"),\n",
" (\"BIGGS\", \"C-3PO\"),\n",
" (\"C-3PO\", \"RED LEADER\"),\n",
" (\"RED LEADER\", \"WEDGE\"),\n",
" (\"GOLD LEADER\", \"RED LEADER\"),\n",
" (\"BIGGS\", \"WEDGE\"),\n",
" (\"RED LEADER\", \"RED TEN\"),\n",
" (\"BIGGS\", \"GOLD LEADER\"),\n",
" (\"LUKE\", \"RED TEN\")]\n",
"\n",
"G_starWars = nx.Graph()\n",
"\n",
"\n",
"G_starWars.add_nodes_from(characters)\n",
"G_starWars.add_edges_from(edges)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Exercise\n",
"In this exercise we are going to practice some of the concepts of the session.\n",
"\n",
"Answer the following questions using the object *G_starWars* and *G_florentine*."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Number of nodes"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Number of edges"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Get the list of nodes"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Get the list of edges"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Draw the graph\n",
"\n",
"Hint. Use different layouts (circular, spring, ...)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Think of interesting micro, meso and macro metrics"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Analyze ego networks of interesting nodes."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Analyze communities"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "skip"
}
},
"source": [
"## Licence"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "skip"
}
},
"source": [
"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": {
"celltoolbar": "Slideshow",
"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
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Loading…
Cancel
Save