시작하기무료로 시작하기

Changing coefficients

With this understanding of the coefficients of a LogisticRegression() model, have a closer look at them to see how they change depending on what columns are used for training. Will the column coefficients change from model to model?

You should .fit() two different LogisticRegression() models on different groups of columns to check. You should also consider what the potential impact on the probability of default might be.

The data set cr_loan_clean has already been loaded into the workspace along with the training sets X1_train, X2_train, and y_train.

이 연습은 강의의 일부입니다

Credit Risk Modeling in Python

강의 보기

연습 안내

  • Check the first five rows of both X training sets.
  • Train a logistic regression model, called clf_logistic1, with the X1 training set.
  • Train a logistic regression model, called clf_logistic2, with the X2 training set.
  • Print the coefficients for both logistic regression models.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

# Print the first five rows of each training set
print(____.____())
print(____.____())

# Create and train a model on the first training data
____ = ____(solver='lbfgs').____(____, np.ravel(y_train))

# Create and train a model on the second training data
____ = ____(solver='lbfgs').____(____, np.ravel(y_train))

# Print the coefficients of each model
print(____.____)
print(____.____)
코드 편집 및 실행