R port of morie.ml.apply_smote. Uses smotefamily::SMOTE when
installed and feasible; falls back to random oversampling (duplicate
minority rows) otherwise. Returns the resampled (X, y) together
with a status list of before/after counts and the method used.
Value
list(X, y, status) where status mirrors the Python dict
keys (method, minority_before, majority_before,
imbalance_ratio_before, total_before, total_after, plus
class_<label>_before / class_<label>_after).
Examples
if (requireNamespace("smotefamily", quietly = TRUE)) {
set.seed(2)
X <- data.frame(x1 = rnorm(50), x2 = rnorm(50))
y <- c(rep("a", 40), rep("b", 10))
out <- morie_ml_apply_smote(X, y, random_state = 1L, k_neighbors = 1L)
out$status$method
}
#> [1] "smote"
