当前位置:网站首页>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.

边栏推荐
- 7、数据权限注解
- OAI 5G NR+USRP B210安装搭建
- Spark SQL chasing Wife Series (initial understanding)
- Activiti global process monitors activitieventlistener to monitor different types of events, which is very convenient without configuring task monitoring in acitivit
- 硬件开发笔记(十): 硬件开发基本流程,制作一个USB转RS232的模块(九):创建CH340G/MAX232封装库sop-16并关联原理图元器件
- 3D人脸重建:从基础知识到识别/重建方法!
- C # use Oracle stored procedure to obtain result set instance
- 监控界的最强王者,没有之一!
- PG basics -- Logical Structure Management (transaction)
- Statistical inference: maximum likelihood estimation, Bayesian estimation and variance deviation decomposition
猜你喜欢
![[DIY]如何制作一款個性的收音機](/img/fc/a371322258131d1dc617ce18490baf.jpg)
[DIY]如何制作一款個性的收音機

C language operators

OLED屏幕的使用
![[wechat applet] operation mechanism and update mechanism](/img/cf/58a62a7134ff5e9f8d2f91aa24c7ac.png)
[wechat applet] operation mechanism and update mechanism

Build your own application based on Google's open source tensorflow object detection API video object recognition system (IV)

Interviewer: what is the internal implementation of ordered collection in redis?

硬件开发笔记(十): 硬件开发基本流程,制作一个USB转RS232的模块(九):创建CH340G/MAX232封装库sop-16并关联原理图元器件

【mysql】游标的基本使用

Common doubts about the introduction of APS by enterprises

APS taps home appliance industry into new growth points
随机推荐
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,
[weekly pit] calculate the sum of primes within 100 + [answer] output triangle
OSPF多区域配置
How to upgrade high value-added links in the textile and clothing industry? APS to help
Statistical inference: maximum likelihood estimation, Bayesian estimation and variance deviation decomposition
C language operators
爱可可AI前沿推介(7.6)
正则表达式收集
C # use Oracle stored procedure to obtain result set instance
Detailed explanation of knowledge map construction process steps
What key progress has been made in deep learning in 2021?
数据湖(八):Iceberg数据存储格式
3D人脸重建:从基础知识到识别/重建方法!
Why do novices often fail to answer questions in the programming community, and even get ridiculed?
Kubernetes learning summary (20) -- what is the relationship between kubernetes and microservices and containers?
【OpenCV 例程200篇】220.对图像进行马赛克处理
Implementation of packaging video into MP4 format and storing it in TF Card
Dynamically switch data sources
Infrared thermometer based on STM32 single chip microcomputer (with face detection)
Summary of different configurations of PHP Xdebug 3 and xdebug2