Building a regression model using scikit-learn

The previous section showed us an example of a classification model using scikit-learn. In this section, we will train a random forest model and use it to make predictions. We will also be building a classification model as the target variable in this scenario. This will be a categorical value that depicts the drinking habits of teenagers.

To do this, we first load the students dataset from the previous chapter. We will then train a logistic regression model and take a look at how to evaluate the classification model at a very basic level.

To begin, we load the libraries and import the students dataset and make some transformations to it, just as we did in the previous section. Our goal is to ...

Get Become a Python Data Analyst now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.