| classmap {classmap} | R Documentation |
Draw the class map to visualize classification results.
Description
Draw the class map to visualize classification results, based on the output of one of the
vcr.*.* functions in this package. The vertical axis of the class map shows each case's PAC, the conditional probability that it belongs to an alternative class. The farness on the horizontal axis is the probability of a member of the given class being at most as far from the class as the case itself.
Usage
classmap(vcrout, whichclass, classLabels = NULL, classCols = NULL,
main = NULL, cutoff = 0.99, plotcutoff = TRUE,
identify = FALSE, cex = 1, cex.main = 1.2, cex.lab = NULL,
cex.axis = NULL, opacity = 1,
squareplot = TRUE, maxprob = NULL, maxfactor = NULL)
Arguments
vcrout |
output of |
whichclass |
the number or level of the class to be displayed. Required. |
classLabels |
the labels (levels) of the classes. If |
classCols |
a list of colors for the class labels. There should be at least as many as there are levels. If |
main |
title for the plot. |
cutoff |
cases with overall farness |
plotcutoff |
If true, plots the cutoff on the farness values as a vertical line. |
identify |
if |
cex |
passed on to |
cex.main |
same, for title. |
cex.lab |
same, for labels on horizontal and vertical axes. |
cex.axis |
same, for axes. |
opacity |
determines opacity of plotted dots. Value between 0 and 1, where 0 is transparent and 1 is opaque. |
squareplot |
If |
maxprob |
draws the farness axis at least upto probability maxprob. If |
maxfactor |
if not |
Value
Executing the function plots the class map and returns
coordinates |
a matrix with 2 columns containing the coordinates of the plotted points. The first coordinate is the quantile of the farness probability. This makes it easier to add text next to interesting points. If |
Author(s)
Raymaekers J., Rousseeuw P.J.
References
Raymaekers J., Rousseeuw P.J., Hubert M. (2021). Class maps for visualizing classification results. Technometrics, appeared online. doi: 10.1080/00401706.2021.1927849(link to open access pdf)
Raymaekers J., Rousseeuw P.J.(2021). Silhouettes and quasi residual plots for neural nets and tree-based classifiers. (link to open access pdf)
See Also
vcr.da.train, vcr.da.newdata,
vcr.knn.train, vcr.knn.newdata,
vcr.svm.train, vcr.svm.newdata,
vcr.rpart.train, vcr.rpart.newdata,
vcr.forest.train, vcr.forest.newdata,
vcr.neural.train, vcr.neural.newdata
Examples
vcrout <- vcr.da.train(iris[, 1:4], iris[, 5])
classmap(vcrout, "setosa", classCols = 2:4) # tight class
classmap(vcrout, "versicolor", classCols = 2:4) # less tight
# The cases misclassified as virginica are shown in blue.
classmap(vcrout, "virginica", classCols = 2:4)
# The case misclassified as versicolor is shown in green.
# For more examples, we refer to the vignettes:
## Not run:
vignette("Discriminant_analysis_examples")
vignette("K_nearest_neighbors_examples")
vignette("Support_vector_machine_examples")
vignette("Rpart_examples")
vignette("Random_forest_examples")
vignette("Neural_net_examples")
## End(Not run)