Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide warnings from xgboost library in jupyter?

Tags:

xgboost

Not working:

import warnings
warnings.filterwarnings('ignore')

The warning I get:

[14:24:45] WARNING: C:/Jenkins/workspace/xgboost-win64_release_0.90/src/objective/regression_obj.cu:152: reg:linear is now deprecated in favor of reg:squarederror.

It clutters my output in cell.

like image 855
kaban Avatar asked Oct 10 '19 08:10

kaban


Video Answer


2 Answers

Change the verbosity parameter verbosity = 0 in the model definition. The values it can take are: 0 - "silent", 1 - "warning", 2 - "info", 3 - "debug"

xgboost = xgb.XGBRegressor(objective ='reg:linear', verbosity = 0, random_state=42)

XGBoost Documentation

like image 104
ASHISH JETHANI Avatar answered Sep 17 '22 04:09

ASHISH JETHANI


Just add silent = True in the model's definition:

xgboost = xgb.XGBRegressor(random_state=42,silent=True)
like image 23
Aleksandra Afanaseva Avatar answered Sep 19 '22 04:09

Aleksandra Afanaseva