Deep Learning & Machine Learning/XGBoost

XGBoost Warning 해결 방법

webnautes 2023. 10. 18. 22:15
반응형

다음 두가지 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)



반응형