[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:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user