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.
Usage
morie_ml_apply_smote(X, y, random_state = 42L, k_neighbors = NULL)
Arguments
- X
Feature data.frame.
- y
Binary outcome vector (numeric or factor).
- random_state
Integer seed for the random fallback. Default 42.
- k_neighbors
Integer or NULL. SMOTE neighbour count; auto-picked
to min(5, minority - 1) when NULL.
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).