powered by
Undersample a dataset by kmeans clustering.
undersample_kmeans(data, cls, cls_col, m, k = 5, ...)
The undersampled dataframe containing only instances of cls.
cls
Dataset to be undersampled.
Class to be undersampled.
Column containing class information.
Number of samples in undersampled dataset.
Number of centers in clustering.
Additional arguments passed to kmeans()
kmeans()
table(iris$Species) undersamp <- undersample_kmeans(iris, "setosa", "Species", 15) nrow(undersamp)
Run the code above in your browser using DataLab