Hi I’m working on a machine learning project, and I want to perform undersampling because my target variable is highly imbalance (96% and 4%). It’s important for my analysis to maintain the stratified structure of the data. How do I do it?
I’m using this code:
downsampled_data <- downSample(x = train[, -which(names(train) == "Target")],
y = train$Target,
yname = "Target")
How do I speciify the percentage I want from each class?