Hi,
After making some tries with classic presence/pseudo-absences datasets, I am trying to fit some models using a presence-only dataset. However, when using this option I get always strange outputs from the train function, which I attached below:

This is my code:
#load variables
path_vars_100<-"G:/davide/Namibia/variables_100m/selected_current" ### qui metti il percorso alla cartella dove stanno le variabili
env100 <- list.files(path_vars_100,pattern=".tif$")
#setwd()
EnvVars<-rast(lapply(env100,function(x){
var<-rast(paste0(path_vars_100,"/",x))
return(var)}))
envars_res <- terra::aggregate(EnvVars, fact = 5)
envars_nrm <- ibis.iSDM::predictor_transform(envars_res, "norm")
envars_ready <- ibis.iSDM::predictor_homogenize_na(envars_nrm)
background <- rast("G:/davide/Namibia/variables_100m/all_final_variables/dem_namibia_100m_wgs.tif")
background_res <- terra::aggregate(background, fact= 5)
background_res[background_res<0] <- 1
background_res[background_res>0] <- 1
#load global ensemble
Africa_shape <- st_read("F:/Polyclada_Africa/afr_g2014_2013_0.shp")
ensemble_africa <- rast("G:/davide/Namibia/africa_modeling/predictions/ens_xgball_wmean.tif")
ensemble_africa_cropped <- ensemble_africa |>
crop(Africa_shape) |>
mask(Africa_shape)
#load dataset
data_namibia1 <- read.csv("G:/davide/Namibia/datasets/dat1.csv") %>%
st_as_sf(coords=c("Longitude","Latitude"), crs=4326)
data_namibia1_f <- thin_observations(data_namibia1, background_res, method = "random", remainpoints = 1)
data_namibia1_f$pres_abs <- 1
# modeling
#dat1
mod1_xgb <- distribution(background_res) |>
add_predictor_range(layer = range_report, distance_max = 5e4) |>
add_predictors(ensemble_africa_cropped) |>
add_predictors(envars_ready) |>
add_biodiversity_poipo(data_namibia1_f, field_occurrence = "pres_abs", docheck = F) |>
engine_xgboost(booster = "gbtree", iter = 9000L, learning_rate = 0.0005, gamma = 3, subsample = 0.85)
gc()
fit_mod1_xgb <- ibis.iSDM::train(mod1_xgb, only_linear = FALSE, verbose = TRUE, optim_hyperparam = T, runname = "xgboost: dat1 poipo + global model + range")
gc()
plot(fit_mod1_xgb, "mean")
I get this issue also when trying to use add_biodiversity_polpo, selecting some random points inside the polygons.
I controlled the tutorials and the examples provided to check if there were some errors in my code, but I didn't solve this problem.
Thank you in advance!
Davide
Hi,
After making some tries with classic presence/pseudo-absences datasets, I am trying to fit some models using a presence-only dataset. However, when using this option I get always strange outputs from the
trainfunction, which I attached below:This is my code:
I get this issue also when trying to use
add_biodiversity_polpo, selecting some random points inside the polygons.I controlled the tutorials and the examples provided to check if there were some errors in my code, but I didn't solve this problem.
Thank you in advance!
Davide