SCM

Forum: biomod2 package is now available !

Posted by: damien georges
Date: 2012-07-26 13:56
Summary: biomod2 package is now available !
Project: BioMod

Content:

Dear BIOMOD-users,

You were eagerly waiting for it, and we are happy to say that the new version of BIOMOD called biomod2 is now online on R-Forge.

Although we kept the same modelling philosophy than the former version (which we will still maintain for a while), we have made crucial changes. biomod2 is now fully object-oriented and made for running on a single species only (see vignette MultiSpeciesModelling for multi-species modelling at once). For advanced BIOMOD users, the new functions might be a bit disturbing at the beginning. Then, you will see that this new version is much more advanced and practical than the former ones. Among the novelties, the addition of MAXENT in the modelling techniques, a large range of evaluation metrics, a more refined definition of ensemble modelling and ensemble forecasting, the possibility to give presence-only data and environmental rasters to biomod2 and let it extract pseudo-absence data directly.

We have created several vignettes for you to get use to this new version and a figure explaining the different ways of giving data to BIOMOD.

Please bear in mind that R-Forge is a development platform, it means that this new package would experience repeated updating the next couple of weeks (correcting bugs, adding documentation, adding functionalities) so think about updating the package before each new study you will do.

Last but not least, all comments are welcome! If you find a bug, if you think some documentation points are unclear, if you think about new functionalities that may be useful, just let us know ASAP.

We count on you to help finalizing this new version to a very nice tool. We will then release it to CRAN by the end of July. Please remember to add your code, R-version, OS and BIOMOD-version every time you report a bug or a mistake in the vignette or help files.

Hoping you will enjoy this new version of BIOMOD.

With our best wishes,

Damien & Wilfried

Latest News

biomod2 is now devel on github

damien georges - 2020-03-02 17:08 -

biomod2 package is now available !

damien georges - 2012-07-26 13:56 -
...

 

Monitor Forum | Start New Thread Start New Thread
RE: Error in validObject(.Object) : invalid class “MARS_biomod2_model” object: FALSE [ Reply ]
By: typhaine rousteau on 2020-04-06 16:26
[forum:47548]
Dear Damien,

Now, it is working well!

Thank you!
All the best,

Typhaine

RE: Error in validObject(.Object) : invalid class “MARS_biomod2_model” object: FALSE [ Reply ]
By: damien georges on 2020-04-06 13:33
[forum:47536]
Hi all,

sorry for the reaction time lag..
This should be fixed in the latest version of biomod2 available on github (7b858b5)

please update the package devtools::install_github('biomodhub/biomod2') and dive it a try.

Cheers,
Damien

RE: Error in validObject(.Object) : invalid class “MARS_biomod2_model” object: FALSE [ Reply ]
By: typhaine rousteau on 2020-04-06 07:04
[forum:47529]
Dear Damien,

I have the same problem Justin has with MARS. I installed the new version of biomod2 with your command line:

devtools::install_github("biomodhub/biomod2", dependencies = TRUE)

I am getting this error message:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= AEGMON Data Formating -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

! No data has been set aside for modeling evaluation
> Pseudo Absences Selection checkings...
> random pseudo absences selection
> Pseudo absences are selected in explanatory variables
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Done -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Loading required library...

Checking Models arguments...

Creating suitable Workdir...

! Weights where automatically defined for AEGMON_PA1 to rise a 0.5 prevalence !
! Weights where automatically defined for AEGMON_PA2 to rise a 0.5 prevalence !
! Weights where automatically defined for AEGMON_PA3 to rise a 0.5 prevalence !
! Weights where automatically defined for AEGMON_PA4 to rise a 0.5 prevalence !
! Weights where automatically defined for AEGMON_PA5 to rise a 0.5 prevalence !


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= AEGMON Modeling Summary -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

3 environmental variables ( OPEN_5km OPEN_10km OPEN_20km )
Number of evaluation repetitions : 1
Models selected : MARS GLM GAM RF MAXENT.Phillips

Total number of model runs : 25

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


-=-=-=- Run : AEGMON_PA1


-=-=-=--=-=-=- AEGMON_PA1_Full

Model=Multiple Adaptive Regression Splines ( simple with no interaction )
Error in validObject(.Object) :
invalid class “MARS_biomod2_model” object: FALSE


With the old version of biomod also I get the error message.

Do you have any idea where this mistake might have come from?

All the best,

Typhaine

RE: Error in validObject(.Object) : invalid class “MARS_biomod2_model” object: FALSE [ Reply ]
By: Shabnam Shadloo on 2020-03-31 12:35
[forum:47528]
Dear Damien

I am facing the exact same error and I'm using the latest version of biomod2 available on git hub. All other methods that I tried worked.
Here are my codes.

setwd('D:/articles/mine/ShirinModelling/Shabnam')

