• 카테고리

    질문 & 답변
  • 세부 분야

    딥러닝 · 머신러닝

  • 해결 여부

    미해결

LightGBM Iteration관련

24.01.29 21:50 작성 조회수 109

0

안녕하세요

LightGBM Iteration관련 문의드립니다.

설명해 주신 코드로 작성하였으나 이터레이션마다 Score가 표시되지 않습니다

verbose를 100으로 설저했는데 다음과 같이만 조회됩니다.

이유가 무엇일까요?

LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 10 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 10 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 8 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 9 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 8 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 10 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 11 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 9 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 11 Early stopping, best iteration is: [902] training's binary_logloss: 0.210459 valid_1's binary_logloss: 0.242339

from lightgbm import LGBMClassifier


clf = LGBMClassifier(

        n_jobs=-1, # CPU성능

        n_estimators=1000, #1000개 tree

        learning_rate=0.02, #학습률 낮을수록 정교함

        num_leaves=32, # 가지치기 수

        subsample=0.8, #활용할 sample비중

        max_depth=12, #가지깊이

        verbose=100, #출력메세지 최소화

        early_stopping_rounds= 50,

        eval_metric= 'auc'

        )

clf.fit(train_X, train_y, eval_set=[(train_X, train_y), (valid_X, valid_y)])


 

답변 2

·

답변을 작성해보세요.

0

lightgbm 버전은 4.1.0 이며, 강의내용과는 다르게 (강의 내용이 훨씬 직관적입니다.) 다음과 같이 출력됩니다.

--> 중간과정은 보이는데 성능현황이 안보이구요,
Test결과도 loss위주로만 조회됩니다.
아마도 이강의 작성시점의 version과 지금 코랩 상용버전의 차이에서 파라미터의 변경이 있었던 것 같습니다. (제 추측입니다.)
[LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 10 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 10 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 8 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 9 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 8 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 10 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 11 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 9 [LightGBM] [Debug] Trained a tree with leaves = 32 and depth = 11 Early stopping, best iteration is: [902] training's binary_logloss: 0.210459 valid_1's binary_logloss: 0.242339

0

안녕하십니까,

먼저 lightgbm 버전을 알 수 있을까요?

import lightgbm

print(lightgbm.__version__) 하시면 됩니다.

 

감사합니다.

감사합니다. 선생님 열정과 친절함 너무 훌륭하세요 존경합니다. 제가 선생님의 여러 강의 덕분에 이 공부를 포기하지 않을수 있게 되었습니다. 기나긴 여정 함께할수 있어 너무 감사합니다.

LightGBM이 4.X 대로 업그레이드 되면서 사용법등이 많이 변경이 되었습니다.

강의에 동일한 결과를 위해서는 Lightgbm을 3.3.2 로 downgrade가 필요합니다.

아래와 같이 pip install lightgbm==3.3.2 로 downgrade해 주십시요.

섹션 0의 LightGBM 설치 및 구글 클라우드 사용 시 유의사항에 자막으로 해당 사항을 기재했습니다. 참조 부탁드립니다.