Member-only story
Understanding Logistic Regression step by step
Training a logistic regression classifier to predict people’s gender based on their weight and height.
Logistic Regression is a popular statistical model used for binary classification, that is for predictions of the type this or that, yes or no, A or B, etc. Logistic regression can, however, be used for multiclass classification, but here we will focus on its simplest application.
As an example, consider the task of predicting someone’s gender (Male/Female) based on their Weight and Height.
For this, we will train a machine learning model from a data set of 10,000 samples of people’s weight and height. The data set is taken from the Conway & Myles Machine Learning for Hackers book, Chapter 2, and can it can be directly downloaded here.
This is a preview of what the data looks like:
Each sample contains three columns: Height, Weight, and Male.
- Height in inches
- Weight in pounds
- Male: 1 means that the measurement corresponds to a male person, and 0 means…