|
@@ -0,0 +1,16 @@
|
|
1
|
+from sklearn.datasets import make_classification
|
|
2
|
+from collections import Counter
|
|
3
|
+from imblearn.over_sampling import RandomOverSampler
|
|
4
|
+
|
|
5
|
+X, y = make_classification(n_samples=5000, n_features=2, n_informative=2,
|
|
6
|
+ n_redundant=0, n_repeated=0, n_classes=3,
|
|
7
|
+ n_clusters_per_class=1,
|
|
8
|
+ weights=[0.01, 0.05, 0.94],
|
|
9
|
+ class_sep=0.8, random_state=0)
|
|
10
|
+# Counter(y)
|
|
11
|
+print(X)
|
|
12
|
+print(y)
|
|
13
|
+ros = RandomOverSampler(random_state=0)
|
|
14
|
+X_resampled, y_resampled = ros.fit_sample(X, y)
|
|
15
|
+print(X_resampled)
|
|
16
|
+# sorted(Counter(y_resampled).items())
|