【发布时间】:2020-04-14 14:52:02
【问题描述】:
我正在使用 imblearn over_sampling SMOTE 技术来平衡我的不平衡数据集。
这是我的示例代码
import pandas as pd
dataset=pd.read_csv('E://IOT_Netlume//hourly_data.csv')
features= dataset.iloc[:,[1,2,3,4]]
target= dataset.iloc[:,[5]]
from imblearn.over_sampling import SMOTE
# applying SMOTE to our data and checking the class counts
resampled, yresampled = SMOTE(random_state=42).fit_resample(features, target)
所以当我尝试拟合 SMOTE 模型时,它会显示属性错误。 AttributeError: 'DataFrame' object has no attribute 'name' 。有人可以帮我解决这个问题吗?
我还安装了 pip 库
Windows-10-10.0.15063-SP0 Python 3.6.5 |Anaconda, Inc.| (默认,三月 29 2018, 13:32:41) [MSC v.1900 64 位 (AMD64)] NumPy 1.17.4 SciPy 1.3.2 Scikit-Learn 0.22 以上是安装的版本。
功能和目标输出 features output target output
【问题讨论】:
-
能否请您打印特征和目标并显示其输出?
-
@Lakshmi-Intel 我已经编辑了我的帖子,请查看并帮助我。
标签: python-3.x dataframe oversampling imblearn smote