Professional Documents
Culture Documents
Contoh Program 2
Contoh Program 2
x1 = np.array([42,33,33,45,39,36,32,41,40,38])
x2 = np.array([272,226,259,292,311,183,173,236,230,235])
y = np.array([95,77,80,100,97,70,50,80,92,84])
m = len(x1)
w1= 1
w2= 0
b=1
alpha =0.00006
print('it w1 w2 b J ')
for i in range(500):
J = 1/(2*m)*np.dot(w1_baru*x1+w2_baru*x2 + b_baru-y,w1_baru*x1+w2_baru*x2+b_baru-y)
w1 = w1_baru
w2 = w2_baru
b = b_baru
plt.plot(i,J,'-*')
break
plt.show()