当前位置:网站首页>1、 Construction of single neural network
1、 Construction of single neural network
2022-06-25 08:51:00 【Beyond proverb】
One 、 I use the compiler for Jupyter Notebook,tensorflow Version is 1.13.1
import tensorflow as tf
print(tf.__version__)
""" 1.13.1 """
Two 、 Train a single neural network
x by -1.0, 0.0, 1.0, 2.0, 3.0, 4.0
y by -3.0, -1.0, 1.0, 3.0, 5.0, 7.0
It's easy to see with the brain y=2*x-1, Here we build a single neuron model to predict x=10.0 when ,y Value , The theory should be 19, Let's take a look at the performance of the model
from tensorflow import keras
import numpy as np
model = keras.Sequential([keras.layers.Dense(units=1,input_shape=[1])])
model.compile(optimizer='sgd',loss='mean_squared_error')
x = np.array([-1.0,0.0,1.0,2.0,3.0,4.0],dtype=float)
y = np.array([-3.0,-1.0,1.0,3.0,5.0,7.0],dtype=float)
model.fit(x,y,epochs=1000)
model.predict([10.0])
""" array([[18.999922]], dtype=float32) """
Final model training 1000 Time , The predicted result is 18.999922, And the actual real value 19 The difference is not too big
边栏推荐
- 声纹技术(四):声纹识别的工程部署
- The city chain technology platform is realizing the real value Internet reconstruction!
- Various synchronous learning notes
- Hyper-v:Hyper-v 第 1 代或第 2 代虚拟机
- 对常用I/O模型进行比较说明
- atguigu----18-组件
- Openfoam: bottom layer
- Unity发布webGL的时候JsonConvert.SerializeObject()转换失败
- Level 6 easy to mix words
- Wechat applet_ 7. Project practice, local life
猜你喜欢

C#程序终止问题CLR20R3解决方法

Fault: 0x800ccc1a error when outlook sends and receives mail

EasyPlayer流媒体播放器播放HLS视频,起播速度慢的技术优化

Exchange:管理日历权限

紧急行政中止令下达 Juul暂时可以继续在美国销售电子烟产品

The city chain technology platform is realizing the real value Internet reconstruction!

Meaning of Jieba participle part of speech tagging

Getting to know the generation confrontation network (11) -- using pytoch to build wgan to generate handwritten digits

Easyplayer streaming media player plays HLS video. Technical optimization of slow starting speed

城鏈科技平臺,正在實現真正意義上的價值互聯網重構!
随机推荐
How annotation lib and processor lib reference
【MYSQL】索引的理解和使用
Unity--Configurable Joint——简单教程,带你入门可配置关节
(翻译)采用字母间距提高全大写文本可读性的方式
Stimulsoft ultimate presents reports and dashboards
《乔布斯传》英文原著重点词汇笔记(五)【 chapter three 】
【515. 在每个树行中找最大值】
《乔布斯传》英文原著重点词汇笔记(四)【 chapter two 】
ICer必须知道的35个网站
SharePoint:SharePoint Server 2013 与 ADRMS 集成指南
Iframe is simple to use, iframe is obtained, iframe element value is obtained, and iframe information of parent page is obtained
cazy長安戰役八卦迷宮
106. 简易聊天室9:使用 Socket 传递音频
配置、软件配置项、软件配置管理项辨析
《乔布斯传》英文原著重点词汇笔记(三)【 chapter one】
《乔布斯传》英文原著重点词汇笔记(二)【 chapter one】
Exchange:管理日历权限
关于I/O——内存与CPU与磁盘之间的关系
What is the role of software validation testing? What is the price of the confirmation test report?
开户券商怎么选择?在线开户是安全么?