LoslegenKostenlos loslegen

Predicting whether a new customer will churn

As you saw in the video, to train a model using sklearn:

from sklearn.svm import SVC
  • Instantiate it:
svc = SVC()
  • Train it, or "fit it", to the data:
svc.fit(telco['data'], telco['target'])

Here, the first argument consists of the features, while the second argument is the label that we are trying to predict - whether or not the customer will churn. After you've fitted the model, you can use the model's .predict() method to predict the label of a new customer.

This process is true no matter which model you use, and sklearn has many! In this exercise, you'll use LogisticRegression.

Diese Übung ist Teil des Kurses

Marketing Analytics: Predicting Customer Churn in Python

Kurs anzeigen

Interaktive Übung

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

# Import LogisticRegression
Code bearbeiten und ausführen