Notice
Recent Posts
Recent Comments
Link
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

0과 1 사이

활성화 함수 본문

딥러닝 공부

활성화 함수

고후 2021. 8. 5. 15:45

밑바닥부터 시작하는 딥러닝 책을 공부 중인데 틈날 때마다 적으려 한다. 

사실 시작한지는 꽤 되었으나 앞부분 내용부터 올린다.

 

시그모이드, 계단함수, Relu 함수 구현

 

import numpy as np
import matplotlib.pylab as plt

def step_function(x):
    return np.array(x>0, dtype = np.int)

def sigmoid(x):
    return 1/(1+np.exp(-x))

def relu(x):
    return np.maximum(0, x)

x = np.arange(-5.0, 5.0, 0.1)
y = step_function(x)
plt.plot(x, y)
plt.ylim(-0.1, 1.1)
plt.show()

Comments