Imbalanced data is a big problem in classification problems. I have a binary classification problem with imbalanced data.

I have researched and found that a possible method of dealing with this is preprocessing the data before plugging it into a model. My data looks like this example using iris:

# Create unbalanced binary dataset (Remove 'versicolor')
 data <- iris[-c(95:130),]
 data <- data[data$Species == c("setosa","virginica"),]
 # Show that data is imbalanced
 table(data$Species) / sum(table(data$Species))

How can I implement

  1. Edited nearest neighbors
  2. Smote
  3. Tomek links

in R in order to preprocess the data before fitting a model? Which packages could I use particularly for a binary classification problem rather than the multiclass case?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.