当前位置:网站首页>MLP (multilayer perceptron neural network) is a multilayer fully connected neural network model.
MLP (multilayer perceptron neural network) is a multilayer fully connected neural network model.
2022-07-06 21:01:00 【wx5d786476cd8b2】
MLP( Multilayer perceptron neural network ) That is, multi-layer fully connected neural network model .
from keras.datasets import mnist
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers import Dense,Dropout,Activation
batch_size=128
nb_classes=10
nb_epoch=10
img_size=28*28
(x_train,y_train),(x_test,y_test)=mnist.load_data("E:\Code\PycharmProjects\KerasStudying\data\mnist.npz")
x_train=x_train.reshape(-1,img_size).astype('float32')/255
x_test=x_test.reshape(-1,img_size).astype('float32')/255
y_train=np_utils.to_categorical(y_train,nb_classes)
y_test=np_utils.to_categorical(y_test,nb_classes)
model=Sequential([
Dense(512,input_shape=(img_size,),activation='relu',),
Dropout(0.2),
Dense(512,input_shape=(512,),activation='relu'),
Dropout(0.2),
Dense(10,input_shape=(512,),activation='softmax'),
])
model.summary()
model.compile(optimizer='rmsprop',loss='categorical_crossentropy',metrics=['accuracy'])
model.fit(x_train,y_train,batch_size=batch_size,epochs=10,verbose=0,validation_data=(x_test,y_test))
score=model.evaluate(x_test,y_test,verbose=0)
print('accuracy:'+str(score[1]))
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.

边栏推荐
- 使用.Net分析.Net达人挑战赛参与情况
- Mécanisme de fonctionnement et de mise à jour de [Widget Wechat]
- 什么是RDB和AOF
- 1500万员工轻松管理,云原生数据库GaussDB让HR办公更高效
- 基于深度学习的参考帧生成
- [DSP] [Part 2] understand c6678 and create project
- 2022 portal crane driver registration examination and portal crane driver examination materials
- Pat 1078 hashing (25 points) ⼆ times ⽅ exploration method
- 3D face reconstruction: from basic knowledge to recognition / reconstruction methods!
- 知识图谱构建流程步骤详解
猜你喜欢

基于STM32单片机设计的红外测温仪(带人脸检测)

性能测试过程和计划

Database - how to get familiar with hundreds of tables of the project -navicat these unique skills, have you got it? (exclusive experience)

New database, multidimensional table platform inventory note, flowus, airtable, seatable, Vig table Vika, Feishu multidimensional table, heipayun, Zhixin information, YuQue
![[weekly pit] information encryption + [answer] positive integer factorization prime factor](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[weekly pit] information encryption + [answer] positive integer factorization prime factor

2022菲尔兹奖揭晓!首位韩裔许埈珥上榜,四位80后得奖,乌克兰女数学家成史上唯二获奖女性

Common English vocabulary that every programmer must master (recommended Collection)

Detailed explanation of knowledge map construction process steps

(工作记录)2020年3月11日至2021年3月15日
![[DIY]如何制作一款個性的收音機](/img/fc/a371322258131d1dc617ce18490baf.jpg)
[DIY]如何制作一款個性的收音機
随机推荐
'class file has wrong version 52.0, should be 50.0' - class file has wrong version 52.0, should be 50.0
【微信小程序】运行机制和更新机制
2017 8th Blue Bridge Cup group a provincial tournament
None of the strongest kings in the monitoring industry!
Opencv learning example code 3.2.3 image binarization
Common English vocabulary that every programmer must master (recommended Collection)
c#使用oracle存储过程获取结果集实例
##无yum源安装spug监控
Laravel笔记-自定义登录中新增登录5次失败锁账户功能(提高系统安全性)
Swagger UI教程 API 文档神器
硬件开发笔记(十): 硬件开发基本流程,制作一个USB转RS232的模块(九):创建CH340G/MAX232封装库sop-16并关联原理图元器件
The biggest pain point of traffic management - the resource utilization rate cannot go up
Pycharm remote execution
Reviewer dis's whole research direction is not just reviewing my manuscript. What should I do?
Application layer of tcp/ip protocol cluster
2022 nurse (primary) examination questions and new nurse (primary) examination questions
Intel 48 core new Xeon run point exposure: unexpected results against AMD zen3 in 3D cache
KDD 2022 | 通过知识增强的提示学习实现统一的对话式推荐
R语言可视化两个以上的分类(类别)变量之间的关系、使用vcd包中的Mosaic函数创建马赛克图( Mosaic plots)、分别可视化两个、三个、四个分类变量的关系的马赛克图
性能测试过程和计划