fix small bug introduced in refactoring
This commit is contained in:
parent
2154a160a3
commit
84fb89af70
@ -38,10 +38,9 @@ xgb.importance <- function(feature_names, filename_dump){
|
|||||||
treeDump <- function(feature_names, text){
|
treeDump <- function(feature_names, text){
|
||||||
result <- c()
|
result <- c()
|
||||||
for(line in text){
|
for(line in text){
|
||||||
m <- regexec("\\[f.*\\]", line)
|
p <- regexec("\\[f.*\\]", line) %>% regmatches(line, .)
|
||||||
p <- regmatches(line, m)
|
|
||||||
if (length(p[[1]]) > 0) {
|
if (length(p[[1]]) > 0) {
|
||||||
splits <- sub("\\]", "", sub("\\[f", "", p[[1]])) %>% strsplit("<")[[1]] %>% as.numeric
|
splits <- sub("\\[f", "", p[[1]]) %>% sub("\\]", "", .) %>% strsplit("<") %>% .[[1]] %>% as.numeric
|
||||||
result <- c(result, feature_names[splits[1]+ 1])
|
result <- c(result, feature_names[splits[1]+ 1])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -50,5 +49,5 @@ treeDump <- function(feature_names, text){
|
|||||||
}
|
}
|
||||||
|
|
||||||
linearDump <- function(feature_names, text){
|
linearDump <- function(feature_names, text){
|
||||||
which(text == "weight:") %>% {a=.+1; text[a:length(text)]} %>% as.numeric %>% data.table(Feature = feature_names, Weight = .)
|
which(text == "weight:") %>% {a=.+1;text[a:length(text)]} %>% as.numeric %>% data.table(Feature = feature_names, Weight = .)
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user