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

Multivariate logistic regression

Generally, you won't use only loan_int_rate to predict the probability of default. You will want to use all the data you have to make predictions.

With this in mind, try training a new model with different columns, called features, from the cr_loan_clean data. Will this model differ from the first one? For this, you can easily check the .intercept_ of the logistic regression. Remember that this is the y-intercept of the function and the overall log-odds of non-default.

The cr_loan_clean data has been loaded in the workspace along with the previous model clf_logistic_single.

Bu egzersiz

Credit Risk Modeling in Python

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

Egzersiz talimatları

  • Create a new X data set with loan_int_rate and person_emp_length. Store it as X_multi.
  • Create a y data set with just loan_status.
  • Create and .fit() a LogisticRegression() model on the new X data. Store it as clf_logistic_multi.
  • Print the .intercept_ value of the model

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Create X data for the model
X_multi = ____[[____,____]]

# Create a set of y data for training
y = ____[[____]]

# Create and train a new logistic regression
clf_logistic_multi = ____(solver='lbfgs').____(____, np.ravel(____))

# Print the intercept of the model
print(____.____)
Kodu Düzenle ve Çalıştır