ghost
ghost

Reputation: 309

Python's XGBRegressor vs R's XGBoost

I'm using python's XGBRegressor and R's xgb.train with the same parameters on the same dataset and I'm getting different predictions.

I know that XGBRegressor uses 'gbtree' and I've made the appropriate comparison in R, however, I'm still getting different results.

Can anyone lead me in the right direction on how to differentiate the 2 and/or find R's equivalence to python's XGBRegressor?

Sorry if this is a stupid question, thank you.

Upvotes: 2

Views: 1679

Answers (1)

Kirill Dubovikov
Kirill Dubovikov

Reputation: 1486

Since XGBoost uses decision trees under the hood it can give you slightly different results between fits if you do not fix random seed so the fitting procedure becomes deterministic.

You can do this via set.seed in R and numpy.random.seed in Python.

Noting Gregor's comment you might want to set nthread parameter to 1 to achieve full determinism.

Upvotes: 1

Related Questions