compare_classifiers: Comparing Classifiers' Performance

Description Usage Arguments Details Value Examples

View source: R/model.R

Description

Fits five commonly used classifiers on data and compare their performance based on AROC.

Usage

1
compare_classifiers(recipe, test_df, target_lab = Y)

Arguments

recipe

A parsnip recipe object.

test_df

Test data frame to test model performances.

target_lab

Label used in the target feature to indicate positive outcome. Default value is Y.

Details

Value

Returns following two things:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
  library(tidymodels)
  split <- rsample::initial_split(wine, strata = quality_bin)
  train <- rsample::training(split)
  test <- rsample::testing(split)
  recipe <- recipes::recipe(quality_bin ~ ., data = train) %>%
  update_role(ID, new_role = 'identification') %>%
  step_string2factor(all_nominal()) %>%
  step_knnimpute(all_predictors()) %>%
  step_normalize(all_numeric())

  compare_classifiers(recipe = recipe, test_df = test, target_lab = 1)

Curious-Joe/mixBag documentation built on Aug. 30, 2021, 6:48 p.m.