Merge pull request #142 from pommedeterresautee/master
avoid warning message when a tree is just made of one leaf
This commit is contained in:
commit
166e7525da
@ -99,6 +99,9 @@ xgb.model.dt.tree <- function(feature_names = NULL, filename_dump = NULL, model
|
|||||||
|
|
||||||
tree <- text[(position[i]+1):(position[i+1]-1)]
|
tree <- text[(position[i]+1):(position[i+1]-1)]
|
||||||
|
|
||||||
|
# avoid tree made of a leaf only (no split)
|
||||||
|
if(length(tree) <2) next
|
||||||
|
|
||||||
treeID <- i-1
|
treeID <- i-1
|
||||||
|
|
||||||
notLeaf <- str_match(tree, "leaf") %>% is.na
|
notLeaf <- str_match(tree, "leaf") %>% is.na
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user