Description Usage Arguments Value Examples
Undersampling the majority class with rate = beta, where beta is the probability of selecting a negative instance during undersampling. The probability estimate is calibrated to adjust it for class prior change
1 2 |
task |
classification task to perform (see mlr package) |
lrn |
learner to use with the task (see mlr package) |
beta |
probability of selecting a negative instance during undersampling |
metrics |
metrics to asess classification performances |
rdesc |
resampling methods to use (see mlr package) |
positive |
value of the positive (minority) class |
negative |
value of the negative (majority) class |
verbose |
print extra information (logical variable) |
dirPlot |
directory where to save plots (set dirPlot=NA to avoid plots) |
ncore |
number of cores to use in multicore computation |
type |
way to apply undersampling: within or before the CV |
B |
number of models to create for each fold of the CV |
The function returns a list:
under |
results with undersampling |
cal |
results after calibration |
pred.under |
predictions with undersampling |
pred.cal |
predictions after calibration |
prob |
posterior probability of the classifier for the positive class |
1 2 3 4 5 6 7 8 9 | library(mlbench)
data(Ionosphere)
library(mlr)
task <- makeClassifTask(data=Ionosphere, target="Class", positive="bad")
library(randomForest)
rf <- makeLearner("classif.randomForest", predict.type = "prob")
metrics <- list(f1, auc)
library(warping)
res <- undersampling(task, rf, beta=0.6, metrics, positive="bad", negative="good")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.