프로그래밍/부스트캠프 AI

[DKT] lgbm에 label을 feature로 넣으면...

2jun0 2023. 5. 12. 14:56

🧐 사건의 발달

nmf으로 latent feature를 만들어낸 후,  lgbm에 학습한 성능 보고를 하려 글을 쓰려던 참이였다.

아래와 같은 피쳐 대조군을 만들어 학습을 돌리고 

features:
  - KnowledgeTag
  - userID
  - Timestamp
  - testId
  - assessmentItemID
  - answerCode

 

아래와 같은 실험군을 돌릴려고 했다. (latent feature 추가)

features:
  - KnowledgeTag
  - userID
  - Timestamp
  - testId
  - assessmentItemID
  - answerCode
  - userLatentFactor1
  - userLatentFactor2
  - userLatentFactor3
  - assessmentLatentFactor1
  - assessmentLatentFactor2
  - assessmentLatentFactor3

 

암튼 그래서 대조군 부터 학습을 돌린 후, feature importance를 보러 wandb에 들어가 봤는데...

우연히 아래와 같은 결과를 보게 되었다.

모델이 항상 1로만 예측을 하고 있다.

 

📝 왜 그럴까? - 로그 분석

아래 로그를 보면 [LightGBM] [Warning] No further splits with positive gain, best gain: -inf라는 부분이 문제인 것 같아 보인다.

이게 무슨 의미인지는 잘 모르지만 -inf는 비정상적인것 같다.

[LightGBM] [Info] Number of positive: 1188378, number of negative: 624897
[LightGBM] [Warning] Auto-choosing row-wise multi-threading, the overhead of testing was 0.008463 seconds.
You can set `force_row_wise=true` to remove the overhead.
And if memory is not enough, you can set `force_col_wise=true`.
[LightGBM] [Info] Total Bins 1276
[LightGBM] [Info] Number of data points in the train set: 1813275, number of used features: 6
[LightGBM] [Info] [binary:BoostFromScore]: pavg=0.655377 -> initscore=0.642758
[LightGBM] [Info] Start training from score 0.642758
[LightGBM] [Warning] No further splits with positive gain, best gain: -inf
Training until validation scores don't improve for 5 rounds
[LightGBM] [Warning] No further splits with positive gain, best gain: -inf
[LightGBM] [Warning] No further splits with positive gain, best gain: -inf

 

알고보니 트리를 나눌 수 없다.. 는 뜻이였다.

트리 전문가 프로도

 

🚀 해결

알고보니 모델에 직접 answerCode를 넣어주는 것이 문제였다.

답지를 주고 답을 맞추라고 한다니.. 말이 안된다 하하