[R] Fix xgb.model.dt.tree in case where all leaves are negative (#10798)
This commit is contained in:
parent
19b55b300b
commit
215da76263
@ -89,7 +89,7 @@ xgb.model.dt.tree <- function(model = NULL, text = NULL,
|
||||
from_text <- FALSE
|
||||
}
|
||||
|
||||
if (length(text) < 2 || !any(grepl('leaf=(\\d+)', text))) {
|
||||
if (length(text) < 2 || !any(grepl('leaf=(-?\\d+)', text))) {
|
||||
stop("Non-tree model detected! This function can only be used with tree models.")
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user