【问题标题】:I am getting this error while using smote使用 smote 时出现此错误
【发布时间】:2021-08-17 10:19:39
【问题描述】:

enter image description here

# apply SMOTE to tackle class imbalance
from imblearn.over_sampling import SMOTE
sm = SMOTE(kind = "regular", k=1)
X_tr,y_tr = sm.fit_sample(X_train,y_train)
print(X_tr.shape)
print(y_tr.shape)

请帮我解决这个问题

【问题讨论】:

  • 不知道你用的是哪个版本的imblearn,但是最新版本好像没有带任何参数叫做“kind”:github.com/scikit-learn-contrib/imbalanced-learn/blob/…
  • 始终将代码、数据和完整的错误消息作为文本(不是截图,不是链接)放在有问题的地方(不是评论)。

标签: python imblearn smote


【解决方案1】:

SMOTE 过采样算法没有您建议的称为kind 的参数,就documentation 而言。

类 imblearn.over_sampling.SMOTE(*, sampling_strategy='auto', random_state=None, k_neighbors=5, n_jobs=None)

如果您的意思是对minoritynot minority 等进行过采样,则该参数为sampling_strategy,默认为auto

sm = SMOTE(sampling_strategy = "minority")

【讨论】:

    猜你喜欢
    • 2016-12-11
    • 1970-01-01
    • 2019-08-07
    • 1970-01-01
    • 2021-11-13
    • 1970-01-01
    • 2023-02-01
    • 2013-07-06
    • 1970-01-01
    相关资源
    最近更新 更多