Learn R Programming

folda (version 0.1.0)

getDownSampleInd: Helper Function to Generate Training Set Indices Through Downsampling

Description

This function selects the indices for the training set based on the class vector response. It allows for optional downsampling to balance the class distribution by limiting the number of samples per class.

Usage

getDownSampleInd(response, downSampling = FALSE, kSample = NULL)

Value

An integer vector of indices representing the selected samples from the original response vector.

Arguments

response

A factor vector representing the class labels.

downSampling

A logical value indicating whether downsampling should be applied. If TRUE, downsampling is performed to limit the number of samples per class based on kSample. Note that this may not result in equal class frequencies, as kSample defines an upper limit for each class, not a lower limit.

kSample

An integer specifying the maximum number of samples to be selected per class. If NULL, the number of samples is limited to the size of the smallest class.