I have the following code:
from xgboost import XGBClassifier
print(df_train.shape)
print(df_train_labels.shape)
clf = clf.fit(df_train, df_train_labels, verbose=True)
print("after fit")
Here df_train
and df_train_labels
are pandas which I read from a CSV.
The above code prints:
(1460, 7)
(1460,)
However, nothing else is printed for 10 minutes which means the code is stuck at clf.fit
so I'm assuming the algorithm shouldn't spend a long time on this.
As you can see, there are only 1460
examples, so I'm assuming the algorithm shouldn't spend a long time on this.
Furthermore, since I passed verbose=True
, I would have expected the model to print some output, but that is not happening.
Any idea why there is no output printed and why XGBClassifier
takes such a long time?
Looking at the documentation: https://xgboost.readthedocs.io/en/latest/python/python_api.html#module-xgboost.sklearn
It looks like the parameter for printing the progress is called verbosity. Set it to anything from 0-3 (3 for debug).
from xgboost import XGBClassifier
model = XGBClassifier()
setattr(model, 'verbosity', 2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With