MulaiMulai sekarang secara gratis

Training another scikit-learn model

All sklearn models have .fit() and .predict() methods like the one you used in the previous exercise for the LogisticRegression model. This feature allows you to easily try many different models to see which one gives you the best performance. To get you more confident with using the sklearn API, in this exercise you'll try fitting a DecisionTreeClassifier instead of a LogisticRegression.

Latihan ini adalah bagian dari kursus

Marketing Analytics: Predicting Customer Churn in Python

Lihat Kursus

Petunjuk latihan

  • Import DecisionTreeClassifier from sklearn.tree.
  • Instantiate the classifier, storing the result in clf.
  • Train the classifier to the data. The features are contained in the features variable, and the target variable of interest is 'Churn'.
  • Predict the label of new_customer.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Import DecisionTreeClassifier


# Instantiate the classifier


# Fit the classifier


# Predict the label of new_customer
print(____)
Edit dan Jalankan Kode