过采样不会生成新样本

时间:2018-01-24 07:04:24

标签: python-2.7 machine-learning scikit-learn oversampling imblearn

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

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

我正在使用python-imblearn对少数群体进行过度抽样。使用regular后,我可以生成200个6级样本,但l1borderlinel2borderline我无法这样做。

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})

有什么数学或我遗失的东西吗?

0 个答案:

没有答案