实际情况是:在读取文件中的“类别”信息,将类别信息转为id,且顺序按照原来的数据顺序排序
labels = list(data['product_classification']) unordered = set(labels) print("unorderd_class: ",unordered) order = sorted(unordered, key=labels.index) print("ordered_class: ", order) label_ = dict(zip(order, range(len(order)))) labels_true = data["product_classification"].map(label_)