undersample_mindist | R Documentation |
Undersample a dataset by iteratively removing the observation with the lowest total distance to its neighbors of the same class.
undersample_mindist(data, cls, cls_col, m, ...)
data |
Dataset to undersample. Aside from |
cls |
Class to be undersampled. |
cls_col |
Column containing class information. |
m |
Desired number of observations after undersampling. |
... |
Additional arguments passed to |
An undersampled dataframe.
setosa <- iris[iris$Species == "setosa", ]
nrow(setosa)
undersamp <- undersample_mindist(setosa, "setosa", "Species", 50)
nrow(undersamp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.