[1c0e03]: / man / plot_cm.Rd

Download this file

41 lines (35 with data), 1.1 kB

 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
36
37
38
39
40
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/help_functions.R
\name{plot_cm}
\alias{plot_cm}
\title{Plot confusion matrix}
\usage{
plot_cm(
cm,
perc = FALSE,
cm_labels,
round_dig = 2,
text_size = 1,
highlight_diag = TRUE
)
}
\arguments{
\item{cm}{A confusion matrix}
\item{perc}{Whether to use absolute numbers or percentages.}
\item{cm_labels}{Labels corresponding to confusion matrix entries.}
\item{round_dig}{How to round numbers.}
\item{text_size}{Size of text annotations.}
\item{highlight_diag}{Whether to highlight entries in diagonal.}
}
\value{
A ggplot of a confusion matrix.
}
\description{
Plot confusion matrix, either with absolute numbers or percentages per column (true labels).
}
\examples{
\dontshow{if (reticulate::py_module_available("tensorflow")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
cm <- matrix(c(90, 1, 0, 2, 7, 1, 8, 3, 1), nrow = 3, byrow = TRUE)
plot_cm(cm, perc = TRUE, cm_labels = paste0('label_', 1:3), text_size = 8)
\dontshow{\}) # examplesIf}
}