1. Учиться
  2. /
  3. Courses
  4. /
  5. Introduction to Regression with statsmodels in Python

Connected

Exercise

Log odds

One downside to probabilities and odds for logistic regression predictions is that the prediction lines for each are curved. This makes it harder to reason about what happens to the prediction when you make a change to the explanatory variable. The logarithm of the odds (the "log odds" or "logit") does have a linear relationship between predicted response and explanatory variable. That means that as the explanatory variable changes, you don't see dramatic changes in the response metric - only linear changes.

Since the actual values of log odds are less intuitive than (linear) odds, for visualization purposes it's usually better to plot the odds and apply a log transformation to the y-axis scale.

mdl_churn_vs_relationship, explanatory_data, and prediction_data are available from the previous exercise.

Инструкции 1 / 2

undefined XP
    1
    2
  • Update prediction_data to add a log_odds column derived from odds.
  • Print the first five lines of prediction_data.