LogisticRegression 함수 모음

Gi Woon Lee·2024년 8월 22일
0

TIL

목록 보기
41/78

LogisticRegression 함수 모음

속성attributes 를 한번에 보기 위한 함수 생성

def getattributes(x):
print(f"클래스Y의 종류: {x.classes
}")
print(f"독립변수(X)의 개수: {x.nfeatures_in}")
print(f"들어간 독립변수(X)의 개수: {x.featurenames_in}")
print(f"가중치: {x.coef[0][0]}")
print(f"절편: {x.intercept
[0]}")

평가를 위한 함수 생성 / 평가지표는 정답과 예측값이 인자로 들어가는게 공통이다.

def get_metrics(true, predict):
print(f'정확도: {accuracy_score(true, predict)}')
print(f'f1_score: {f1_score(true,predict)}')

두고두고 사용하면 될 것이다.

0개의 댓글