#-------libraries---------
# library(devtools)
# library(ecospat)
# citation("ecospat")
library(biomod2)
citation("biomod2")
browseVignettes(package='biomod2')
library(rgdal)
library(dismo)
library(raster)
library(sp)
library(maptools)
library(MASS)
#library("spdep")
library(files)


#-----data preparing------
# dem
dem <- raster("ascii/dem.ASC")
dem <- resample(dem, dem, method="bilinear")
plot(dem)
# minValue(dem)
# dem


# slope
slope <- raster("ascii/slope.asc")
reslope <- resample(slope, dem, method="bilinear")
# minValue(reslope)
# reslope
# plot(reslope)


# bios
bio15 <- raster("ascii/bio15.asc")
rebio15 <- resample(bio15, dem, method="bilinear")
# minValue(rebio15)
# rebio15


bio08 <- raster("ascii/bio08.asc")
rebio08 <- resample(bio08, dem, method="bilinear")
# minValue(rebio08)
# rebio08


bio07 <- raster("ascii/bio07.asc")
rebio07 <- resample(bio07, dem, method="bilinear")
# minValue(rebio07)
# rebio07


#VRM
VRM <- raster("ascii/VRM.asc")
reVRM <- resample(VRM, dem, method="bilinear")
# minValue(reVRM)
# reVRM


#ndvi
NDVI <- raster("ascii/NDVI.asc")
reNDVI <- resample(NDVI, dem, method="bilinear")
# minValue(reNDVI)
# reNDVI


#residential areas
res_dens <- raster("ascii/res_dens.asc")
reres <- resample(res_dens, dem, method="bilinear")
# minValue(reres)
# reres


#roads
road_dis <- raster("ascii/road_dis.asc")
reroad <- resample(road_dis, dem, method="bilinear")
# minValue(reroad)
# reroad


layers <- stack(dem,
reslope,
rebio15,
rebio08,
rebio07,
reVRM,
reNDVI,
reres,
reroad)
head(layers)
layers
str (layers)


Occ <- read.csv(file = "points/PA.csv")
head (Occ)

rdraw <- 'rd'
rd <- as.numeric(unlist(Occ[,rdraw]))


XY <- Occ[,c("x","y")]


RdBiomodData <-BIOMOD_FormatingData(resp.var = Rd,
expl.var = layers,
PA.nb.absences = 1000,
PA.strategy = 'random',
resp.xy = XY,
resp.name = rdraw,
PA.nb.rep = 0)
RdBiomodData
# plot(RdBiomodData)


#------Modeling-------

RdBiomodOption <- BIOMOD_ModelingOptions (GBM = NULL,
MARS = NULL,
MAXENT.Phillips =
list (path_to_maxent.jar = getwd(),
maximumiterations = 200,
visible = FALSE,
linear = TRUE,
quadratic = TRUE,
product = TRUE,
threshold = TRUE,
hinge = TRUE,
lq2lqptthreshold = 80,
l2lqthreshold = 10,
hingethreshold = 15,
beta_threshold = -1,
beta_categorical = -1,
beta_lqp = -1,
beta_hinge = -1,
defaultprevalence = 0.5),
GAM = NULL,
GLM = NULL,
RF = list(ntree = 1000))

file.exists("maxent.jar")
list.files("")


RdBiomodModelOut <- BIOMOD_Modeling(RdBiomodData, models = c('MARS'),
models.options = RdBiomodOption,
NbRunEval=1,
DataSplit=75,
Prevalence=0.5,
VarImport=3,
models.eval.meth = c('TSS','ROC'),
modeling.id = paste(rdraw,"FirstModeling",sep=""))


Many thanks in advance.

RE: Error in validObject(.Object) : invalid class “MARS_biomod2_model” object: FALSE [ Reply ]
By: Lucretia O on 2020-03-25 23:49
[forum:47527]
Hello,

Was this problem ever solved? I am getting the same error with MARS. I tried downloading the latest version from github but it didn't seem to help.

Thanks!
Lucretia

RE: Error in validObject(.Object) : invalid class “MARS_biomod2_model” object: FALSE [ Reply ]
By: damien georges on 2020-03-02 17:06
[forum:47435]
Dear Justin,

Could you please try to install the latest version of biomod2 available
on git hub?

devtools::install_github("biomodhub/biomod2", dependencies = TRUE)


If the error persists could you please send me a reproducible and stand
alone example of the issue so I can have a closer look at it?

Best,
Damien

Error in validObject(.Object) : invalid class “MARS_biomod2_model” object: FALSE [ Reply ]
By: Justin Barker on 2020-02-28 18:55
[forum:47432]
I am stumped by this error:
Error in validObject(.Object) :
invalid class “MARS_biomod2_model” object: FALSE

All other algorithms work except MARS, which continues to fail and produce the error.

