undersample_kmeans: Undersample a dataset by kmeans clustering.

View source: R/undersample.R

undersample_kmeansR Documentation

Undersample a dataset by kmeans clustering.

Description

Undersample a dataset by kmeans clustering.

Usage

undersample_kmeans(data, cls, cls_col, m, k = 5, ...)

Arguments

data

Dataset to be undersampled.

cls

Class to be undersampled.

cls_col

Column containing class information.

m

Number of samples in undersampled dataset.

k

Number of centers in clustering.

...

Additional arguments passed to kmeans()

Value

The undersampled dataframe containing only instances of cls.

Examples

table(iris$Species)
undersamp <- undersample_kmeans(iris, "setosa", "Species", 15)
nrow(undersamp)

scutr documentation built on Nov. 18, 2023, 1:08 a.m.