2
$\begingroup$

I've noticed that when running a piece multiple times, the gbm produced (see below) produces slightly different results when viewing the summary.

Should that be expected? I.e. running gbm regression is not consistent?

file.gbm <- gbm(formula, data = my_data
            , distribution = 'bernoulli'
            , shrinkage = 0.01
            , n.minobsinnode = 30
            , interaction.depth = 3
            , n.trees = 500)
summary(file.gbm)
$\endgroup$

1 Answer 1

6
$\begingroup$

In GBM you have an option called bag.fraction. The help file specifies this as following:

the fraction of the training set observations randomly selected to propose the next tree in the expansion. This introduces randomnesses into the model fit. If bag.fraction<1 then running the same model twice will result in similar but different fits. gbm uses the R random number generator so set.seed can ensure that the model can be reconstructed.

The default setting in GBM is bag.fraction = 0.5. If you want your gbm call to return the same result, use set.seed before calling gbm.

$\endgroup$
1
  • $\begingroup$ In other words, this is stochastic gradient boosting if bag.fraction < 1? $\endgroup$
    – zthomas.nc
    Oct 28, 2016 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.