BaşlayınÜcretsiz Başlayın

Visualizing feature importances

Your random forest classifier from earlier exercises has been fit to the telco data and is available to you as clf. Let's visualize the feature importances and get a sense for what the drivers of churn are, using matplotlib's barh to create a horizontal bar plot of feature importances.

Bu egzersiz

Marketing Analytics: Predicting Customer Churn in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Calculate the feature importances of clf.
  • Use plt.barh() to create a horizontal bar plot of importances.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Calculate feature importances
importances = ____.____

# Create plot
____.____(range(X.shape[1]), ____)
plt.show()
Kodu Düzenle ve Çalıştır