pairplot
creates a partial dependence plot to assess the effects of a
pair of predictor variables on the predictions of the ensemble
pairplot(object, varnames, type = "both", penalty.par.val = "lambda.1se",
nvals = c(20, 20), pred.type = "response", ...)
an object of class pre
character vector of length two. Currently, pairplots can only
be requested for non-nominal variables. If varnames specifies the name(s) of
variables of class "factor"
, an error will be printed.
character string. Type of plot to be generated.
type = "heatmap"
yields a heatmap plot, type = "contour"
yields
a contour plot, type = "both"
yields a heatmap plot with added contours,
type = "perspective"
yields a three dimensional plot.
character. Should model be selected with lambda giving
minimum cv error ("lambda.min"), or lambda giving cv error that is within 1
standard error of minimum cv error ("lambda.1se")? Alternatively, a numeric
value may be specified, corresponding to one of the values of lambda in the
sequence used by glmnet, for which estimated cv error can be inspected by
running object$glmnet.fit
and plot(object$glmnet.fit)
.
optional numeric vector of length 2. For how many values of
x1 and x2 should partial dependence be plotted? If NULL
, all observed
values for the two predictor variables specified will be used (see details).
character string. Type of prediction to be plotted on z-axis.
pred.type = "response"
gives fitted values for continuous outputs and
fitted probabilities for nominal outputs. pred.type = "link"
gives fitted
values for continuous outputs and linear predictor values for nominal outputs.
By default, partial dependence will be plotted for each combination
of 20 values of the specified predictor variables. When nvals = NULL
is
specified a dependence plot will be created for every combination of the unique
observed values of the two predictor variables specified. Therefore, using
nvals = NULL
will often result in long computation times, and / or
memory allocation errors. Also, pre
ensembles derived
from training datasets that are very wide or long may result in long
computation times and / or memory allocation errors. In such cases, reducing
the values supplied to nvals
will reduce computation time and / or
memory allocation errors. When the nvals argument is supplied, values for the
minimum, maximum, and nvals - 2 intermediate values of the predictor variable
will be plotted. Furthermore, if none of the variables specified appears in
the final prediction rule ensemble, an error will occur.
# NOT RUN {
set.seed(42)
airq.ens <- pre(Ozone ~ ., data = airquality[complete.cases(airquality),])
pairplot(airq.ens, c("Temp", "Wind"))
# }
Run the code above in your browser using DataLab