【问题标题】:How to fix: No samples will be generated with the provided ratio settings. (imblearn)如何修复:使用提供的比率设置不会生成任何样本。 (imblearn)
【发布时间】:2019-09-29 16:37:36
【问题描述】:

我有这个代码:

从 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.

【问题讨论】:

  • 它们的功能及其默认参数似乎存在问题。具有默认参数的 ADAYSN 函数本身不起作用。
  • 您解决了这个问题吗?我也有同样的问题
  • 是的,我也是。解决办法是什么?
  • 当我不小心在已经平衡的数据集上运行 ADASYN 时出现此错误。
  • 解决办法是什么?

标签: python-3.x scikit-learn resampling imblearn


【解决方案1】:

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

  1. 您应该使用 sampling_strategy 而不是 ratio
  2. sampling_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.")
    

    但是,是的……#

    【讨论】:

      猜你喜欢
      • 2017-03-27
      • 1970-01-01
      • 1970-01-01
      • 2018-05-16
      • 2010-10-30
      • 1970-01-01
      • 2019-11-28
      • 2021-04-02
      • 2011-05-24
      相关资源
      最近更新 更多