出现:

/Users/wangchuang/anaconda3/lib/python3.6/site-packages/sklearn/utils/validation.py:547: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().
y = column_or_1d(y, warn=True)
通过查询,解决方法如下,

from imblearn.over_sampling import SMOTE # 导入SMOTE算法模块
# 处理不平衡数据
sm = SMOTE(random_state=42) # 处理过采样的方法
X, y = sm.fit_sample(X, y.values.ravel())

相关文章:

  • 2021-07-11
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-07
  • 2021-08-18
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
  • 2021-04-14
相关资源
相似解决方案