Taxi Tip Predictor

Leslie Bogdan (2/3/2018)

What Does it Do? Purpose of the 'Taxi Tip Predictor App' is to allow the user to change variable values in the interface and then plot / return the estimated tips that a taxi driver could expect per mile in different community areas around Chicago.

Underneath the interface is a linear regression model which has been evolved from Chicago taxi data found on Kaggle.

Prediction model is then joined by way of the shiny app interface so users can pass variable values to return prediction values.

Inputs

Variables which can be modified / passed by the user

  • Miles of fare
  • Payment Type
  • Time of the Fare (closest hour)
  • Fare Amount
  • Day of the Week

Outputs and Model

Outputs Once the user is happy with the variable values, they press the 'Prediction' button and then

  • A geographical map of the 8 community areas considered appears / updates with coloured circles (as markers) appearing to denote the level of expected tips based on the variable values passed.
  • Table under the map is generated depicting the 8 community areas and the expected tips per mile values.

Model Linear model evolved from the Chicago Taxi data set, below is an R code example of passing values to the predict() function and returning an estimated tips per mile figure.

Example: Passing values to the predict() function

eg_hour<-'13'
eg_fare <- 90
eg_day <- 'Saturday'
eg_miles <- 18
eg_community <- '24'
eg_payment <- 'Cash'
les_test1<-data.frame(as.factor(eg_hour),as.numeric(eg_fare),as.factor(eg_day),as.factor(eg_payment),as.factor(eg_community),as.numeric(eg_miles))
names(les_test1)<-c('hour','fare','day_of_week','payment_type','pickup_community_area','trip_miles')
predict(model,les_test1)
       1 
6.638269 

What happens in the App?

Users interact with the variable values by way of widgets.

When they are ready to display the predicted tips per mile for each community area they press the 'PRESS to Plot the Prediction' button.

A geospatial map appears with colour coded circles indicating the expected tips per community area.

A supporting table also appears displaying the names of each community area and predicted tips per mile value.