如何修复:使用提供的比率设置不会生成任何样本。(不学习)

ome*_*bey 6 resampling python-3.x scikit-learn imblearn

我有这个代码:

从 imblearn.over_sampling 导入 ADASYN

Y = df.target
X = df.drop('target', axis=1)

ad = ADASYN()
X_adasyn, y_adasyn = ad.fit_sample(X, Y)

getting this error:

ValueError: No samples will be generated with the provided ratio 
settings.
Run Code Online (Sandbox Code Playgroud)

小智 6

我也遇到这个问题,终于解决了!

  1. 你应该使用采样策略而不是比率
  2. Sample_Strategy='少数'

我尝试了其他选项,例如 'not_majority' 、'auto' 和字典形式,它们都给出了以下错误

值错误:使用提供的比率设置不会生成任何样本

但“少数”起作用了。


小智 2

把它变成两个。有github,它明确指出:

if not np.sum(n_samples_generate):
                raise ValueError("No samples will be generated with the"
                                 " provided ratio settings.")
Run Code Online (Sandbox Code Playgroud)

但是,是啊……#