Skip to content

Commit

Permalink
Corrections
Browse files Browse the repository at this point in the history
Fix in the case : tuning with just PAdataset et full.model

+ Fix modification ModelsTable
  • Loading branch information
HeleneBlt committed May 2, 2024
1 parent 85c78a5 commit b9192bc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
16 changes: 10 additions & 6 deletions R/BIOMOD_Modeling.R
Original file line number Diff line number Diff line change
Expand Up @@ -472,14 +472,18 @@ BIOMOD_Modeling <- function(bm.format,
OPT.user@options[[mod]]@args.values[[ii]] <- val
}
} else if (all(grepl("_allRun", nam))){ #Check if the user create the options just for PA dataset
model.name <- unlist(strsplit(mod,split = '[.]'))[1]
cat("\n \t The options for",model.name, "for '_PAx_allRun' will be given to all runs with PAx (_PAx_RUN1, _PAx_RUN2,...) \n")
sep.name <- unlist(strsplit(mod,split = '[.]'))
cat("\n \n \t The options for",sep.name[1], "for '_PAx_allRun' will be given to all runs with PAx (_PAx_RUN1, _PAx_RUN2,...) \n")
for (run in vals){
PA.set <- grep("PA", unlist(strsplit(run, "_")), value = T)
if (length(PA.set) == 0){
PA.set <- "allData"
PA.set <- grep("PA|allData", unlist(strsplit(run, "_")), value = T)
if (is.null(OPT.user@options[[mod]]@args.values[[paste0("_", PA.set, "_allRun")]])){
opt.default <- BIOMOD.options.dataset(mod = sep.name[1],typ = sep.name[2],pkg =sep.name[3], fun = sep.name[4], strategy = "default",
bm.format = bm.format, calib.lines = calib.lines)
OPT.user@options[[mod]]@args.values[[run]] <- opt.default@args.values[["_allData_allRun"]]
} else {
OPT.user@options[[mod]]@args.values[[run]] <- OPT.user@options[[mod]]@args.values[[paste0("_", PA.set, "_allRun")]]
}
OPT.user@options[[mod]]@args.values[[run]] <- OPT.user@options[[mod]]@args.values[[paste0("_", PA.set, "_allRun")]]

}
} else {
stop(paste0("\n", "names(OPT.user@options[['", mod, "']]@args.values)", " must be '",
Expand Down
2 changes: 2 additions & 0 deletions R/biomod2_classes_0.R
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,8 @@ setMethod('BIOMOD.options.dataset', signature(strategy = 'character'),
argstmp$type <- "classification"
}
if (mod == "XGBOOST") { argstmp$nrounds = 4 }

argstmp[["..."]] = NULL
BOM@args.default <- argstmp
## SHOULD BE MOVED to place when testing values !! ??

Expand Down
1 change: 1 addition & 0 deletions R/biomod2_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
# , train = c('avNNet', 'rpart', 'fda', 'gamLoess', 'bam', 'gam', 'gbm', 'glm'
# , 'earth', 'ENMevaluate', 'maxnet', 'rf', 'bm_SRE', 'xgbTree'))

# usethis::use_data(ModelsTable, overwrite = TRUE)
# usethis::use_data(ModelsTable, overwrite = TRUE, internal = TRUE)

#' Bigboss pre-defined parameter values for single models
Expand Down
Binary file modified data/ModelsTable.rda
Binary file not shown.

0 comments on commit b9192bc

Please sign in to comment.