계수 변화 살펴보기
LogisticRegression() 모델의 계수에 대해 이해했으니, 어떤 열로 학습하느냐에 따라 계수가 어떻게 달라지는지 더 자세히 살펴보세요. 모델마다 열의 계수가 달라질까요?
서로 다른 열 그룹으로 두 개의 LogisticRegression() 모델을 .fit() 해서 확인해 보세요. 또한 이는 부도 확률(probability of default)에 어떤 영향을 줄 수 있을지도 생각해 보세요.
데이터 세트 cr_loan_clean과 학습용 세트 X1_train, X2_train, y_train은 이미 작업 공간에 로드되어 있습니다.
이 연습은 강의의 일부입니다
Python으로 배우는 신용 리스크 모델링
연습 안내
- 두
X학습 세트의 첫 5개 행을 확인하세요. X1학습 세트로clf_logistic1라는 이름의 로지스틱 회귀 모델을 학습하세요.X2학습 세트로clf_logistic2라는 이름의 로지스틱 회귀 모델을 학습하세요.- 두 로지스틱 회귀 모델의 계수를 출력하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# 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(____.____)