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

How to fix: No samples will be generated with the provided ratio settings. (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.

把它变成两个。有 github 并且明确表示:

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

但是,是啊……#

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

  1. 你应该使用 sampling_strategy 而不是比率
  2. sampling_strategy='minority'

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

Value Error: No samples will be generated with the provided ratio settings

但 'minority' 有效。