Lesson 5 ❮ Lesson List ❮ Top Page
5.1 Preprocessing with sklearn
❯ 5.3 Logistic Regression
⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺
EXPECTED COMPLETION TIME
❲▹❳ Video 10m 10s
☷ Interactive readings 5m
Splitting the Data
First, we preprocessed the data by converting categorical columns into numerical using get_dummies. Then, we separate the data into train and test data. The reset_index is used to assure that all the index start from 0.
Making the model
Logistic regression is similar to linear regression, with the only difference being the y data, which should contain integer values indicating the class relative to the observation.
Predicting the Target Variable
In contrast to linear regression, logistic regression doesn't just output the resulting class but also estimates the probability of the observation's being part of all three classes.