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

Can't build some models using only one predictor #102

Closed
pabloriul opened this issue Sep 18, 2022 · 3 comments
Closed

Can't build some models using only one predictor #102

pabloriul opened this issue Sep 18, 2022 · 3 comments
Labels
bug Something isn't working external problem Issue coming from external source (code, computer, ...)

Comments

@pabloriul
Copy link

Dear Maya,

I can't get a model using only one predictor for MAXENT.Phillips, MAXENT.Phillips.2 and GBM. Tried using the GuloGulo example as follows:

First attempt was subsetting the stack for one raster

myFiles <- paste0('external/bioclim/current/bio', c(3, 4, 7, 11, 12), '.grd')

myExpl <- raster::stack(system.file(myFiles, package = 'biomod2'))

myExpl <- myExpl[[1]]

Second attempt was loading only one raster

myFiles <- paste0('external/bioclim/current/bio3.grd')

myExpl <- raster(system.file(myFiles, package = 'biomod2'))

Third attempt was stacking the single file

myFiles <- paste0('external/bioclim/current/bio3.grd')

myExpl <- raster::stack(system.file(myFiles, package = 'biomod2'))

Maxent models returns

Model=MAXENT.Phillips (maxnet)
> MAXENT.Phillips modeling...Error in apply(pdata, 1, function(rr) !any(apply(ndata, 1, function(r) identical(r, :
dim(X) must have a positive length
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'object' in selecting a method for function 'predict': object 'model.bm' not found

GBM models returns

GBM modeling...CV: 1
Error in x[i.train, , drop = TRUE][i, , drop = FALSE] :
incorrect number of dimensions
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'object' in selecting a method for function 'predict': object 'model.bm' not found

In both cases they can't find model.bm.

Do you have any idea whats going on?

Thank you

Pablo Riul

@rpatin
Copy link
Contributor

rpatin commented Sep 19, 2022

Hello Pablo,
Thank you for reporting the bugs.
I could reproduce the bugs and I think the problems come respectively from maxnet and gbm packages. The three attempt you did at building a single-layer explanatory variables looked all OK.
I tried to correct the bug within the maxnet and gbm packages and created pull-request accordingly, but I do not know when the changes will be accounted for in their respective packages.
Meanwhile you can try to use the forked version of their packages in my repository:
devtools::install_github("rpatin/maxnet")
devtools::install_github("rpatin/gbm")
Let us know if you encounter additional problems with this.
Rémi

@rpatin rpatin added the external problem Issue coming from external source (code, computer, ...) label Sep 19, 2022
@pabloriul
Copy link
Author

Dear Rémi,

Thank you very much for your quick reply! Its working fine now.

Cheers,

Pablo

@rpatin
Copy link
Contributor

rpatin commented Sep 26, 2022

maxnet was updated so installation can now be done directly from their official repo:
devtools::install_github("mrmaxent/maxnet")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working external problem Issue coming from external source (code, computer, ...)
Projects
None yet
Development

No branches or pull requests

3 participants