Description Usage Arguments Details Value Author(s) See Also Examples
A set of lattice functions are provided to plot the resampled performance estimates (e.g. classification accuracy, RMSE) over tuning parameters (if any).
1 2 3 4 5 6 7 8 9 10 11 | ## S3 method for class 'train'
histogram(x, data = NULL, metric = x$metric, ...)
## S3 method for class 'train'
densityplot(x, data = NULL, metric = x$metric, ...)
## S3 method for class 'train'
xyplot(x, data = NULL, metric = x$metric, ...)
## S3 method for class 'train'
stripplot(x, data = NULL, metric = x$metric, ...)
|
x |
An object produced by |
data |
This argument is not used |
metric |
A character string specifying the single performance metric that will be plotted |
... |
arguments to pass to either |
By default, only the resampling results for the optimal model are saved in the train
object. The function trainControl
can be used to save all the results (see the example below).
If leave-one-out or out-of-bag resampling was specified, plots cannot be produced (see the method
argument of trainControl
)
For xyplot
and stripplot
, the tuning parameter with the most unique values will be plotted on the x-axis. The remaining parameters (if any) will be used as conditioning variables. For densityplot
and histogram
, all tuning parameters are used for conditioning.
Using horizontal = FALSE
in stripplot
works.
A lattice plot object
Max Kuhn
train
, trainControl
, histogram
, densityplot
, xyplot
, stripplot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## Not run:
library(mlbench)
data(BostonHousing)
library(rpart)
rpartFit <- train(medv ~ .,
data = BostonHousing,
"rpart",
tuneLength = 9,
trControl = trainControl(
method = "boot",
returnResamp = "all"))
densityplot(rpartFit,
adjust = 1.25)
xyplot(rpartFit,
metric = "Rsquared",
type = c("p", "a"))
stripplot(rpartFit,
horizontal = FALSE,
jitter = TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.