Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gbm.step unable to fit some models #30

Open
ggrittz opened this issue Sep 12, 2022 · 1 comment
Open

gbm.step unable to fit some models #30

ggrittz opened this issue Sep 12, 2022 · 1 comment

Comments

@ggrittz
Copy link

ggrittz commented Sep 12, 2022

Hello,

I've been using dismo gbm function gbm.step with the following hyperparameters:

brt <- gbm.step(data = train,
                          gbm.x = 5:9, # column indices for covariates
                          gbm.y = 4, # column index for response (presence-absence)
                          family = "bernoulli",
                          tree.complexity = ifelse(prNum < 50, 1, 5),
                          learning.rate = 0.001,
                          bag.fraction = 0.75,
                          max.trees = 10000,
                          n.trees = 50,
                          n.folds = 5, # 5-fold cross-validation
                          silent = TRUE) # avoid printing the cv results

The issue that I am encountering is related (I think) to the max.trees parameter or n.trees parameter. Species with low prevalence (20~30 presences out of 449 absences) return the following error:

Error in UseMethod("predict") :
no applicable method for 'predict' applied to an object of class "NULL"
In addition: There were 50 or more warnings (use warnings() to see the first 50)

The model brt becomes NULL and my loop stops because of that. I tried to use ifelse for those species, changing the number of max.trees to 50, and it worked for some of them, but not all. Any idea about what is happening here? I haven't found anything like this on the internet. If needed, I can upload my script and rds files. Thanks!

@ggrittz ggrittz changed the title gbm.step not able to predict gbm.step unable to fit some models Sep 12, 2022
@ggrittz
Copy link
Author

ggrittz commented Sep 12, 2022

Oh, another weird thing is that even if I am using ifelse, the models for those low prevalence species are generated with much more than 50 max.trees. But, if I don't use ifelse, the error returns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant