from sklearn.datasets import make_classification from collections import Counter from imblearn.over_sampling import RandomOverSampler X, y = make_classification(n_samples=5000, n_features=2, n_informative=2, n_redundant=0, n_repeated=0, n_classes=3, n_clusters_per_class=1, weights=[0.01, 0.05, 0.94], class_sep=0.8, random_state=0) # Counter(y) print(X) print(y) ros = RandomOverSampler(random_state=0) X_resampled, y_resampled = ros.fit_sample(X, y) print(X_resampled) # sorted(Counter(y_resampled).items())