1 of 9

Predictive Modeling of Customer Bookings

By Caecilia A Rahman

Click here to see the Jupyter Notebook

2 of 9

TABLE OF CONTENTS

FEATURE IMPORTANT

​

EXPLORATORY DATA

PRINCIPAL COMPONENT ANALYSIS

RANDOM FOREST CLASSIFIER

& LOGISTIC REGRESSION

RESULT

03

01

02

04

05

to identify and prioritize the most relevant features in a dataset.

inspecting, cleaning and preprocessing the data

To reduce unnecessary variable(s).

Create model that fits the most based on data

Defining a model that fits data based on the evaluation

3 of 9

DATA

The data given is customer booking, we will create a model to predict the customer completed the booking based on their search and other attributes associated with that user event.

4 of 9

01 | EXPLORATORY DATA

Inspecting Data

Conduct an exploration of the data with the objective of ascertaining the variables present within the dataset.

Pre processing Data

Converting the contents of a string variable into float format in order to facilitate its processing.

5 of 9

02 | PRINCIPAL COMPONENT ANALYSIS

Principal component analysis (PCA) is a popular technique for analyzing large datasets containing a high number of dimensions/features per observation, increasing the interpretability of data while preserving the maximum amount of information, and enabling the visualization of multidimensional data.

It can be observed from the graph that the % Variance Explained increases as the 11 variables are included, therefore we will be utilizing the 11 variables

6 of 9

03 | FEATURE IMPORTANCE

Here's the variables:

num_passengers (f0), sales_channel (f1), trip_type (f2), purchase_lead (f3), length_of_stay (f4), flight_hour (f5), flight_day (f6), wants_extra_baggage (f7), wants_preferred_seat (f8), wants_in_flight_meals (f9), and flight_duration f(10).

​

We can see that the plot shows f3 (purchase_lead) has the highest importance and f(2) trip_type has the lowest importance.

​

as we can see, the accuracy is still high if we keep all the 11 variables just like PCA, so it is better to keep the 11 variables

7 of 9

04 | RANDOM FOREST CLASSIFIER &

LOGISTIC REGRESSION

A random forest is a meta estimator that fits a number of decision tree classifiers on various sub-samples of the dataset and uses averaging to improve the predictive accuracy and control over-fitting.

8 of 9

04 | RANDOM FOREST CLASSIFIER &

LOGISTIC REGRESSION

Logistic regression is modelling the probability of a discrete outcome given an input variable. The most common logistic regression model is a binary outcome. In this case, it’s booking completed by customer (0) if the customer didn’t complete the booking process and (1) if the customer completed the booking process

9 of 9

05 | RESULT

  • Based on PCA and Feature Importance with 84.59% accuracy it’s better to keep all the 11 variables.

​

  • Both evaluation outputs, we can see that the average cross-validation score for both models is similar, with the logistic regression model having a slightly higher score of 0.8507 compared to the random forest model's score of 0.8477. However, the accuracy of the test set for the logistic regression model is also slightly higher than the random forest model, with a score of 0.8498 compared to 0.8472.

​

  • Additionally, we can look at the classification report for each model. The random forest model has a higher precision and recall for the majority class (0), but performs poorly on the minority class (1) with a precision and recall of only 0.44 and 0.06, respectively. On the other hand, the logistic regression model has perfect precision for the minority class (1), but a lower recall of 0.00. This means that the logistic regression model correctly identifies all instances of the minority class, but may miss some instances.

​

  • Logistic regression model appears to be the better choice as it has higher accuracy on the test set and performs better in the minority class.

​

​