用户可以从sklearn Bunch中获得Bunch.feature_names形式的“列标题”。然而,这并没有给出目标变量的“列标题”。如何获得目标变量的“列标题”?
例如,对于Iris数据集:
>>> data.feature_names
['sepal length (cm)', 'sepal width (cm)', 'petal length (cm)', 'petal width(cm)']在这种精神下,目标变量的“列头”应该类似于“物种”(因为data.target_names提供了array(['setosa', 'versicolor', 'virginica'], dtype='<U10')。sklearn Bunch有没有办法获得目标的“列头”,例如“物种”?
发布于 2018-06-16 00:43:49
你真正想要的东西是不可能的。但是,您可以执行以下操作:
from sklearn.datasets import load_iris
data = load_iris()
print(data.DESCR)并阅读描述
The data set contains 3 classes of 50 instances each, where each class refers to a type of iris plant.
https://stackoverflow.com/questions/50877785
复制相似问题