Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

undersample_kmeans

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.

Value

The undersampled dataframe containing only instances of cls.

Examples

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

scutr

Balancing Multiclass Datasets for Classification Tasks

v0.1.2
MIT + file LICENSE
Authors
Keenan Ganz [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.