Description Usage Arguments Examples
Downsamples the majority class in binary classification setting to the size of minority class by randomly selecting majority class to match the number of minority class
1 2 | downsample_majority(x, classVarName, arrangeVarName, seed = 100,
shuffle = FALSE)
|
x |
A dataframe |
classVarName |
Name of the binary class column |
arrangeVarName |
Name of the variable to arrange by |
seed |
Seed chosen for sampling, defaults to 100 |
shuffle |
Whether to shuffle the dataframe at the end. This cannot be TRUE when arrangeVarName is specified. Shuffle used the seed value seed + 1. |
1 2 3 4 | iris2 <- iris[c(1:25, 51:100), ]
iris2$Species <- factor(iris2$Species)
sampled <- downsample_majority(iris2, "Species")
table(sampled$Species)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.