gpb.plot.part.dep.interact {gpboost}R Documentation

Plot interaction partial dependence plots

Description

Plot interaction partial dependence plots

Usage

gpb.plot.part.dep.interact(model, data, variables, n.pt.per.var = 20,
  subsample = pmin(1, n.pt.per.var^2 * 100/nrow(data)),
  discrete.variables = c(FALSE, FALSE), which.class = NULL,
  type = "filled.contour", nlevels = 20, xlab = variables[1],
  ylab = variables[2], zlab = "", main = "", return_plot_data = FALSE,
  ...)

Arguments

model

A gpb.Booster model object

data

A matrix with data for creating partial dependence plots

variables

A vector of length two of type string with names of the columns or integer with indices of the columns in data for which an interaction dependence plot is created

n.pt.per.var

Number of grid points per variable (used only if a variable is not discrete) For continuous variables, the two-dimensional grid for the interaction plot has dimension c(n.pt.per.var, n.pt.per.var)

subsample

Fraction of random samples in data to be used for calculating the partial dependence plot

discrete.variables

A vector of length two of type boolean. If an entry is TRUE, the evaluation grid of the corresponding variable is set to the unique values of the variable

which.class

An integer indicating the class in multi-class classification (value from 0 to num_class - 1)

type

A character string indicating the type of the plot. Supported values: "filled.contour" and "contour"

nlevels

Parameter passed to the filled.contour or contour function

xlab

Parameter passed to the filled.contour or contour function

ylab

Parameter passed to the filled.contour or contour function

zlab

Parameter passed to the filled.contour or contour function

main

Parameter passed to the filled.contour or contour function

return_plot_data

A boolean. If TRUE, the data for creating the partial dependence plot is returned

...

Additional parameters passed to the filled.contour or contour function

Value

A list with three entries for creating the partial dependence plot: the first two entries are vectors with x and y coordinates. The third is a two-dimensional matrix of dimension c(length(x), length(y)) with z-coordinates. This is only returned if return_plot_data==TRUE

Author(s)

Fabio Sigrist

Examples


library(gpboost)
data(GPBoost_data, package = "gpboost")
gp_model <- GPModel(group_data = group_data[,1], likelihood = "gaussian")
gpboost_model <- gpboost(data = X,
                        label = y,
                        gp_model = gp_model,
                        nrounds = 16,
                        learning_rate = 0.05,
                        max_depth = 6,
                        min_data_in_leaf = 5,
                        verbose = 0)
gpb.plot.part.dep.interact(gpboost_model, X, variables = c(1,2))


[Package gpboost version 1.5.1.1 Index]