当前位置:网站首页>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.
边栏推荐
- [DSP] [Part 2] understand c6678 and create project
- 什么是RDB和AOF
- 强化学习-学习笔记5 | AlphaGo
- Summary of different configurations of PHP Xdebug 3 and xdebug2
- 3D face reconstruction: from basic knowledge to recognition / reconstruction methods!
- Yyds dry goods count re comb this of arrow function
- 自定义限流注解
- 1500萬員工輕松管理,雲原生數據庫GaussDB讓HR辦公更高效
- How to turn a multi digit number into a digital list
- [weekly pit] calculate the sum of primes within 100 + [answer] output triangle
猜你喜欢
Reference frame generation based on deep learning
OAI 5g nr+usrp b210 installation and construction
Comprehensive evaluation and recommendation of the most comprehensive knowledge base management tools in the whole network: flowus, baklib, jiandaoyun, ones wiki, pingcode, seed, mebox, Yifang cloud,
Introduction to the use of SAP Fiori application index tool and SAP Fiori tools
监控界的最强王者,没有之一!
Core principles of video games
##无yum源安装spug监控
Detailed explanation of knowledge map construction process steps
知识图谱之实体对齐二
HMS Core 机器学习服务打造同传翻译新“声”态,AI让国际交流更顺畅
随机推荐
Select data Column subset in table R [duplicate] - select subset of columns in data table R [duplicate]
监控界的最强王者,没有之一!
Solution to the 38th weekly match of acwing
什么是RDB和AOF
Recyclerview GridLayout bisects the middle blank area
2017 8th Blue Bridge Cup group a provincial tournament
2022 refrigeration and air conditioning equipment installation and repair examination contents and new version of refrigeration and air conditioning equipment installation and repair examination quest
SAP Fiori应用索引大全工具和 SAP Fiori Tools 的使用介绍
Variable star --- article module (1)
Regular expression collection
Mtcnn face detection
2022 nurse (primary) examination questions and new nurse (primary) examination questions
What is the difference between procedural SQL and C language in defining variables
Spark SQL chasing Wife Series (initial understanding)
Entity alignment two of knowledge map
[MySQL] basic use of cursor
【微信小程序】运行机制和更新机制
Activiti global process monitors activitieventlistener to monitor different types of events, which is very convenient without configuring task monitoring in acitivit
Distributed ID
OLED屏幕的使用