Get startedGet started for free

Predicting hotel bookings

You just got a job at a hospitality research company, and your first task is to build a model that predicts whether or not a hotel stay will include children. To train your model, you will rely on a modified version of the hotel booking demands dataset by Antonio, Almeida, and Nunes (2019). You are restricting your data to the following features:

features <- c('hotel', 'adults', 
              'children', 'meal',
              'reserved_room_type', 
              'customer_type', 
              'arrival_date')

The data has been loaded for you as hotels, along with its corresponding test and train splits, and the model has been declared as lr_model <- logistic_reg().

You will assess model performance by accuracy and area under the ROC curve or AUC.

This exercise is part of the course

Feature Engineering in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

lr_recipe <- 
  recipe(children ~., data = train) %>%
# Generate "day of the week", "week" and "month" features

  step_date(arrival_date, features = c(___, ___, ___)) %>%

# Create dummy variables for all nominal predictors
  step_dummy(___)
Edit and Run Code