【问题标题】:Oversampling : SMOTE parameter 'ratio'过采样:SMOTE 参数“比率”
【发布时间】:2020-07-05 09:49:54
【问题描述】:

jupyter notebook 让我出错:

init() 得到了一个意外的关键字参数“比率”

我的代码:

smote = SMOTE(ratio = 'minority', random_state=10)

还可以尝试: smote = SMOTE(ratio = 0.5, random_state=10) 但它给了我同样的错误信息。

如何解决这个问题?谢谢。

【问题讨论】:

    标签: machine-learning cross-validation oversampling imbalanced-data imblearn


    【解决方案1】:

    查看这里的文档: https://imbalanced-learn.readthedocs.io/en/stable/generated/imblearn.over_sampling.SMOTE.html 参数“比率”不存在。 正确的论点是'sampling_strategy'。所以在代码中:

    smote=SMOTE(sampling_strategy='not minority',random_state=10) #equivalent to sampling_strategy=1.0 for binary classification, but also works for multiple classes
    #or
    smote=SMOTE(sampling_strategy=0.5,random_state=10) #only for binary classification
    

    【讨论】:

    • ratio 已弃用。现在 sampling_strategy 和 ratio 做的一样
    猜你喜欢
    • 2018-12-31
    • 2019-05-24
    • 1970-01-01
    • 2020-06-28
    • 2015-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-09
    相关资源
    最近更新 更多