【发布时间】:2019-07-03 03:40:03
【问题描述】:
我正在尝试使用sklearn LabelEncoder,但它说它没有属性classes_,但是它存在,我不知道是什么问题。这是我的代码的 sn-p
from sklearn.preprocessing import LabelEncoder
encoder = LabelEncoder()
def classes_():
#Return the classes which are classified by this model
return encoder.classes_
def num_of_classes():
"""
Return the number of ouput classes
"""
return len(classes_())
X=TimeDistributed(Dense(output_dim = num_of_classes(),293,activation = "softmax")
但是,我收到此错误 AttributeError: 'LabelEncoder' object has no attribute 'classes_'
【问题讨论】:
标签: python keras scikit-learn