keras中to_categorical()函数解析

 

from keras.utils.np_utils import *

# 类别向量定义
b = [0, 1, 2, 3, 4, 5, 6, 7, 8]
# 调用to_categorical将b按照9个类别来进行转换
b = to_categorical(b, 9)
print(b)

 

来源:https://blog.csdn.net/moyu123456789/article/details/83444140

posted on 2019-08-26 23:10  一杯明月  阅读(5754)  评论(0编辑  收藏  举报