Description Usage Arguments Value Author(s) Examples
This function takes an object (preferably from the function extractProb
)
and creates a lattice plot.
If the call to extractProb
included test data, these data are shown, but
if unknowns were also included, these are not plotted
1 2 3 4 | plotClassProbs(object,
plotType = "histogram",
useObjects = FALSE,
...)
|
object |
an object (preferably from the function |
plotType |
either "histogram" or "densityplot" |
useObjects |
a logical; should the object name (if any) be used as a conditioning variable? |
... |
parameters to pass to |
A lattice object. Note that the plot has to be printed to be displayed (especially in a loop).
Max Kuhn
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 28 29 30 31 32 33 34 35 | ## Not run:
data(mdrr)
set.seed(90)
inTrain <- createDataPartition(mdrrClass, p = .5)[[1]]
trainData <- mdrrDescr[inTrain,1:20]
testData <- mdrrDescr[-inTrain,1:20]
trainY <- mdrrClass[inTrain]
testY <- mdrrClass[-inTrain]
ctrl <- trainControl(method = "cv")
nbFit1 <- train(trainData, trainY, "nb",
trControl = ctrl,
tuneGrid = data.frame(usekernel = TRUE, fL = 0))
nbFit2 <- train(trainData, trainY, "nb",
trControl = ctrl,
tuneGrid = data.frame(usekernel = FALSE, fL = 0))
models <- list(para = nbFit2, nonpara = nbFit1)
predProbs <- extractProb(models, testX = testData, testY = testY)
plotClassProbs(predProbs, useObjects = TRUE)
plotClassProbs(predProbs,
subset = object == "para" & dataType == "Test")
plotClassProbs(predProbs,
useObjects = TRUE,
plotType = "densityplot",
auto.key = list(columns = 2))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.