Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy
- from matplotlib import pyplot
- X = numpy.arange(-5,5,0.1)
- # ReLU
- def ReLU(X):
- return numpy.maximum(0,X)
- Y = ReLU(X);
- pyplot.plot(X,Y, c="blue")
- #Sigmoid
- def Sigmoid(X):
- return 1/(1+numpy.exp(-X))
- Z = Sigmoid(X);
- pyplot.plot(X,Z, c="red")
- #Tanh
- def Tanh(X):
- licznik = numpy.exp(X)-numpy.exp(-X)
- mianownik = numpy.exp(X)+numpy.exp(-X)
- return licznik/mianownik
- Z = Tanh(X)
- pyplot.plot(X, Z, c="green")
- pyplot.show()
- # Softmax
- M = numpy.array([[1,2,3], [4,5,6], [6,6,6]])
- x = numpy.array([1,2,3])
- x.T
- def Softmax(x):
- expo = numpy.exp(x)
- expo_sum = numpy.sum(numpy.exp(x))
- return expo/expo_sum
- M = Softmax(x);
- print(M)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement