CommencerCommencer gratuitement

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.

Cet exercice fait partie du cours

Feature Engineering in R

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de 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(___)
Modifier et exécuter le code