我正在尝试使用sklearn LabelEncoder,但它说它没有属性classes_,但它存在,我不知道是什么问题。这是我的代码片段
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_'
森栏
相关分类