Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to suppress CatBoost iteration results?

I am trying to use CatBoost to fit a binary model. When I use the following code, I thought verbose=False can help to suppress the iteration logs. But it didn't. Is there a way to avoid print the iterations?

model=CatBoostClassifier(iterations=300, depth=6, learning_rate=0.1, 
loss_function='Logloss',
         rsm = 0.95, 
         border_count = 64, 
         eval_metric =  'AUC', 
         l2_leaf_reg= 3.5, 
         one_hot_max_size=30, 
         use_best_model = True,
         verbose=False,
         random_seed = 502)

model.fit(X_train, y_train,
     eval_set=(X_test_filtered, y_test_num),   
     verbose = False,
     plot=True)

enter image description here

like image 227
Gavin Avatar asked Jun 30 '18 02:06

Gavin


People also ask

How do I stop CatBoost Overfitting?

CatBoost has built-in parameters to reduce overfitting The following parameters in both CatBoostClassifier() and CatBoostRegressor() classes and their fit() method can be used to reduce the overfitting of the model.

What is verbose in CatBoost?

'Verbose' is the default logging mode. It's the same as verbose=True or silent=False .

How many iterations does CatBoost have?

After importing the CatBoost Library we will create our model, now let's go through those parameters. Iterations: 1000 iterations means the CatBoost algorithm will run 1000 times to minimize the loss function.

How do you get feature important in CatBoost?

To get this feature importance, catboost simply takes the difference between the metric (Loss function) obtained using the model in normal scenario (when we include the feature) and model without this feature (model is built approximately using the original model with this feature removed from all the trees in the ...


1 Answers

CatBoost has several parameters to control verbosity. Those are verbose, silent and logging_level.

By default logging is verbose, so you see loss value on every iteration. If you want to see less logging, you need to use one of these parameters. It's not allowed to set two of them simultaneously.

silent has two possible values - True and False.

verbose can also be True and False, but it also can be an integer. If it is an integer N, then logging will be printed out each N-th iteration.

logging_level can be 'Silent', 'Verbose', 'Info' and 'Debug':

  • 'Silent' means no output to stdout (except for important warnings) and is same as silent=True or verbose=False.
  • 'Verbose' is the default logging mode. It's the same as verbose=True or silent=False.
  • 'Info' prints out the trees that are selected on every iteration.
  • 'Debug' prints a lot of debug info.

There are two places where you can use these parameters. The first one is model creation. The second one is fitting of the created model. If you have used a parameter when creating the model then it will be used during fitting if no parameter in fit function is specified.

If you use parameter in fit function then the mode selected by this parameter will be used.

In your case it looks like you have encountered a bug. The next time you see some bug, the best thing is to report to CatBoost team using issues on the GitHub page. This bug should have already been fixed, so try upgrading to the latest version or build code from source.

like image 151
Anna Veronika Dorogush Avatar answered Sep 16 '22 12:09

Anna Veronika Dorogush