Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. def update_coef(learning_rate,error,w,data):
  2. ip = 1
  3. for i in range(len(data)-1):
  4. if ip==1: ## for first iteration to update the interept term
  5. w[0] = w[0]-learning_rate*error
  6. ip=ip+1
  7. vx = learning_rate * error * data[i]
  8. w[i + 1] = w[i + 1] - vx # updating rest of the coefficients
  9. return w
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement