当前位置:网站首页>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.
边栏推荐
- 全网最全的知识库管理工具综合评测和推荐:FlowUs、Baklib、简道云、ONES Wiki 、PingCode、Seed、MeBox、亿方云、智米云、搜阅云、天翎
- 使用.Net分析.Net达人挑战赛参与情况
- Activiti global process monitors activitieventlistener to monitor different types of events, which is very convenient without configuring task monitoring in acitivit
- KDD 2022 | 通过知识增强的提示学习实现统一的对话式推荐
- None of the strongest kings in the monitoring industry!
- [diy] self designed Microsoft makecode arcade, official open source software and hardware
- Utilisation de l'écran OLED
- SAP Fiori应用索引大全工具和 SAP Fiori Tools 的使用介绍
- Build your own application based on Google's open source tensorflow object detection API video object recognition system (IV)
- [asp.net core] set the format of Web API response data -- formatfilter feature
猜你喜欢
Performance test process and plan
全网最全的新型数据库、多维表格平台盘点 Notion、FlowUs、Airtable、SeaTable、维格表 Vika、飞书多维表格、黑帕云、织信 Informat、语雀
PHP saves session data to MySQL database
SSO single sign on
2022菲尔兹奖揭晓!首位韩裔许埈珥上榜,四位80后得奖,乌克兰女数学家成史上唯二获奖女性
面试官:Redis中有序集合的内部实现方式是什么?
Introduction to the use of SAP Fiori application index tool and SAP Fiori tools
Comment faire une radio personnalisée
【DSP】【第一篇】开始DSP学习
请问sql group by 语句问题
随机推荐
Web开发小妙招:巧用ThreadLocal规避层层传值
c#使用oracle存储过程获取结果集实例
Tips for web development: skillfully use ThreadLocal to avoid layer by layer value transmission
Yyds dry goods count re comb this of arrow function
请问sql group by 语句问题
[diy] self designed Microsoft makecode arcade, official open source software and hardware
审稿人dis整个研究方向已经不仅仅是在审我的稿子了怎么办?
Implementation of packaging video into MP4 format and storing it in TF Card
自定义限流注解
性能测试过程和计划
7、数据权限注解
Activiti global process monitors activitieventlistener to monitor different types of events, which is very convenient without configuring task monitoring in acitivit
面试官:Redis中有序集合的内部实现方式是什么?
华为设备命令
爱可可AI前沿推介(7.6)
PHP online examination system version 4.0 source code computer + mobile terminal
SAP Fiori应用索引大全工具和 SAP Fiori Tools 的使用介绍
过程化sql在定义变量上与c语言中的变量定义有什么区别
Use of OLED screen
Comment faire une radio personnalisée