create_monotone_constraints | R Documentation |
helper function to create the integer vector to pass to the monotone_constraints
argument in xgboost
create_monotone_constraints( .data, formula, decreasing = NULL, increasing = NULL )
.data |
dataframe, training data for tidy_xgboost |
formula |
formula used for tidy_xgboost |
decreasing |
character vector or tidyselect regular expression to designate decreasing cols |
increasing |
character vector or tidyselect regular expression to designate increasing cols |
a named integer vector with entries of 0, 1, -1
iris %>% framecleaner::create_dummies(Species) -> iris_dummy iris_dummy %>% tidy_formula(target= Petal.Length) -> petal_form iris_dummy %>% create_monotone_constraints(petal_form, decreasing = tidyselect::matches("Petal|Species"), increasing = "Sepal.Width")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.