Advertisement
Guest User

lista6_1_kosowskie

a guest
Dec 10th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. import numpy as np;
  2. from matplotlib import pyplot
  3.  
  4. X = np.arange(-15,15,0.1)
  5. def ReLU(X):
  6.    return np.maximum(0,X)
  7.  
  8. Y = ReLU(X);
  9.  
  10. pyplot.plot(X, Y)
  11.  
  12. def Sigmoid(X):
  13.    return 1/(1+np.exp(-X))
  14.  
  15. R = Sigmoid(X);
  16.  
  17. pyplot.plot(X, R)
  18.  
  19. def Softmax(X):
  20.     ulamek_1 = np.exp(X)
  21.     ulamek_2 = np.sum(np.exp(X))
  22.     return ulamek_1/ulamek_2
  23.  
  24. def Tanh(X):
  25.   ulamek_1 = np.exp(X)-np.exp(-X)
  26.   ulamek_2 = np.exp(X)+np.exp(-X)
  27.   return ulamek_1/ulamek_2
  28.  
  29. S = Tanh(X)
  30.  
  31. pyplot.plot(X, S)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement