当前位置:网站首页>Tensorflow realize parameter adjustment of linear equations
Tensorflow realize parameter adjustment of linear equations
2022-08-09 10:46:00 【qq_26391203】
import tensorflow as tfimport numpy as np#create datax_data=np.random.rand(100).astype(np.float32)y_data=x_data*0.1+0.3 #target resultspan>#create tensorflow structure startWeights=tf.Variable(tf.random_uniform([1],-1.0,1.0))biases=tf.Variable(tf.zeros([1])) # The weights and biases are continuously learned from the initial value and approach the target valuey=Weights*x_data+biasesloss=tf.reduce_mean(tf.square(y-y_data))# mean square erroroptimizer=tf.train.GradientDescentOptimizer(0.5)train=optimizer.minimize(loss)init=tf.initialize_all_variables()# create tensorflow structure endsess=tf.Session()sess.run(init) #points to the processing placefor step in range(201):sess.run(train)if step%20==0:print(step,sess.run(Weights),sess.run(biases))Experiment results: 
The final experimental results shown above show that Weight is close to the target value of 0.1, and biases is close to the target value of 0.3
边栏推荐
- 2022强网杯WP
- unix环境编程 第十四章 14.8 存储映射I/O
- activemq 消息持久化
- Win7 远程桌面限制IP
- 机器学习-逻辑回归(logistics regression)
- cesium加载地图
- AQS同步组件-FutureTask解析和用例
- How tall is the B+ tree of the MySQL index?
- shell脚本实战(第2版)/人民邮电出版社 脚本2 验证输入:仅限字母和数字
- 解决1.tensorflow运行使用CPU不使用GPU 2.tensorflow环境下的GPU版本号 3.tensorflow和cuda以及cudnn版本对应问题 4.查看cuda和cudnn版本
猜你喜欢

activemq 消息持久化

研发需求的验收标准应该怎么写? | 敏捷实践

2022年台湾省矢量数据(点线面)及数字高程数据下载

OneNote 教程,如何在 OneNote 中搜索和查找笔记?

Shell script combat (2nd edition) / People's Posts and Telecommunications Press Script 2 Validate input: letters and numbers only

机器学习-逻辑回归(logistics regression)

相关系数计算,热力图绘制,代码实现
![[Error record] Solve the problem that ASRock J3455-ITX cannot be turned on without a monitor plugged in](/img/a9/d6aba07e6a4e1536cd10d91f274b2e.jpg)
[Error record] Solve the problem that ASRock J3455-ITX cannot be turned on without a monitor plugged in

The complete grammar of CSDN's markdown editor

【原创】JPA中@PrePersist和@PreUpdate的用法
随机推荐
[华为云在线课程][SQL语法分类][数据操作][学习笔记]
华为VRRP+MSTP联动接口检测实验案例
Cluster understanding
activemq message persistence
乘积量化(PQ)
实测办公场景下,国产远程控制软件的表现力如何?(技术解析)
Win32控件--------------------WM_DRAWITEM消息测试程序
tensorflow和numpy对应的版本,报FutureWarning: Passing (type, 1) or ‘1type‘ as a synonym of type is deprecate
Cpolar内网穿透的面板功能介绍
商业技术解决方案与高阶技术专题 - 数据可视化专题
【原创】JPA中@PrePersist和@PreUpdate的用法
Since I use the HiFlow scene connector, I don't have to worry about becoming a "dropper" anymore
OpenGL ES2.0编程三部曲(转载自MyArrow)
相伴成长,彼此成就 用友U9 cloud做好制造业数智化升级的同路人
2022年台湾省矢量数据(点线面)及数字高程数据下载
百度云大文件网页直接下载
MySQL索引的B+树到底有多高?
用Word写代码
cnn的输入输出
1003 我要通过! (20 分)