PerformanceMetrics: Report table with the performance metrics for tree-based...

View source: R/PerformanceMetrics.R

PerformanceMetricsR Documentation

Report table with the performance metrics for tree-based learning methods

Description

Report table with the performance metrics for tree-based learning methods

Usage

PerformanceMetrics(
  testdata,
  DT = NULL,
  RF = NULL,
  GBM = NULL,
  outcome,
  reflevel
)

Arguments

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.

Value

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.

Examples


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")


LOGANTree documentation built on June 23, 2022, 1:06 a.m.