Originally, I thought it was an issue with my data but even using the example data in BIOMOD2, I get the same error. I have uninstalled and reinstalled the package as well as checked that each dependent package is correctly being installed.

Any advice would be appreciated. thank you.

Session Info:
R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base

other attached packages:
[1] reshape2_1.4.3 tidyr_1.0.2 dplyr_0.8.4 biomod2_3.4.6 raster_3.0-12
[6] rgdal_1.4-8 sp_1.4-0 earth_5.1.2 plotmo_3.5.6 TeachingDemos_2.10
[11] plotrix_3.7-7 Formula_1.2-3

loaded via a namespace (and not attached):
[1] viridisLite_0.3.0 splines_3.6.2 foreach_1.4.8 prodlim_2019.11.13
[5] assertthat_0.2.1 stats4_3.6.2 latticeExtra_0.6-29 ENMeval_0.3.0
[9] ipred_0.9-9 pillar_1.4.3 backports_1.1.5 lattice_0.20-38
[13] glue_1.3.1 pROC_1.16.1 RColorBrewer_1.1-2 checkmate_2.0.0
[17] randomForest_4.6-14 colorspace_1.4-1 recipes_0.1.9 gbm_2.1.5
[21] Matrix_1.2-18 plyr_1.8.5 timeDate_3043.102 pkgconfig_2.0.3
[25] maxnet_0.1.2 PresenceAbsence_1.1.9 caret_6.0-85 purrr_0.3.3
[29] scales_1.1.0 jpeg_0.1-8.1 gower_0.2.1 lava_1.6.6
[33] tibble_2.1.3 mgcv_1.8-31 mda_0.4-10 generics_0.0.2
[37] ggplot2_3.2.1 withr_2.1.2 nnet_7.3-12 hexbin_1.28.1
[41] lazyeval_0.2.2 rasterVis_0.47 survival_3.1-8 magrittr_1.5
[45] crayon_1.3.4 doParallel_1.0.15 nlme_3.1-142 MASS_7.3-51.4
[49] class_7.3-15 data.table_1.12.8 tools_3.6.2 dismo_1.1-4
[53] lifecycle_0.1.0 stringr_1.4.0 munsell_0.5.0 compiler_3.6.2
[57] rlang_0.4.4 grid_3.6.2 iterators_1.0.12 rstudioapi_0.11
[61] ModelMetrics_1.2.2.1 gtable_0.3.0 codetools_0.2-16 abind_1.4-5
[65] reshape_0.8.8 R6_2.4.1 gridExtra_2.3 zoo_1.8-7
[69] lubridate_1.7.4 stringi_1.4.6 Rcpp_1.0.3 vctrs_0.2.3
[73] rpart_4.1-15 png_0.1-7 tidyselect_1.0.0

Example:
DataSpecies <- read.csv(system.file("external/species/mammals_table.csv",
package="biomod2"))
head(DataSpecies)

myRespName <- 'GuloGulo'

myResp <- as.numeric(DataSpecies[,myRespName])

myRespXY <- DataSpecies[,c("X_WGS84","Y_WGS84")]


myExpl = stack( system.file( "external/bioclim/current/bio3.grd",
package="biomod2"),
system.file( "external/bioclim/current/bio4.grd",
package="biomod2"),
system.file( "external/bioclim/current/bio7.grd",
package="biomod2"),
system.file( "external/bioclim/current/bio11.grd",
package="biomod2"),
system.file( "external/bioclim/current/bio12.grd",
package="biomod2"))

myBiomodData <- BIOMOD_FormatingData(resp.var = myResp,
expl.var = myExpl,
resp.xy = myRespXY,
resp.name = myRespName)

myBiomodOption <- BIOMOD_ModelingOptions()


myBiomodModelOut <- BIOMOD_Modeling( myBiomodData,
models = c('MARS'),
models.options = myBiomodOption,
NbRunEval=2,
DataSplit=80,
VarImport=0,
models.eval.meth = c('TSS','ROC'),
do.full.models=FALSE,
modeling.id="test")

myBiomodModelOut

Output:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= GuloGulo Modeling Summary -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

5 environmental variables ( bio3 bio4 bio7 bio11 bio12 )
Number of evaluation repetitions : 2
Models selected : MARS

Total number of model runs : 2

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


-=-=-=- Run : GuloGulo_AllData


-=-=-=--=-=-=- GuloGulo_AllData_RUN1

Model=Multiple Adaptive Regression Splines ( simple with no interaction )
Error in validObject(.Object) :
invalid class “MARS_biomod2_model” object: FALSE
In addition: Warning messages:
1: glm.fit: algorithm did not converge
2: glm.fit: fitted probabilities numerically 0 or 1 occurred
3: the glm algorithm did not converge for response "GuloGulo"


Thanks to:
Vienna University of Economics and Business Powered By FusionForge