google / yggdrasil-decision-forests

A library to train, evaluate, interpret, and productionize decision forest models such as Random Forest and Gradient Boosted Decision Trees.
https://ydf.readthedocs.io/
Apache License 2.0
447 stars 49 forks source link

Can't use the `verbose=2` argument #93

Closed Draichi closed 1 month ago

Draichi commented 1 month ago

Hello,

Following the documentation, it shows that we can use the verbose argument when training:

Training logs can be shown during training with the verbose=2 argument, or after training with model.describe(). This is useful for debugging and understanding the training process.

But when I follow the example I get this error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[4], [line 1](vscode-notebook-cell:?execution_count=4&line=1)
----> [1](vscode-notebook-cell:?execution_count=4&line=1) model = ydf.GradientBoostedTreesLearner(label="income").train(train_ds, verbose=2)

TypeError: train() got an unexpected keyword argument 'verbose'

Am I doing something wrong or is there a problem in the documentation?

rlcauvin commented 1 month ago

From this documentation, it seems you set verbose globally:

save_verbose = ydf.verbose(0)  # Hide all logs
learner = ydf.RandomForestLearner(label="label")
model = learner.train(pd.DataFrame({"feature": [0, 1], "label": [0, 1]}))
ydf.verbose(save_verbose)  # Restore verbose level
achoum commented 1 month ago

The verbose train arguments has been introduced in https://github.com/google/yggdrasil-decision-forests/commit/2b3e21cbdf2892d3c3aa531ee3caa6376f0e00b1

It will be available in the next YDF release.