Description Usage Arguments Examples
Interactive Mismatch Matrix
1 2 | fdPlotMismatchMatrix(x, class = "table table-bordered",
barColor = "#e15759", digits = 3)
|
x |
matrix or table of actual vs. predicted values. |
class |
html class for table. |
barColor |
color for bars. |
digits |
number of digits to display. |
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 | library(rpart)
mod <- rpart(Species ~ ., data = iris)
predicted <- predict(mod, type = 'class')
actual <- iris$Species
if (interactive()){
confusion <- table(actual, predicted)
fdBox(title = 'Classification Mismatch',
fdPlotMismatchMatrix(confusion),
footer = 'This table shows the top misclassification pairs',
width = 12
) %>%
fdPreview(wrap = 'row')
}
# library(mlbench)
# mod <- rpart(Class ~ ., data = Soybean)
# predicted <- predict(mod, type = 'class')
# actual <- Soybean$Class
# confusion <- table(actual, predicted)
#
# htmltools::tagList(
# fdRowBox(width = 12, title = 'Confusion Matrix',
# fdPlotConfusionMatrix(confusion),
# extraBoxClass = 'table-responsive'),
# fdRowBox(width = 12, title = 'Mismatch Matrix',
# fdPlotMismatchMatrix(confusion),
# footer = paste(
# 'This table shows pairs of actual and predicted values',
# 'sorted by their frequency of mismatches'
# )
# )
# ) %>%
# fdPreview(wrap = 'none')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.