当前位置:网站首页>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
边栏推荐
- 对常用I/O模型进行比较说明
- 【515. 在每个树行中找最大值】
- 【期末复习笔记】数字逻辑
- Stimulsoft ultimate presents reports and dashboards
- Unity--configurable joint -- a simple tutorial to get you started with configurable joints
- 浏览器查看当前页面所有的监听事件
- 十大券商开户风险大吗,安全靠谱吗?
- Notes on key vocabulary of the original English work biography of jobs (I) [introduction]
- Data preprocessing: discrete feature coding method
- 在华泰证券上面开户好不好,安不安全?
猜你喜欢

Analysis of a video website m3u8 non perceptual encryption

Fault: 0x800ccc1a error when outlook sends and receives mail

Day 5 script and UI System

RMB 3000 | record "tbtools" video, make a friend and get a cash prize!

Wechat applet_ 7. Project practice, local life

微信小程序_7,项目练习,本地生活

atguigu----17-生命周期

二、训练fashion_mnist数据集

LVS-DR模式单网段案例

Easyplayer streaming media player plays HLS video. Technical optimization of slow starting speed
随机推荐
Lvs-dr mode multi segment case
cazy長安戰役八卦迷宮
[operation tutorial] how does the tsingsee Qingxi video platform import the old database into the new database?
一、单个神经元网络构建
ICer必须知道的35个网站
Unknown table 'column of MySQL_ STATISTICS‘ in information_ schema (1109)
Advanced technology Er, meet internship position information
[reinforcement learning notes] common symbols in reinforcement learning
声纹技术(七):声纹技术的未来
Notes on key words in the original English work biography of jobs (V) [chapter three]
2021 "Ai China" selection
cazy长安战役八卦迷宫
打新债安全性有多高啊
View all listening events on the current page by browser
Hyper-v:hyper-v generation 1 or generation 2 virtual machines
Iframe is simple to use, iframe is obtained, iframe element value is obtained, and iframe information of parent page is obtained
C language: bubble sort
[MySQL] understanding and use of indexes
compiling stm32f4xx_it.c... “.\Objects\BH-F407.axf“ - 42 Error(s), 1 Warning(s).
Analysis of a video website m3u8 non perceptual encryption