From e475b7d84e3ed83055683c705635e60fbea852a0 Mon Sep 17 00:00:00 2001 From: El Potaeto Date: Wed, 21 Jan 2015 13:26:34 +0100 Subject: [PATCH] Avoid some Cran check error messages --- R-package/R/xgb.cv.R | 5 +++++ R-package/R/xgb.dump.R | 5 +++++ R-package/R/xgb.importance.R | 4 +++- R-package/R/xgb.model.dt.tree.R | 5 +++++ R-package/R/xgb.plot.tree.R | 2 ++ src/tree/updater_colmaker-inl.hpp | 3 ++- 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/R-package/R/xgb.cv.R b/R-package/R/xgb.cv.R index cdbaf3b2e..2129b418a 100644 --- a/R-package/R/xgb.cv.R +++ b/R-package/R/xgb.cv.R @@ -130,3 +130,8 @@ xgb.cv <- function(params=list(), data, nrounds, nfold, label = NULL, missing = } return(dt) } + +# 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(".") \ No newline at end of file diff --git a/R-package/R/xgb.dump.R b/R-package/R/xgb.dump.R index 7658557dd..a0938ded1 100644 --- a/R-package/R/xgb.dump.R +++ b/R-package/R/xgb.dump.R @@ -55,3 +55,8 @@ xgb.dump <- function(model = NULL, fname = NULL, fmap = "", with.stats=FALSE) { return(TRUE) } } + +# 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(".") \ No newline at end of file diff --git a/R-package/R/xgb.importance.R b/R-package/R/xgb.importance.R index 3b7f69401..c1d772aff 100644 --- a/R-package/R/xgb.importance.R +++ b/R-package/R/xgb.importance.R @@ -80,4 +80,6 @@ treeDump <- 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 = .) -} \ No newline at end of file +} + +globalVariables(".") \ No newline at end of file diff --git a/R-package/R/xgb.model.dt.tree.R b/R-package/R/xgb.model.dt.tree.R index ec50728fe..57d14933c 100644 --- a/R-package/R/xgb.model.dt.tree.R +++ b/R-package/R/xgb.model.dt.tree.R @@ -162,3 +162,8 @@ xgb.model.dt.tree <- function(feature_names = NULL, filename_dump = NULL, model allTrees } + +# 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("ID", "Tree", "Yes", ".", "Feature", "Cover", "Quality", "No", "Gain", "Frequence") \ No newline at end of file diff --git a/R-package/R/xgb.plot.tree.R b/R-package/R/xgb.plot.tree.R index b5f7a959e..3d1fc795c 100644 --- a/R-package/R/xgb.plot.tree.R +++ b/R-package/R/xgb.plot.tree.R @@ -87,3 +87,5 @@ xgb.plot.tree <- function(feature_names = NULL, filename_dump = NULL, model = NU path <- allTrees[Feature!="Leaf", c(yesPath, noPath)] %>% .[order(.)] %>% paste(sep = "", collapse = ";") %>% paste("graph LR", .,collapse = "", sep = ";") %>% paste(CSSstyle, yes, no, sep = ";") DiagrammeR(path, width, height) } + +globalVariables("Feature", "yesPath", "ID", "Cover", "Quality", "Split", "Yes", "Yes.Feature", "noPath", "No", "No.Feature", ".") \ No newline at end of file diff --git a/src/tree/updater_colmaker-inl.hpp b/src/tree/updater_colmaker-inl.hpp index 61b7fbf7a..bbf6242c5 100644 --- a/src/tree/updater_colmaker-inl.hpp +++ b/src/tree/updater_colmaker-inl.hpp @@ -153,7 +153,8 @@ class ColMaker: public IUpdater { } unsigned n = static_cast(param.colsample_bytree * feat_index.size()); random::Shuffle(feat_index); - utils::Check(n > 0, "colsample_bytree is too small that no feature can be included"); + //utils::Check(n > 0, "colsample_bytree is too small that no feature can be included"); + utils::Check(n > 0, "colsample_bytree=%g is too small that no feature can be included", param.colsample_bytree); feat_index.resize(n); } {// setup temp space for each thread