Description Usage Arguments Details Value Examples
Fits five commonly used classifiers on data and compare their performance based on AROC.
1 | compare_classifiers(recipe, test_df, target_lab = Y)
|
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. |
Make sure the recipe object entered is at pre-prepped stage
Five models compared are: logistic regression, elastic net, random forest, support vector machine, xtreme gradient boosting.
Returns following two things:
A line plot showing comparative area under the ROC curve score
A tibble containing the test data along with the predicted probability calculated by the five classifiers.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.