View source: R/PerformanceMetrics.R
PerformanceMetrics | R Documentation |
Report table with the performance metrics for tree-based learning methods
PerformanceMetrics( testdata, DT = NULL, RF = NULL, GBM = NULL, outcome, reflevel )
testdata |
A test dataset that contains the study’s features and the outcome variable. |
DT |
A fitted decision tree model object |
RF |
A fitted random forest model object |
GBM |
A fitted gradient boosting model object |
outcome |
A factor variable with the outcome levels. |
reflevel |
A character string with the quoted reference level of outcome. |
This function returns a data.frame
with a table that compares five performance metrics from different tree-based machine learning methods. The metrics are: Accuracy, Kappa, Sensitivity, Specificity, and Precision. The results are derived from the confusionMatrix function from the caret package.
colnames(training)[14] <- "perf" ensemblist <- TreeModels(traindata = training, methodlist = c("dt", "rf","gbm"),checkprogress = TRUE) PerformanceMetrics(testdata = testing, RF = ensemblist$ModelObject$ranger, outcome = "outcome", reflevel = "correct") PerformanceMetrics(testdata = testing, RF = ensemblist$ModelObject$ranger, GBM = ensemblist$ModelObject$gbm, outcome = "outcome", reflevel = "correct") PerformanceMetrics(testdata = testing, DT = ensemblist$ModelObject$rpart, RF = ensemblist$ModelObject$ranger, GBM = ensemblist$ModelObject$gbm, outcome = "outcome", reflevel = "correct")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.