from sklearn import datasets
iris=datasets.load_iris
X = iris.data
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-15-12a2d725131f> in <module>()
----> 1 X = iris.data
AttributeError: 'function' object has no attribute 'data
I load iris dataset from sklearn ,but when i write "X = iris.data",an error occur as "AttributeError: 'function' object has no attribute 'data'"
答案 0 :(得分:6)
load_iris
是一个函数,需要这样调用:
from sklearn import datasets
iris=datasets.load_iris()
X = iris.data
答案 1 :(得分:0)
使用load_iris()
代替load_iris
,像这样,
iris = datasets.load_iris()