import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import linear_modelfrom sklearn.impute import SimpleImputer
from sklearn import linear_model
from sklearn.tree import DecisionTreeRegressor
from sklearn.inspection import permutation_importance
ISABELLE GALLUCCI, LILI MCGUFFEY, KELLAN MEYER, EVELYN TOLLAR, GABE WALTER
Use logistic regression to predict the satisfaction of a customer based on specific categories. We will have to train out model many times to see whats best fit
df = pd.read_csv("airlines.csv")
df
satisfaction | Customer Type | Age | Type of Travel | Class | Flight Distance | Seat comfort | Departure/Arrival time convenient | Food and drink | Gate location | ... | Online support | Ease of Online booking | On-board service | Leg room service | Baggage handling | Checkin service | Cleanliness | Online boarding | Departure Delay in Minutes | Arrival Delay in Minutes | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | satisfied | Loyal Customer | 65 | Personal Travel | Eco | 265 | 0 | 0 | 0 | 2 | ... | 2 | 3 | 3 | 0 | 3 | 5 | 3 | 2 | 0 | 0.0 |
1 | satisfied | Loyal Customer | 47 | Personal Travel | Business | 2464 | 0 | 0 | 0 | 3 | ... | 2 | 3 | 4 | 4 | 4 | 2 | 3 | 2 | 310 | 305.0 |
2 | satisfied | Loyal Customer | 15 | Personal Travel | Eco | 2138 | 0 | 0 | 0 | 3 | ... | 2 | 2 | 3 | 3 | 4 | 4 | 4 | 2 | 0 | 0.0 |
3 | satisfied | Loyal Customer | 60 | Personal Travel | Eco | 623 | 0 | 0 | 0 | 3 | ... | 3 | 1 | 1 | 0 | 1 | 4 | 1 | 3 | 0 | 0.0 |
4 | satisfied | Loyal Customer | 70 | Personal Travel | Eco | 354 | 0 | 0 | 0 | 3 | ... | 4 | 2 | 2 | 0 | 2 | 4 | 2 | 5 | 0 | 0.0 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
129875 | satisfied | disloyal Customer | 29 | Personal Travel | Eco | 1731 | 5 | 5 | 5 | 3 | ... | 2 | 2 | 3 | 3 | 4 | 4 | 4 | 2 | 0 | 0.0 |
129876 | dissatisfied | disloyal Customer | 63 | Personal Travel | Business | 2087 | 2 | 3 | 2 | 4 | ... | 1 | 3 | 2 | 3 | 3 | 1 | 2 | 1 | 174 | 172.0 |
129877 | dissatisfied | disloyal Customer | 69 | Personal Travel | Eco | 2320 | 3 | 0 | 3 | 3 | ... | 2 | 4 | 4 | 3 | 4 | 2 | 3 | 2 | 155 | 163.0 |
129878 | dissatisfied | disloyal Customer | 66 | Personal Travel | Eco | 2450 | 3 | 2 | 3 | 2 | ... | 2 | 3 | 3 | 2 | 3 | 2 | 1 | 2 | 193 | 205.0 |
129879 | dissatisfied | disloyal Customer | 38 | Personal Travel | Eco | 4307 | 3 | 4 | 3 | 3 | ... | 3 | 4 | 5 | 5 | 5 | 3 | 3 | 3 | 185 | 186.0 |
129880 rows × 22 columns