Aan de slagGa gratis aan de slag

Imbalanced class metrics

Class imbalance is something that can hamper your model's performance in any machine learning context. This is especially relevant in a machine learning interview if you are asked what to do if you are given a dataset with an imbalanced class, as some data is imbalanced by design such as insurance fraud data.

In this exercise you'll use sklearn to create a logistic regression model and print the confusion matrix along with several evaluation metrics to get a better understanding of how to interpret Machine Learning models from datasets that have a class imbalance.

Recall the class imbalance you saw previously in loan_data. The number of observations with Loan Status of Fully Paid far outweighs those that are Charged Off:

Class imbalance

Deze oefening maakt deel uit van de cursus

Practicing Machine Learning Interview Questions in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Import
from sklearn.____ import ____
from sklearn.____ import ____, ____, ____, ____, _____
Code bewerken en uitvoeren