Predictive Analysis
This part of the project was made on a different dataset provided directly by British Airways and including data from booking information. The aim was to build a model which would predict if a customer will book a flight or not. In addition to that we would like to understand which of the features in the dataset contribute most to this choice.
After loaded our dataset in a Pandas DataFrame we checked some information, in particular the labels' distribution. Here we find quite a problem because the distribution is extremely skewed, with a majority of negative labels. So we followed this steps:
- After pre-processing the data to train our model, we firstly tried to built a ‘RandomForestClassifier’ and checked its performance, that was poor as we expected.
- So we searched for a solution to deal with unbalanced data and we find 'oversampling' practice to balance the distribution. Basically we randomly duplicate samples in the minor class (the positive one).
- Now we trained a new model on this expanded dataset and we saw a good improvement both in accuracy and f1 score. The confusion matrix here represent the performance of our new model on the test set.
Features Importance
After trained the right model we searched for the most important features that contributes most to the outcome. As we can see from the graph most important features are 'purchase_lead', `booking_origin`, and `route`.
On the other hand`sales_channel` and `trip_type` are not so important when a customer is booking a flight.