March 2019
Beginner to intermediate
464 pages
10h 57m
English
The last Python exercise that we are going to do in this chapter involves combining continuous and categorical variables for our regression analysis. We can fit a logistic regression model by using both categorical and continuous variables, as shown in the following code:
logit = sm.Logit( df['Engaged'], df[['Customer Lifetime Value', 'Income', 'Monthly Premium Auto', 'Months Since Last Claim', 'Months Since Policy Inception', 'Number of Open Complaints', 'Number of Policies', 'Total Claim Amount', 'GenderFactorized', 'EducationFactorized' ]])logit_fit = logit.fit()
The only difference from the previous codes is the features that we selected to fit a logistic regression model. As you can see ...
Read now
Unlock full access