small fixes
This commit is contained in:
parent
83ddbbf03b
commit
d982f2746c
@ -128,4 +128,4 @@ linearDump <- function(feature_names, text){
|
|||||||
# Avoid error messages during CRAN check.
|
# Avoid error messages during CRAN check.
|
||||||
# The reason is that these variables are never declared
|
# The reason is that these variables are never declared
|
||||||
# They are mainly column names inferred by Data.table...
|
# They are mainly column names inferred by Data.table...
|
||||||
globalVariables(".", "Feature", "Split", "No", "Missing")
|
globalVariables(c(".", "Feature", "Split", "No", "Missing"))
|
||||||
|
|||||||
@ -45,6 +45,9 @@ xgb.plot.importance <- function(importance_matrix = NULL, numberOfClusters = c(1
|
|||||||
stop("importance_matrix: Should be a data.table.")
|
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))
|
clusters <- suppressWarnings(Ckmeans.1d.dp(importance_matrix[,Gain], numberOfClusters))
|
||||||
importance_matrix[,"Cluster":=clusters$cluster %>% as.character]
|
importance_matrix[,"Cluster":=clusters$cluster %>% as.character]
|
||||||
|
|
||||||
@ -56,4 +59,4 @@ xgb.plot.importance <- function(importance_matrix = NULL, numberOfClusters = c(1
|
|||||||
# Avoid error messages during CRAN check.
|
# Avoid error messages during CRAN check.
|
||||||
# The reason is that these variables are never declared
|
# The reason is that these variables are never declared
|
||||||
# They are mainly column names inferred by Data.table...
|
# They are mainly column names inferred by Data.table...
|
||||||
globalVariables(c("Feature","Gain", "Cluster"))
|
globalVariables(c("Feature", "Gain", "Cluster"))
|
||||||
Loading…
x
Reference in New Issue
Block a user