Advertisement
fabioceep

Python: Um neuronio

Jun 20th, 2020
1,188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.22 KB | None | 0 0
  1. import random
  2. import numpy as np
  3.  
  4. def derivadas(n):
  5.     return n * (1 - n)
  6. x = 0.85
  7. y = 0.51
  8. w = random.random()
  9.  
  10. for i in range(10):
  11.     a = np.tanh(x * w)
  12.     e = y - a
  13.     w += x * derivadas(e)
  14.     print (a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement