bike sharing using neural networks - emory universitylxiong/cs378/share/project/12_late...2018/04/25...

11
Bike Sharing Using Neural Networks Patrick Wang

Upload: others

Post on 05-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Bike Sharing Using Neural Networks - Emory Universitylxiong/cs378/share/project/12_late...2018/04/25  · Problem to Solve We want to be able to predict the number of people that would

Bike Sharing Using Neural Networks

Patrick Wang

Page 2: Bike Sharing Using Neural Networks - Emory Universitylxiong/cs378/share/project/12_late...2018/04/25  · Problem to Solve We want to be able to predict the number of people that would

Problem to Solve

§ We want to be able to predict the number of people that would be renting a bike for transportation given a day.

§ By having too few bikes, bike rental companies would not be maximizing their profits.

§ By having too many bikes, the bike rental company could be spending unnecessary money on extra bikes, maintenance on the extra bikes, and the storage of the extra bikes.

Page 3: Bike Sharing Using Neural Networks - Emory Universitylxiong/cs378/share/project/12_late...2018/04/25  · Problem to Solve We want to be able to predict the number of people that would

Goals

§ The goal is to create a model using a neural network given certain characteristics of the day like humidity, wind speed, working day or not, and etc. By finding a correlation between these characteristics, we can create a predictive model to predict approximately how many bikes are rented out at any given time of any day.

Page 4: Bike Sharing Using Neural Networks - Emory Universitylxiong/cs378/share/project/12_late...2018/04/25  · Problem to Solve We want to be able to predict the number of people that would

Data

hours.csv

This dataset contains the hourly count of rental bikes between years 2011 and 2012 in Capital bikeshare system with the corresponding weather and seasonal information.

https://archive.ics.uci.edu/ml/datasets/bike+sharing+dataset

Page 5: Bike Sharing Using Neural Networks - Emory Universitylxiong/cs378/share/project/12_late...2018/04/25  · Problem to Solve We want to be able to predict the number of people that would

Attribute Information

§ - instant: record index- dteday : date- season : season (1:springer, 2:summer, 3:fall, 4:winter)- yr : year (0: 2011, 1:2012)- mnth : month ( 1 to 12)- hr : hour (0 to 23)- holiday : weather day is holiday or not (extracted from [Web Link])- weekday : day of the week- workingday : if day is neither weekend nor holiday is 1, otherwise is 0.+ weathersit :- 1: Clear, Few clouds, Partly cloudy, Partly cloudy- 2: Mist + Cloudy, Mist + Broken clouds, Mist + Few clouds, Mist- 3: Light Snow, Light Rain + Thunderstorm + Scattered clouds, Light Rain + Scattered clouds- 4: Heavy Rain + Ice Pallets + Thunderstorm + Mist, Snow + Fog- 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)- 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)- hum: Normalized humidity. The values are divided to 100 (max)- windspeed: Normalized wind speed. The values are divided to 67 (max)- casual: count of casual users- registered: count of registered users- cnt: count of total rental bikes including both casual and registered

Page 6: Bike Sharing Using Neural Networks - Emory Universitylxiong/cs378/share/project/12_late...2018/04/25  · Problem to Solve We want to be able to predict the number of people that would

Process Data

§ Create dummy variables for season, weathersit, mnth, and weekday

§ Example: Turn the label ‘season’ into 4 labels ‘season1’, ‘season2’, ‘season3’, and ‘season4’.

§ Split data into training, validation, and testing sets

§ Last month is test data

§ Last 60 days before the last month of test data is the validation data

§ The rest of the data is training data.

Page 7: Bike Sharing Using Neural Networks - Emory Universitylxiong/cs378/share/project/12_late...2018/04/25  · Problem to Solve We want to be able to predict the number of people that would

Neural Network

Page 8: Bike Sharing Using Neural Networks - Emory Universitylxiong/cs378/share/project/12_late...2018/04/25  · Problem to Solve We want to be able to predict the number of people that would

Training and Validation Loss

§ If you train the network too long or have too many hidden nodes, it can become over fitting for training set. This means the loss on the validation set will begin to increase while the loss on the training set will decrease.

Page 9: Bike Sharing Using Neural Networks - Emory Universitylxiong/cs378/share/project/12_late...2018/04/25  · Problem to Solve We want to be able to predict the number of people that would

Build the Neural Network

§ Sigmoid function as activation function

§ Mean Squared Error (MSE) as error function

§ After multiple tests the hyperparameters for best results:

§ Iteration = 5000

§ Learning_rate = 0.5

§ Input_nodes = 56 (total number of features)

§ Hidden_nodes = 14

§ Output_nodes = 1

Page 10: Bike Sharing Using Neural Networks - Emory Universitylxiong/cs378/share/project/12_late...2018/04/25  · Problem to Solve We want to be able to predict the number of people that would

Training Loss vs Validation Loss

Page 11: Bike Sharing Using Neural Networks - Emory Universitylxiong/cs378/share/project/12_late...2018/04/25  · Problem to Solve We want to be able to predict the number of people that would

Prediction for December 2012

The prediction is not as accurate in the end, because the neural network may have more difficulty predicting accurate bike counts during holidays. Improvements would be to implement Recurrent Neural Networks which exhibit dynamic temporal behavior for a time sequence.