Description Usage Arguments Value Examples
View source: R/confusion_matrix.R
Implementation based on https://stackoverflow.com/a/59119854
1 | confusion_matrix(actual_y, predicted_y, labels = NULL, title = NULL)
|
actual_y |
a data frame of the validation labels |
predicted_y |
a data frame of predicted values with model |
labels |
a list of string of confusion matrix labels |
title |
a string of the confusion matrix label |
A plot and a dataframe with scoring metrics
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Not run:
library(RMLViz)
data(iris)
set.seed(123)
split <- caTools::sample.split(iris$Species, SplitRatio = 0.75)
training_set <- subset(iris, split == TRUE)
valid_set <- subset(iris, split == FALSE)
X_train <- training_set[, -5]
y_train <- training_set[, 5]
X_valid <- valid_set[, -5]
y_valid <- valid_set[, 5]
predict <- class::knn(X_train, X_train, y_train, k = 5)
confusion_matrix(y_train, predict)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.