Overview
A supervised-learning notebook over a 130k-row airline passenger survey: cleaning, PCA and K-means segmentation, then five classifiers tuned by grid search and compared on accuracy, macro F1 and the train-test gap.
The data is 103,904 training rows and 25,976 test rows, 24 columns wide. Some columns describe the passenger and the trip (age, customer type, class, distance, delays), and the rest are 1–5 ratings of individual services: wifi, boarding, seat comfort, entertainment, leg room, check-in, cleanliness. The label is binary: satisfied, or neutral and dissatisfied.
Two different questions are asked of it. Who are these passengers, which is unsupervised and gets PCA and K-means; and can satisfaction be predicted, which is supervised and gets the classifiers. Reporting the train-test gap alongside accuracy is deliberate: a model that wins on the training set and loses on the test set has not learned the survey, it has memorised it.
Random Forest and SVM come out on top, at 96.3% and 96.1% test accuracy, with the decision tree close behind at 95.6%. The two linear models fall well short of that: logistic regression at 87.1%, the perceptron at 83.2%. That gap is itself the finding — this problem rewards a model that can bend, not one that can only draw a line through it.
Project 3 of 3 for the Artificial Intelligence course at the Universitat de les Illes Balears, the one on supervised learning.
pythonmachine-learningdata-analysis