Download our e-book of Introduction To Python
Kajal Pawar
3 years ago
def
relu_function(z):
return max(0, z)
def relu_prime_function(z):
return 1 if z > 0 else 0
# importing libraries
from matplotlib import pyplot
# create rectified linear function
def rectified(x):
return max(0.0, x)
# define a series of inputs
series_in = [x for x in range(-10, 11)]
# calculate outputs for our inputs
series_out = [rectified(x) for x in series_in]
# line plot of raw inputs to rectified outputs
pyplot.plot(series_in, series_out)
pyplot.show()