0

我的数据集具有以下分布:

class   frequency
0         960
1         2093
2         22696
3         1116
4         2541
5         1298
6         14

python-imblearn用来对少数类进行过采样。使用regularsmote 我可以生成 200 个第 6 类的样本,但是使用l1borderline或者l2borderline我不能这样做。

from imblearn.over_sampling import SMOTE
sm=SMOTE(ratio={6:200})

# output
>>> Presampled shape Counter({2: 22696, 4: 2541, 1: 2093, 5: 1298, 3: 1116, 0: 960, 6: 14})
>>> resampled shape Counter({2: 22696, 4: 2541, 1: 2093, 5: 1298, 3: 1116, 0: 960, 6: 200})



sm=SMOTE(kind='borderline1',ratio={6:200})

# output
>>> Presampled shape Counter({2: 22696, 4: 2541, 1: 2093, 5: 1298, 3: 1116, 0: 960, 6: 14})
>>> resampled shape Counter({2: 22696, 4: 2541, 1: 2093, 5: 1298, 3: 1116, 0: 960, 6: 14})

sm=SMOTE(kind='borderline2',ratio={6:200})

# output
>>> Presampled shape Counter({2: 22696, 4: 2541, 1: 2093, 5: 1298, 3: 1116, 0: 960, 6: 14})
>>> resampled shape Counter({2: 22696, 4: 2541, 1: 2093, 5: 1298, 3: 1116, 0: 960, 6: 14})

有什么数学问题还是我错过了什么?

4

0 回答 0