xgboost icon indicating copy to clipboard operation
xgboost copied to clipboard

[jvm-packages] return the best model after early stop

Open sonetto19999 opened this issue 1 year ago • 3 comments

Does xgboost4j-spark support to get the best model after early stop?

It seems it will get the model at that iteration which is best iteration + num_early_stopping_rounds, am i wrong? how could i get the best model? image

sonetto19999 avatar Sep 10 '24 15:09 sonetto19999

I guess when predicting, you can specify how many trees to be used. But currently, xgboost4j has not supported specifying the tree limit. I will make a PR for it.

wbo4958 avatar Sep 11 '24 06:09 wbo4958

Jvm doesn't support model slicing yet. @wbo4958 this might help https://github.com/dmlc/xgboost/blob/67c8c967845c05eb52e13bdee478db4cc37a0c09/demo/guide-python/individual_trees.py#L61 .

trivialfis avatar Sep 13 '24 13:09 trivialfis

Cool, looks like it's doable.

wbo4958 avatar Sep 13 '24 23:09 wbo4958