当前位置:网站首页>机器学习:梯度下降法
机器学习:梯度下降法
2022-06-24 19:28:00 【翁炜强】
import numpy as np
import tensorflow as tf
from matplotlib import pyplot as plt
x = tf.linspace(-10.0, 10.0, 100)
x=tf.Variable(x)#计算过程中x需转为变化张量
with tf.GradientTape() as tape: #追踪梯度
s=1/(1+tf.math.exp(-x))
grad=tape.gradient(s,x) #计算梯度
grad
plt.plot(x.numpy(),grad.numpy()) #x.numpy()表示数组
边栏推荐
猜你喜欢
随机推荐
【论】A deep-learning model for urban traffic flow prediction with traffic events mined from twitter
socket(1)
装修首页自定义全屏视频播放效果gif动态图片制作视频教程播放代码操作设置全屏居中阿里巴巴国际站
EditText controls the soft keyboard to search
介绍BootLoader、PM、kernel和系统开机的总体流程
[精选] 多账号统一登录,你如何设计?
leetcode:1504. 统计全 1 子矩形的个数
Antdb database online training has started! More flexible, professional and rich
传输层 udp && tcp
【吴恩达笔记】多变量线性回归
Analysis of tcpdump packet capturing kernel code
手动事务的几个类
Tutorial on obtaining JD cookies by mobile browser
123. the best time to buy and sell shares III
VirtualBox virtual machine installation win10 Enterprise Edition
Why are life science enterprises on the cloud in succession?
Visit Amazon memorydb and build your own redis memory database
#国企央企结构化面试#国企就业#墨斗互动就业服务管家
Implementing DNS requester with C language
leetcode_191_2021-10-15









