Resampling toolkit for handling imbalanced datasets in machine learning
Toolbox for imbalanced dataset in machine learning
$ python -c "from imblearn.over_sampling import SMOTE; smote = SMOTE(); X_resampled, y_resampled = smote.fit_resample(X, y)"$ python -c "from imblearn.under_sampling import RandomUnderSampler; rus = RandomUnderSampler(); X_resampled, y_resampled = rus.fit_resample(X, y)"$ python -c "from imblearn.pipeline import Pipeline; from imblearn.over_sampling import SMOTE; from imblearn.under_sampling import TomekLinks; pipe = Pipeline([('smote', SMOTE()), ('tomek', TomekLinks())])"$ python -c "from imblearn.metrics import classification_report_imbalanced; print(classification_report_imbalanced(y_true, y_pred))"$ python -c "from imblearn.datasets import make_imbalance; from sklearn.model_selection import cross_validate; X, y = make_imbalance(X, y, sampling_strategy=0.5)"