For this recipe, we will implement logistic regression to predict the probability of low birthweight.
Logistic regression is a way to turn linear regression into a binary classification. This is accomplished by transforming the linear output in a sigmoid function that scales the output between zero and 1. The target is a zero or 1, which indicates whether or not a data point is in one class or another. Since we are predicting a number between zero or 1, the prediction is classified into class value 1''' if the prediction is above a specified cut off value and class
0 otherwise. For the purpose of this example, we will specify that cut off to be
0.5, which will make the classification as simple as rounding ...