View source: R/jj_confusion_matrix.R
jj_plot_confusion_matrix | R Documentation |
plot a confusion matrix based on two vectors of equal length
jj_plot_confusion_matrix(
vector_a,
vector_b,
xlab_text = "vector_a",
ylab_text = "vector_b",
plot_absolute = F,
plot_numbers = F,
text_size = 2
)
vector_a |
first vector, e.g. true label |
vector_b |
second vector, e.g. predicted label |
xlab_text |
x label |
ylab_text |
y label |
plot_absolute |
if FALSE, show the relative fraction of values for each cell |
plot_numbers |
show count in fields |
text_size |
size of text |
Returns a confusion matrix as heatmap
true_label = c('A','A','A','B','B','B')
predicted_label = c('A','B','B','B','B','B')
#percentage of the total observations that are in the respective field
jj_plot_confusion_matrix(vector_a = true_label, vector_b = predicted_label,
xlab_text = 'true value', ylab_text = 'predicted value',
plot_numbers = T, text_size = 10)
# absolute
jj_plot_confusion_matrix(vector_a = true_label, vector_b = predicted_label,
xlab_text = 'true value', ylab_text = 'predicted value',
plot_numbers = T, text_size = 10, plot_absolute = T)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.