[R] Monotonic Constraints in Tree Construction (#1557)

* fix cran check

* change required R version because of utils::globalVariables

* temporary commit, monotone not working

* fix test

* fix doc

* fix doc
This commit is contained in:
Tong He
2016-09-11 22:16:33 -07:00
committed by Tianqi Chen
parent fb02797e2a
commit 4733357278
4 changed files with 35 additions and 0 deletions

View File

@@ -65,6 +65,15 @@ check.booster.params <- function(params, ...) {
stop("'num_class' > 1 parameter must be set for multiclass classification")
}
# monotone_constraints parser
if (!is.null(params[['monotone_constraints']]) &&
typeof(params[['monotone_constraints']]) != "character") {
vec2str = paste(params[['monotone_constraints']], collapse = ',')
vec2str = paste0('(', vec2str, ')')
params[['monotone_constraints']] = vec2str
}
return(params)
}