I am working with tidymodels , so far so good. But sometimes is interesting to add monotonic constraints in the model (forcing to be always increasing, decreasing (1 , -1). This constraint is passed as a vector referring to every column in the dataframe.
Example code (non tidymodel):
# Train the model.
xgb_model <- xgboost::xgb.train(params = params,
data=data,
nrounds = num_trees,
print_every_n = 5,
metrics = "auc",
monotone_constraints = c(1,-1,1,-1,1,-1,0,0,0,-1,1)
maximize = F,
tree_method = tree_method,
verbose=verbose
)
How could I insert this monotonic constraint in tidymodels?
Thanks in advance