반응형

다음 두가지 XGBoost Warning을 해결하는 방법을 다룹니다.



2022. 4. 14  최초작성




WARNING: C:/Users/Administrator/workspace/xgboost-win64_release_1.3.0/src/learner.cc:1061: Starting in XGBoost 1.3.0, the default evaluation metric used with the objective 'binary:logistic' was changed from 'error' to 'logloss'. Explicitly set eval_metric if you'd like to restore the old behavior.

 

eval_metric='mlogloss'를 추가하여 해결됩니다. 



 UserWarning: The use of label encoder in XGBClassifier is deprecated and will be removed in a future release. To remove this warning, do the following: 1) Pass option use_label_encoder=False when constructing XGBClassifier object; and 2) Encode your labels (y) as integers starting with 0, i.e. 0, 1, 2, ..., [num_class - 1].

  warnings.warn(label_encoder_deprecation_msg, UserWarning)

 

use_label_encoder =False 추가하여 해결됩니다.




예로 들면 다음처럼 코드에 추가할 수 있습니다.

model = XGBClassifier(eval_metric='mlogloss', use_label_encoder =False)



반응형

문제 발생시 지나치지 마시고 댓글 남겨주시면 가능한 빨리 답장드립니다.

도움이 되셨다면 토스아이디로 후원해주세요.
https://toss.me/momo2024


제가 쓴 책도 한번 검토해보세요 ^^

+ Recent posts