fix small bug introduced in refactoring

This commit is contained in:
El Potaeto 2014-12-28 11:30:55 +01:00
parent 2154a160a3
commit 84fb89af70

View File

@ -38,10 +38,9 @@ xgb.importance <- function(feature_names, filename_dump){
treeDump <- function(feature_names, text){
result <- c()
for(line in text){
m <- regexec("\\[f.*\\]", line)
p <- regmatches(line, m)
p <- regexec("\\[f.*\\]", line) %>% regmatches(line, .)
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])
}
}