LoslegenKostenlos loslegen

Compute confusion matrix

As you learned in the video the logistic regression model generates two types of predictions, a continuous valued prediction, in the form of a probability, and a class prediction which in the example of the wells dataset is a discrete category with two classes.

In the previous exercise you computed the continuous values prediction in the form of a probability. In this exercise you will use those values to assign a class to each observation in your wells_test sample. Finally you will describe the model using the confusion matrix.

Computed predictions prediction and wells_test are loaded in your workspace.

Diese Übung ist Teil des Kurses

Generalized Linear Models in Python

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Define the cutoff
cutoff = ____

# Compute class predictions: y_prediction
y_prediction = np.where(____ > ____, 1, 0)
Code bearbeiten und ausführen