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
- Edited nearest neighbors
- 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?