Skip to content

Instantly share code, notes, and snippets.

@jsjj10002
jsjj10002 / Deep Learning from Scratch 3-2Activation function.py
Created July 13, 2023 13:16
파이썬 활성화 함수 구현 (step, sigmiod, ReLU)
import numpy as np
import matplotlib.pylab as plt
#implement step function/ 입력이 0을 넘으면1, 그 외에는 0을 출력
def step_function(x):
if x>0:
return 1
else:
return 0
@jsjj10002
jsjj10002 / Deep Learning from Scratch 2 Perceptron implementation.py
Created July 13, 2023 12:06
파이썬 퍼셉트론 구현 - (AND, NAND, OR, XOR)GATE
#Initialize 'AND logic' function
def AND(x1,x2): # x1, x2를 인수로 받는 AND함수
w1, w2, theta=0.5,0.5,0.7 #매게변수 초기화
tmp = x1*w1+x2*w2 #가중치를 곱한 입력의 총합이 임계값을 넘으면 1 반환, 나머지 0 반환
if tmp <= theta:
return 0
elif tmp > theta:
return 1
@jsjj10002
jsjj10002 / Deep Learning from Scratch 1-6matplotlib.py
Last active July 12, 2023 15:56
파이썬 matplotlib 시각화 기초
#matplotlib: 그래프를 그려주는 라이브러리
#단순한 그래프 그리기
import numpy as np
import matplotlib.pyplot as plt #matplotlib의 pyplot모듈 이용
#데이터 준비
x=np.arange(0,6,0.1) #0에서 6까지 0.1간격으로 생성
y=np.sin(x) #sin함수 적용해 y에 할당
#그래프 그리기
@jsjj10002
jsjj10002 / Deep Learning from Scratch 1-5numpy.py
Created July 12, 2023 15:13
파이썬 넘파이 기초
# 넘파이 가져오기
import numpy as np
#넘파이 배열 생성
x = np.array([1.0,2.0,3.0])
print(x)
#[1, 2, 3]
type(x)
#<class 'numpy.ndarray>
#np.arry: 리스트 인수, 넘파이 배열(numpy.ndarray) 반환