一维标签转onehot
labels = [1,0,1,1,0]
new_label = []
一维变二维
for j in labels:
new_label.append([j])
print(“new_label===”, new_label)
对标签形式进行重构,转换成独热编码
def onehot(labels):
n_sample = len(labels)
n_class = max(labels) + 1...
原创
2019-05-26 11:01:43 ·
571 阅读 ·
0 评论