Skip to content

Commit

Permalink
adapt notebook for Graz
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-rind committed Sep 21, 2023
1 parent b4b1983 commit 222eb8a
Showing 1 changed file with 36 additions and 76 deletions.
112 changes: 36 additions & 76 deletions examples/SoniScope-Graz.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -75,69 +75,27 @@
},
"source": [
"---\n",
"---\n",
"\n",
"### Loading the data\n",
"\n",
"Download here: https://archive.ics.uci.edu/ml/datasets/bike+sharing+dataset\n",
"\n",
"The following text is also taken from the download website.\n",
"\n",
"**Source:**\n",
"\n",
"Hadi Fanaee-T\n",
"\n",
"Laboratory of Artificial Intelligence and Decision Support (LIAAD), University of Porto\n",
"INESC Porto, Campus da FEUP\n",
"Rua Dr. Roberto Frias, 378\n",
"4200 - 465 Porto, Portugal\n",
"\n",
"Original Source: http://capitalbikeshare.com/system-data\n",
"Weather Information: http://www.freemeteo.com\n",
"Holiday Schedule: http://dchr.dc.gov/page/holiday-schedule\n",
"\n",
"\n",
"**Data Set Information:**\n",
"\n",
"Bike sharing systems are new generation of traditional bike rentals where whole process from membership, rental and return back has become automatic. Through these systems, user is able to easily rent a bike from a particular position and return back at another position. Currently, there are about over 500 bike-sharing programs around the world which is composed of over 500 thousands bicycles. Today, there exists great interest in these systems due to their important role in traffic, environmental and health issues.\n",
"\n",
"Apart from interesting real world applications of bike sharing systems, the characteristics of data being generated by these systems make them attractive for the research. Opposed to other transport services such as bus or subway, the duration of travel, departure and arrival position is explicitly recorded in these systems. This feature turns bike sharing system into a virtual sensor network that can be used for sensing mobility in the city. Hence, it is expected that most of important events in the city could be detected via monitoring these data.\n",
"### Daten & Quelle\n",
"\n",
"Luftgütedaten Steiermark\n",
"CC-BY-4.0: Land Steiermark - data.steiermark.gv.at\n",
"<https://data.steiermark.at/cms/beitrag/11822084/97108894/?AppInt_OGD_ID=2>\n",
"\n",
"**Attribute Information:**\n",
"Station: Graz Mitte - Gries\n",
"Zeitraum 2. August 2020 - 1. Juli 2023\n",
"Export: 16. August 2023\n",
"\n",
"day.csv has the following fields:\n",
"**Attribute:**\n",
"\n",
"- instant: record index\n",
"- dteday : date\n",
"- season : season (1:winter, 2:spring, 3:summer, 4:fall)\n",
"- yr : year (0: 2011, 1:2012)\n",
"- mnth : month ( 1 to 12)\n",
"- holiday : weather day is holiday or not (extracted from [Web Link])\n",
"- weekday : day of the week\n",
"- workingday : if day is neither weekend nor holiday is 1, otherwise is 0.\n",
"- weathersit :\n",
" - 1: Clear, Few clouds, Partly cloudy, Partly cloudy\n",
" - 2: Mist + Cloudy, Mist + Broken clouds, Mist + Few clouds, Mist\n",
" - 3: Light Snow, Light Rain + Thunderstorm + Scattered clouds, Light Rain + Scattered clouds\n",
" - 4: Heavy Rain + Ice Pallets + Thunderstorm + Mist, Snow + Fog\n",
"- temp : Normalized temperature in Celsius. The values are derived via (t-t_min)/(t_max-t_min), t_min=-8, t_max=+39 (only in hourly scale)\n",
"- atemp: Normalized feeling temperature in Celsius. The values are derived via (t-t_min)/(t_max-t_min), t_min=-16, t_max=+50 (only in hourly scale)\n",
"- hum: Normalized humidity. The values are divided to 100 (max)\n",
"- windspeed: Normalized wind speed. The values are divided to 67 (max)\n",
"- casual: count of casual users\n",
"- registered: count of registered users\n",
"- cnt: count of total rental bikes including both casual and registered\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"id": "ff4804b6-b887-4437-92b7-cff04b70bb97",
"metadata": {},
"source": [
"For this demo, we unnormalized the dataset in order to semantically enriched the user experience."
"- Datum\n",
"- Jahreszeit: z.B. \"Sommer\"\n",
"- Wochentag: z.B. \"Freitag\"\n",
"- Lufttemperatur [°C]\n",
"- Relative Luftfeuchte [%]\n",
"- NOX (Stickstoffoxide) [ppb]\n",
"- CO (Kohlenmonoxid) [mg/m³]: WHO Richtwert 4 µg/m³\n",
"- PM10 (Feinstaub) [µg/m³]: WHO Richtwert 45 µg/m³\n"
]
},
{
Expand All @@ -149,7 +107,7 @@
},
"outputs": [],
"source": [
"daily_file = 'bike_day_semantic.csv'\n",
"daily_file = 'Graz-Mitte-Gries-Luft.csv'\n",
"daily = pd.read_table(daily_file, sep=',')\n",
"daily"
]
Expand Down Expand Up @@ -446,7 +404,7 @@
"\n",
"#---------------------------------------------------\n",
"soni_dim = widgets.Dropdown(options=numeric_cols,\n",
" value='cnt',\n",
" value=numeric_cols[1],\n",
" description='Pitch:',\n",
" disabled=False)\n",
"\n",
Expand All @@ -458,7 +416,7 @@
"\n",
"#----------------------------------------------------\n",
"soni_sort_dim = widgets.Dropdown(options=numeric_cols,\n",
" value='temp °C',\n",
" value=numeric_cols[0],\n",
" description='Sort:',\n",
" disabled=False)\n",
"\n",
Expand Down Expand Up @@ -536,10 +494,12 @@
"cell_type": "code",
"execution_count": null,
"id": "fa2be301-99ee-4dab-b606-6fa0078fec74",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"plotBike = LensWidget(daily, 'temp °C', 'hum %')\n",
"plot = LensWidget(daily, numeric_cols[0], numeric_cols[1])\n",
"\n",
"#----------------------------------------------------\n",
"sliderSize = widgets.FloatSlider(description='Lens Size', min=0.01, max=1.5, step=0.01, readout_format='.0%')\n",
Expand All @@ -550,17 +510,17 @@
" description='Lens Shape:')\n",
"\n",
"#----------------------------------------------------\n",
"drpX = widgets.Dropdown(options=numeric_cols, value='temp °C', description='X-Axis:',)\n",
"drpY = widgets.Dropdown(options=numeric_cols, value='hum %', description='Y-Axis:',)\n",
"drpC = widgets.Dropdown(options=['', 'season', 'weekday', 'weathersit'], value='', description='Color:',)\n",
"drpX = widgets.Dropdown(options=numeric_cols, value=numeric_cols[0], description='X-Axis:',)\n",
"drpY = widgets.Dropdown(options=numeric_cols, value=numeric_cols[1], description='Y-Axis:',)\n",
"drpC = widgets.Dropdown(options=['', 'Jahreszeit', 'Wochentag'], value='', description='Color:',)\n",
"\n",
"#----------------------------------------------------\n",
"# connection between frontend and python\n",
"l = widgets.link((plotBike, 'size'), (sliderSize, 'value'))\n",
"l2 = widgets.link((plotBike, 'shape'), (radioShape, 'value'))\n",
"l3 = widgets.link((plotBike, 'x_field'), (drpX, 'value'))\n",
"l4 = widgets.link((plotBike, 'y_field'), (drpY, 'value'))\n",
"l5 = widgets.link((plotBike, 'color_field'), (drpC, 'value'))\n",
"l = widgets.link((plot, 'size'), (sliderSize, 'value'))\n",
"l2 = widgets.link((plot, 'shape'), (radioShape, 'value'))\n",
"l3 = widgets.link((plot, 'x_field'), (drpX, 'value'))\n",
"l4 = widgets.link((plot, 'y_field'), (drpY, 'value'))\n",
"l5 = widgets.link((plot, 'color_field'), (drpC, 'value'))\n",
"\n",
"#----------------------------------------------------\n",
"outputBike = widgets.Output() # for using print within the def on_clicked\n",
Expand All @@ -582,7 +542,7 @@
" #decay_switch, # uncomment for the decay option (run also the cell above again)\n",
" #euclidean_switch, # uncomment for the eclidean distance sorting option (run also the cell above again)\n",
" ]),\n",
" plotBike\n",
" plot\n",
" ]),\n",
" explanation_text,\n",
" outputBike)\n",
Expand All @@ -593,8 +553,8 @@
"\n",
"#----------------------------------------------------\n",
"# You can use the SoniScpoe now :)\n",
"plotBike.on_lens_click(on_lens_clicked)\n",
"plotBike.on_lens_release(on_lens_released)"
"plot.on_lens_click(on_lens_clicked)\n",
"plot.on_lens_release(on_lens_released)"
]
},
{
Expand All @@ -617,8 +577,8 @@
"metadata": {},
"outputs": [],
"source": [
"plotBike.substrate_width = 600\n",
"plotBike.substrate_height = 600"
"plot.substrate_width = 600\n",
"plot.substrate_height = 600"
]
},
{
Expand Down

0 comments on commit 222eb8a

Please sign in to comment.