import numpy as np import math t=np.array([400,330,369,232,540]) eps=1e-4 around=0.1 theta0=np.random.random() theta1=np.random.random() theta2=np.random.random() x=np.array([2104,3],[1600,3],[2400,3],[1416,2],[3000,4]) e0=1 e1=1 e2=1 while e0>=eps or e1>=eps or e2>=eps : i=0 theta0=theta0-around*e0 theta1=theta1-around*e1 theta2=theta2-around*e2 print(theta0,theta1,theta2)
梯度算法作业
最新推荐文章于 2024-09-06 10:38:06 发布