当前位置:网站首页>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
边栏推荐
- Lvs-dr mode multi segment case
- flutter 获取顶部状态栏的高度
- compiling stm32f4xx_it.c... “.\Objects\BH-F407.axf“ - 42 Error(s), 1 Warning(s).
- 检测点是否在多边形内
- How to choose an account opening broker? Is it safe to open an account online?
- 五、项目实战---识别人和马
- mysql之Unknown table ‘COLUMN_STATISTICS‘ in information_schema (1109)
- [summary] 1361- package JSON and package lock JSON relationship
- Iframe is simple to use, iframe is obtained, iframe element value is obtained, and iframe information of parent page is obtained
- RTOS 多线程下hardfault问题总结
猜你喜欢
Analysis of a video website m3u8 non perceptual encryption
声纹技术(六):声纹技术的其他应用
WebGL谷歌提示内存不够(RuntimeError:memory access out of bounds,火狐提示索引超出界限(RuntimeError:index out of bounds)
自定义注解之编译时注解(RetentionPolicy.CLASS)
对常用I/O模型进行比较说明
C language: count the number of words in a paragraph
浏览器查看当前页面所有的监听事件
jmeter中csv参数化
Fault: 0x800ccc1a error when outlook sends and receives mail
Unity--Configurable Joint——简单教程,带你入门可配置关节
随机推荐
C language: find all integers that can divide y and are odd numbers, and put them in the array indicated by B in the order from small to large
[operation tutorial] how does the tsingsee Qingxi video platform import the old database into the new database?
Stimulsoft ultimate presents reports and dashboards
How to increase the monthly salary of software testing from 10K to 30K? Only automated testing can do it
《乔布斯传》英文原著重点词汇笔记(二)【 chapter one】
Getting to know the generation confrontation network (11) -- using pytoch to build wgan to generate handwritten digits
RTOS 多线程下hardfault问题总结
通过客户经理的开户二维码开股票账户安全吗?还是去证券公司开户安全?
WebGL谷歌提示内存不够(RuntimeError:memory access out of bounds,火狐提示索引超出界限(RuntimeError:index out of bounds)
《乔布斯传》英文原著重点词汇笔记(一)【 Introduction 】
Wechat applet_ 7. Project practice, local life
城链科技平台,正在实现真正意义上的价值互联网重构!
Day 5 script and UI System
声纹技术(六):声纹技术的其他应用
tp6自动执行的文件是哪个?tp6核心类库有什么作用呢?
EasyPlayer流媒体播放器播放HLS视频,起播速度慢的技术优化
Is it safe to open a stock account through the account opening QR code of the account manager? Or is it safe to open an account in a securities company?
How safe is the new bond
声纹技术(一):声纹技术的前世今生
【515. 在每个树行中找最大值】