基于Jupyter实现梯度下降案例(python)
梯度下降案例一、y=f(x)=x2二、z = f(x,y)=x2+y2 一、y=f(x)=x2 import numpy as np import pandas as pd from pandas import Series,DataFrame import matplotlib.pyplot as plt %matplotlib inline ##原函数 def f(x): return x**2 ##导数 def h(x): return 2*x X = [] Y = [] x = 2 step = 0.8 f_change = f(x) f_current = f(x)
下载地址
用户评论