Skip to content

Commit 00d3094

Browse files
committed
Fix glmnet2
1 parent 07541d6 commit 00d3094

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Package: IASDT.R
33
Title: Modelling the Distribution of Invasive Alien Plant Species in
44
Europe
55
Version: 0.1.12
6-
Date: 2025-12-16
6+
Date: 2025-12-19
77
Authors@R:
88
person("Ahmed", "El-Gabbas", , "ahmed.el-gabbas@ufz.de", role = c("aut", "cre"),
99
comment = c(ORCID = "0000-0003-2225-088X"))

R/utils_helper_functions.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
if (n_cores > max_cores) {
1717
warning(
1818
stringr::str_glue(
19-
"`n_cores` exceeds available cores: {n_cores}. Using all available",
20-
" cores: {max_cores}"),
19+
"`n_cores` ({n_cores}) exceeds available cores. Using all available",
20+
" cores ({max_cores})"),
2121
call. = FALSE)
2222
n_cores <- max_cores
2323
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,4 @@ If you use the `IASDT.R` package, please cite it as:
8181
> <a href="https://biodt.eu" target="_blank">https://biodt.eu</a>.
8282
8383
<span style=" color: grey !important;">Last update:
84-
2025-12-16</span>
84+
2025-12-19</span>

inst/glmnet2.R

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@ methodInfo <- list(
2222
y <- sdm:::.getData.sdmY(formula, data)
2323

2424
if (family == "binomial") {
25-
m <- glmnet::cv.glmnet(
25+
glmnet::cv.glmnet(
2626
x, y, family = "binomial", type.measure = "auc", ...)
2727
} else {
28-
m <- glmnet::cv.glmnet(x, y, family = family, ...)
28+
glmnet::cv.glmnet(x, y, family = family, ...)
2929
}
3030

31-
glmnet::glmnet(x = x, y = y, family = family, lambda = m$lambda.1se, ...)
3231
},
3332
settingRules = function(x = "sdmVariables", f = "fitSettings") {
3433
if (x@distribution %in% c("poisson", "multinomial")) {
@@ -45,8 +44,8 @@ methodInfo <- list(
4544
newx <- sdm:::.getData.sdmMatrix(
4645
formula, newx, normalize = TRUE, frame = v@varInfo$numeric)
4746
# Predict at the fitted lambda for safety (minimal change).
48-
p <- predict(object, newx, type = type, s = object$lambda, ...)
47+
p <- predict(object, newx, type = type, s = "lambda.1se", ...)
4948
if (is.matrix(p)) p <- p[, 1, drop = TRUE]
50-
p
49+
as.vector(p)
5150
}
5251
)

man/fit_sdm_models.Rd

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)