Description Usage Arguments Value Examples
Constructs a zigzag expanded navigation plot (zenplot) displaying partial dependence values.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
task |
Task created from the mlr3 package, either regression or classification. |
model |
A machine learning model created from mlr3 task and learner. |
zpath |
A zenpath created from calcZpath. see |
method |
"pdp" (default) or "ale" |
noCols |
number of columns of 2d plots (>= 1) or one of "letter", "square", "A4", "golden" or "legal" in which case a similar layout is constructed. See ?zenplot |
zenMethod |
String indicating the layout of the zigzag plot. The available methods are: "tidy": more tidied-up double.zigzag (slightly more compact placement of plots towards the end). "double.zigzag": zigzag plot in the form of a flipped “S”. Along this path, the plots are placed in the form of an “S” which is rotated counterclockwise by 90 degrees. "single.zigzag": zigzag plot in the form of a flipped “S”. "rectangular": plots that fill the page from left to right and top to bottom. This is useful (and most compact) for plots that do not share an axis. |
pal |
A vector of colors to show predictions, for use with scale_fill_gradientn |
fitlims |
Specifies the fit range for the color map. Options are a numeric vector of length 2, "pdp" (default), in which cases limits are calculated from the pdp. Predictions outside fitlims are squished on the color scale. |
gridSize |
for the pdp/ale plots, defaults to 10. |
nmax |
Maximum number of data rows to consider, for calculating pdp. |
class |
For a classification model, show the probability of this class. Defaults to 1. |
A zenplot of partial dependence values.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # Load in the data:
aq <- na.omit(airquality)*1.0
# Run an mlr3 ranger model:
library(mlr3)
library(mlr3learners)
library(ranger)
ozonet <- TaskRegr$new(id = "airQ", backend = aq, target = "Ozone")
ozonel <- lrn("regr.ranger", importance = "permutation")
ozonef <- ozonel$train(ozonet)
# Create matrix
viv <- vividMatrix(ozonet, ozonef)
# Calculate Zpath:
zpath<-calcZpath(viv,.8)
zpath
# Create graph:
pdpZenplot(ozonet, ozonef, zpath=zpath)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.