【问题标题】:NumPy error while implementing feature engineering functions on array在数组上实现特征工程功能时出现 NumPy 错误
【发布时间】:2020-10-28 16:09:24
【问题描述】:

在下面给出的代码中,我正在为特征工程实现 autofeat 库。但是当我在google colab中运行代码时,它给出了一个错误,如下所述。

import autofeat as af
from sklearn.datasets import load_boston
data = load_boston()
x = data.data
y= data.target
clf = af.AutoFeatRegressor(x,y)
clf.fit_transform(x,y)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-6-7f5a5bb453d3> in <module>()
      5 y= data.target
      6 clf = af.AutoFeatRegressor(x,y)
----> 7 clf.fit_transform(x,y)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

reference code tutorial

【问题讨论】:

    标签: python numpy scikit-learn feature-engineering


    【解决方案1】:

    我相信你的错误是在定义 clf 时。您不需要指定 x 和 y。好像把事情搞砸了。

    尝试:clf = af.AutoFeatRegressor()

    【讨论】:

    • 非常感谢您的帮助!我会在 4 分钟内接受您的回答,请您为我的问题投票!
    • 还剩 2 分钟,我会接受您的回答,非常感谢您的支持
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-10-07
    • 1970-01-01
    • 1970-01-01
    • 2020-12-01
    • 1970-01-01
    • 2015-08-17
    • 1970-01-01
    相关资源
    最近更新 更多