<jupyter_start><jupyter_text>作業目標:    寫出 ReLU & dReLU 一階導數    並列印  作業重點 Rectified Linear Unit- Relu f(x)=max(0,x)<jupyter_code>import numpy as np
from numpy import *
import matplotlib.pylab as plt
%matplotlib inline

'''
作業:
    寫出 ReLU & dReLU 一階導數
    並列印
'''
def ReLu(x):
    return x * (x >= 0)

x = plt.linspace(-10,10,100)

plt.plot(x, ReLu(x), 'b', label='linspace(-10,10,10)')

plt.grid()

# 顯現圖示的Title
plt.title('ReLu Function')

plt.text(4, 0.8, 'ReLu', fontsize=15)

#resize the X and Y axes
plt.gca().xaxis.set_major_locator(plt.MultipleLocator(1))
plt.gca().yaxis.set_major_locator(plt.MultipleLocator(1))
 
# create the graph
plt.show()
def dReLu(x):
    return 1 * (x >= 0)

x = plt.linspace(-10,10,100)

plt.plot(x, dReLu(x), 'b', label='linspace(-10,10,10)')

plt.grid()

# 顯現圖示的Title
plt.title('dReLu Function')

plt.text(4, 0.8, 'dReLu', fontsize=15)

#resize the X and Y axes
plt.gca().xaxis.set_major_locator(plt.MultipleLocator(1))
plt.gca().yaxis.set_major_locator(plt.MultipleLocator(1))
 
# create the graph
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17148182665424044, 'fraction_numerical': 0.04100652376514446, 'mean_word_length': 4.805405405405406, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '308884', 'license': 'MIT', 'n_tokens_mistral': 547, 'n_tokens_neox': 511, 'n_words': 94, 'path': 'D72_啟動函數/Day72-Activation_function_HW.ipynb', 'repo_name': 'jacky0405/100Days_ML_Marathon', 'size': '1073'}