<jupyter_start><jupyter_text><jupyter_code>import numpy as np
import matplotlib.pyplot as plt<jupyter_output><empty_output><jupyter_text>階梯<jupyter_code>def setp_func(x):
  return np.where(x > 0, 1, 0)

x = np.linspace(-10, 10)

plt.plot(x, setp_func(x))<jupyter_output><empty_output><jupyter_text>Sigmoid<jupyter_code>def sigmoid(x):
  exp = np.exp(-x)
  return 1/(1 + exp)
  
plt.plot(x, sigmoid(x))<jupyter_output><empty_output><jupyter_text>Tanh將輸出控制在 -1 ~ 1 之間<jupyter_code>plt.plot(x, np.tanh(x))<jupyter_output><empty_output><jupyter_text>ReLU大於 0 輸出 X 否則為 0<jupyter_code>def relu(x):
  return np.where(x > 0, x, 0)

plt.plot(x, relu(x))<jupyter_output><empty_output><jupyter_text>identityy = x<jupyter_code>def identity(x):
  return x

plt.plot(x, identity(x))<jupyter_output><empty_output><jupyter_text>Softmax常用來做分類問題<jupyter_code>def softmax(x):
  exp = np.exp(x)
  return exp / np.sum(exp)

print(softmax(np.arange(5)))<jupyter_output>[0.01165623 0.03168492 0.08612854 0.23412166 0.63640865]
{'fraction_non_alphanumeric': 0.15453639082751744, 'fraction_numerical': 0.06081754735792622, 'mean_word_length': 7.655172413793103, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 30, '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': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '619963', 'license': 'MIT', 'n_tokens_mistral': 535, 'n_tokens_neox': 499, 'n_words': 61, 'path': 'activation function.ipynb', 'repo_name': 'BoshiLee/APIPratice', 'size': '1003'}