Description Usage Arguments Details Value See Also Examples
View source: R/classification.R
The Momocs::classification_metrics() function as well as the mltools::mcc() fucntion are used to generate metrics to evaluate the performance of classification.
1 | eval.classification.results(actual, predicted, name = "")
|
actual |
A character vector that indicates the actual class for each observation. |
predicted |
A character vector that indicates the predicted class for each observation. |
name |
A string that specifies a name to assign to this iteration of the function. Default is blank. |
Helpful for reference: https://rdrr.io/cran/Momocs/man/classification_metrics.html
https://blog.revolutionanalytics.com/2016/03/com_class_eval_metrics_r.html
https://github.com/saidbleik/Evaluation
A list with 4 objects:
Name. Helpful if this function is put into a loop and the output is meant to be written into a separate text file. Otherwise, just leave blank.
Contingency table used for calculating classification metrics by Momocs.
Metrics calculated by Momocs.
MCC value calculated by mltools labeled.
Other Classification functions:
CVPredictionsRandomForest()
,
CVRandomForestClassificationMatrixForPheatmap()
,
GenerateExampleDataMachinelearnr()
,
LOOCVPredictionsRandomForestAutomaticMtryAndNtree()
,
LOOCVRandomForestClassificationMatrixForPheatmap()
,
RandomForestAutomaticMtryAndNtree()
,
RandomForestClassificationGiniMatrixForPheatmap()
,
RandomForestClassificationPercentileMatrixForPheatmap()
,
find.best.number.of.trees()
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 | id = c("1a", "1b", "1c", "1d", "1e", "1f", "1g", "2a", "2b", "2c", "2d", "2e", "2f", "3a",
"3b", "3c", "3d", "3e", "3f", "3g", "3h", "3i")
x = c(18, 21, 22, 24, 26, 26, 27, 30, 31, 35, 39, 35, 30, 40, 41, 42, 44, 46, 47, 48, 49, 54)
y = c(10, 11, 22, 15, 12, 13, 14, 33, 39, 37, 44, 40, 45, 27, 29, 20, 28, 21, 30, 31, 23, 24)
a = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
b = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
actual = as.factor(c("1", "1", "1", "1", "1", "1", "1", "2", "2", "2", "2", "2", "2", "3", "3", "3",
"3", "3", "3", "3", "3", "3"))
example.data <- data.frame(id, x, y, a, b, actual)
set.seed(2)
rf.result <- randomForest::randomForest(x=example.data[,c("x", "y", "a", "b")],
y=example.data[,"actual"], proximity=TRUE)
predicted <- rf.result$predicted
actual <- example.data[,"actual"]
results <- eval.classification.results(as.character(actual), as.character(predicted), "Example")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.