Skip to contents

The partial dependence of a booster_fit() on a feature over a grid: the mean prediction over the rows of data with the feature set to each value, and where it moves against direction (the fit's monotone constraint on the feature by default). The engines enforce a constraint split by split; this confirms it on the model as fitted.

Usage

check_monotone(
  object,
  data,
  feature,
  grid = NULL,
  direction = NULL,
  tol = 1e-09
)

Arguments

object

A booster_model.

data

A data frame with the model's variables.

feature

A numeric variable of the formula.

grid

Values of the feature; twenty quantiles of it by default.

direction

1 or -1.

tol

Relative tolerance on a step against the direction.

Value

A list with grid, mean, direction, violations (the indices i whose step from i - 1 goes against the direction) and monotone.