Datasklr is a blog to provide examples of data science projects to those passionate about learning and having fun with data.

Logistic Regression – An Applied Approach Using Python

Logistic Regression – An Applied Approach Using Python

 
Screen Shot 2020-12-02 at 11.23.28 AM.png
 

Logistic Regression – An Applied Approach Using Python

The book is a showcase of logistic regression theory and application of statistical machine learning with Python.  Topics include logit, probit, and complimentary log-log models with a binary target as well as multinomial regression.  A section about contingency tables is also provided.   Scikit-Learn and statsmodels are the two Python packages used to illustrate how to tune parameters for better fit and accuracy. 

 

Table of Contents

1. Foreword 3-4
2. Binary Logistic Regression 5-19
Introduction 5
OLS Regression vs. a Problem with a Binary Outcome? 6
Odds and odds ratios 9
The logit model 11
Estimating the Logit Model 12
Scikit-Learn and Statsmodels API 13
3. Machine Learning and Binary Logistic Regression 20-45
Introduction 20
Evaluating Estimator Performance 20
Test Accuracy 22
ROC Curve 26
Precision-recall Curve 28
Issues with Convergence 28
Issues with Multicollinearity 30
Parameter Tuning 33
Parameter Tuning with GridSearch (GridSearchCV) 36
Additional Goodness-of-Fit Statistics 39
4. Probit and Complimentary Log-Log Models for Binary Regression 46-48
Introduction to Alternatives to Logit Models 46
Probit Mean Response Function 46
The Logistic Mean Response Function 47
Complementary Log-Log Response Function 47
5. Multinomial Logistic Regression 49-57
Introduction 49
Multinomial Logit 49
6. Contingency Tables 58-79
Introduction 58
Notation in Contingency Tables 59
Independence and Association 62
Cumulative Odds Ratios 68
Symmetry and Homogeneity 70
Working with 2X2 Tables 73
Stratified 2X2 Tables 75
Fisher Exact Test for Small Samples 78
Multinomial Logistic Regression

Multinomial Logistic Regression

0