Plot a partial dependence from generatePartialDependenceData using ggplot2.

plotPartialDependence(obj, geom = "line", facet = NULL,
  facet.wrap.nrow = NULL, facet.wrap.ncol = NULL, p = 1,
  data = NULL)

Arguments

obj

PartialDependenceData
Generated by generatePartialDependenceData.

geom

(charater(1))
The type of geom to use to display the data. Can be “line” or “tile”. For tiling at least two features must be used with interaction = TRUE in the call to generatePartialDependenceData. This may be used in conjuction with the facet argument if three features are specified in the call to generatePartialDependenceData. Default is “line”.

facet

(character(1))
The name of a feature to be used for facetting. This feature must have been an element of the features argument to generatePartialDependenceData and is only applicable when said argument had length greater than 1. The feature must be a factor or an integer. If generatePartialDependenceData is called with the interaction argument FALSE (the default) with argument features of length greater than one, then facet is ignored and each feature is plotted in its own facet. Default is NULL.

facet.wrap.nrow, facet.wrap.ncol

(integer)
Number of rows and columns for facetting. Default for both is NULL. In this case ggplot's facet_wrap will choose the layout itself.

p

(numeric(1))
If individual = TRUE then sample allows the user to sample without replacement from the output to make the display more readable. Each row is sampled with probability p. Default is 1.

data

(data.frame)
Data points to plot. Usually the training data. For survival and binary classification tasks a rug plot wherein ticks represent failures or instances of the positive class are shown. For regression tasks points are shown. For multiclass classification tasks ticks are shown and colored according to their class. Both the features and the target must be included. Default is NULL.

Value

ggplot2 plot object.

See also