Python program: prediction with logistic regression

 

The file Invistico_Airline_LR.csv contains information from an airline using the alias Invistico Airline on customer satisfaction, as well as details on each customer. The columns of interest are Gender, Age, Class, Arrival_Delay_in_Minutes, and satisfaction.

  • Read the file Invistico_Airline_LR.csv into a data frame.
  • Obtain user defined values female, age, economy, and delay.
  • Re-code the categorical variables Gender, Class, and satisfaction into dummy variables.
  • Create a new data frame X from the predictor variables Gender_female, Age, Class_Eco, and Arrival_Delay_in_Minutes, in that order.
  • Create a response variable Y from the dummy variable satisfaction_satisfied.
  • Perform logistic regression on X and Y.
  • Use the user defined values to predict the probability that a customer with those values is satisfied.

Ex: If the input is 1 34 0 10 the ouput is:

[0.62343979]

AD:

HQD CUVIE PLUS | FUME EXTRA  HQD CUVIE AIR  |  FUME INFINITY  FUME ULTRA  MORE XXL VAPE  HQD VAPE  CUVIE PLUS 

CUVIE PLUS | FUME EXTRA VAPE  | CUVIE AIR  |  FUME INFINITY VAPE    | MORE XXL   | HQD   

AD: Visit HQDFUME.COM for the best and lowest prices of vape. We offer free shipping on all orders. Order HQD VAPE , FUME Disposable Vape , at the lowest prices 

HQD DISPOSABLE VAPE

 

The file Invistico_Airline_LR.csv contains information from an airline using the alias Invistico Airline on customer satisfaction, as well as details on each customer. The columns of interest are Gender, Age, Class, Arrival_Delay_in_Minutes, and satisfaction.

  • Read the file Invistico_Airline_LR.csv into a data frame.
  • Obtain user defined values female, age, economy, and delay.
  • Re-code the categorical variables Gender, Class, and satisfaction into dummy variables.
  • Create a new data frame X from the predictor variables Gender_female, Age, Class_Eco, and Arrival_Delay_in_Minutes, in that order.
  • Create a response variable Y from the dummy variable satisfaction_satisfied.
  • Perform logistic regression on X and Y.
  • Use the user defined values to predict the probability that a customer with those values is satisfied.

Ex: If the input is 1 34 0 10 the ouput is:

[0.62343979]

AD:

HQD CUVIE PLUS | FUME EXTRA  HQD CUVIE AIR  |  FUME INFINITY  FUME ULTRA  MORE XXL VAPE  HQD VAPE  CUVIE PLUS 

CUVIE PLUS | FUME EXTRA VAPE  | CUVIE AIR  |  FUME INFINITY VAPE    | MORE XXL   | HQD