small fixes

This commit is contained in:
El Potaeto 2015-02-18 19:41:13 +01:00
parent 83ddbbf03b
commit d982f2746c
2 changed files with 5 additions and 2 deletions

View File

@ -128,4 +128,4 @@ linearDump <- function(feature_names, text){
# Avoid error messages during CRAN check.
# The reason is that these variables are never declared
# They are mainly column names inferred by Data.table...
globalVariables(".", "Feature", "Split", "No", "Missing")
globalVariables(c(".", "Feature", "Split", "No", "Missing"))

View File

@ -45,6 +45,9 @@ xgb.plot.importance <- function(importance_matrix = NULL, numberOfClusters = c(1
stop("importance_matrix: Should be a data.table.")
}
# To avoid issues in clustering when co-occurences are used
importance_matrix <- importance_matrix[, .(Gain = sum(Gain)), by = Feature]
clusters <- suppressWarnings(Ckmeans.1d.dp(importance_matrix[,Gain], numberOfClusters))
importance_matrix[,"Cluster":=clusters$cluster %>% as.character]