Skip to content

Commit

Permalink
improvements in esm
Browse files Browse the repository at this point in the history
  • Loading branch information
sjevelazco committed Apr 10, 2024
1 parent ee82c89 commit e22c182
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion R/esm_gam.R
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ esm_gam <- function(data,
dplyr::distinct(AUC_mean) %>%
dplyr::pull()
D <- 2 * (mtrc - 0.5) # Somers'D
filt <- mtrc > 0
filt <- D > 0

if (sum(filt) == 0) {
message("None bivariate model had Somer's D > 0.5. Try with another esm_* function. NA will be returned")
Expand Down
2 changes: 1 addition & 1 deletion R/esm_gau.R
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ esm_gau <- function(data,
dplyr::distinct(AUC_mean) %>%
dplyr::pull()
D <- 2 * (mtrc - 0.5) # Somers'D
filt <- mtrc > 0
filt <- D > 0

if (sum(filt) == 0) {
message("None bivariate model had Somer's D > 0.5. Try with another esm_* function. NA will be returned")
Expand Down
2 changes: 1 addition & 1 deletion R/esm_gbm.R
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ esm_gbm <- function(data,
dplyr::distinct(AUC_mean) %>%
dplyr::pull()
D <- 2 * (mtrc - 0.5) # Somers'D
filt <- mtrc > 0
filt <- D > 0

if (sum(filt) == 0) {
message("None bivariate model had Somer's D > 0.5. Try with another esm_* function. NA will be returned")
Expand Down
2 changes: 1 addition & 1 deletion R/esm_glm.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ esm_glm <- function(data,
dplyr::distinct(AUC_mean) %>%
dplyr::pull()
D <- 2 * (mtrc - 0.5) # Somers'D
filt <- mtrc > 0
filt <- D > 0

if (sum(filt) == 0) {
message("None bivariate model had Somer's D > 0.5. Try with another esm_* function. NA will be returned")
Expand Down
2 changes: 1 addition & 1 deletion R/esm_max.R
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ esm_max <- function(data,
dplyr::distinct(AUC_mean) %>%
dplyr::pull()
D <- 2 * (mtrc - 0.5) # Somers'D
filt <- mtrc > 0
filt <- D > 0

if (sum(filt) == 0) {
message("None bivariate model had Somer's D > 0.5. Try with another esm_* function. NA will be returned")
Expand Down
2 changes: 1 addition & 1 deletion R/esm_net.R
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ esm_net <- function(data,
dplyr::distinct(AUC_mean) %>%
dplyr::pull()
D <- 2 * (mtrc - 0.5) # Somers'D
filt <- mtrc > 0
filt <- D > 0

if (sum(filt) == 0) {
message("None bivariate model had Somer's D > 0.5. Try with another esm_* function. NA will be returned")
Expand Down
2 changes: 1 addition & 1 deletion R/esm_svm.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ esm_svm <- function(data,
dplyr::distinct(AUC_mean) %>%
dplyr::pull()
D <- 2 * (mtrc - 0.5) # Somers'D
filt <- mtrc > 0
filt <- D > 0

if (sum(filt) == 0) {
message("None bivariate model had Somer's D > 0.5. Try with another esm_* function. NA will be returned")
Expand Down
3 changes: 2 additions & 1 deletion R/sdm_predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,8 @@ sdm_predict <-
as.numeric() # get performance of esm

ensemble_c <-
terra::app(model_c * weight_data, fun = mean, cores = 1)
terra::app(model_c * weight_data, fun = sum, cores = 1)
ensemble_c <- ensemble_c/sum(weight_data)
names(ensemble_c) <- paste0("esm_", unique(names(model_c)))

model_c <- list(ensemble_c)
Expand Down

0 comments on commit e22c182

Please sign in to comment.