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

Visualizing quantiles of acceptance

You know how quantile() works to compute a threshold, and you've seen an example of what it does to split the loans into accepted and rejected. What does this threshold look like for the test set, and how can you visualize it?

To check this, you can create a histogram of the probabilities and add a reference line for the threshold. With this, you can visually show where the threshold exists in the distribution.

The model predictions clf_gbt_preds have been loaded into the workspace.

Bu egzersiz

Credit Risk Modeling in Python

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

Egzersiz talimatları

  • Create a histogram of the predicted probabilities clf_gbt_preds.
  • Calculate the threshold for an acceptance rate of 85% using quantile(). Store this value as threshold.
  • Plot the histogram again, except this time add a reference line using .axvline().

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Plot the predicted probabilities of default
plt.____(____, color = 'blue', bins = 40)

# Calculate the threshold with quantile
____ = np.____(____, ____)

# Add a reference line to the plot for the threshold
plt.____(x = ____, color = 'red')
plt.____()
Kodu Düzenle ve Çalıştır