首页
学习
活动
专区
圈层
工具
发布
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    (数据科学学习手札44)在Keras中训练多层感知机

    float32') #归一化 X_train /= 255 X_test /= 255 #将类别训练目标向量转换为二值类别矩阵,即one-hot处理,传入单值,返回制定长度的向量表示形式 Y_train = np_utils.to_categorical...(y_train, NB_CLASSES) Y_test = np_utils.to_categorical(y_test, NB_CLASSES) 至此,数据的预处理部分结束,下面正式进行MLP的模型搭建和训练过程...(y_train, NB_CLASSES) Y_test = np_utils.to_categorical(y_test, NB_CLASSES) '''网络结构搭建部分''' #定义模型为keras...(y_train, NB_CLASSES) Y_test = np_utils.to_categorical(y_test, NB_CLASSES) '''网络结构搭建部分''' #定义模型为keras...(y_train, NB_CLASSES) Y_test = np_utils.to_categorical(y_test, NB_CLASSES) '''网络结构搭建部分''' ##定义模型为keras

    1.8K60

    Python人工智能 | 十八.Keras搭建卷积神经网络及CNN原理详解

    np_utils.to_categorical(y_train, nb_classes=10) 调用up_utils将类标转换成10个长度的值,如果数字是3,则会在对应的地方标记为1,其他地方标记为0,...X_test.reshape(-1, 1, 28, 28) / 255 # normalize # 将类向量转化为类矩阵 数字 5 转换为 0 0 0 0 0 1 0 0 0 0 矩阵 y_train = np_utils.to_categorical...(y_train, num_classes=10) y_test = np_utils.to_categorical(y_test, num_classes=10) 第四步,创建神经网络第一层及池化层。...X_test.reshape(-1, 1, 28, 28) / 255 # normalize # 将类向量转化为类矩阵 数字 5 转换为 0 0 0 0 0 1 0 0 0 0 矩阵 y_train = np_utils.to_categorical...(y_train, num_classes=10) y_test = np_utils.to_categorical(y_test, num_classes=10) #----------------

    1.9K60
    领券