Notice
Recent Posts
Link
Recent Comments
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- docker container
- pill ai
- 춤 유사도 평가
- dji tello
- mask image training
- pill classification
- iris dataset
- ubuntu에서 docker 사용
- deep learning
- ceasor
- AI
- yolo mask
- 오목게임앱
- ubuntu
- Python
- Java
- docker
- C
- 긍부정문 판별
- Container
- 한글깨짐해결
- 시저암호 코딩
- 오목앱 만들기
- aws code pipeline
- flower classification
- token check
- docker in ubuntu
- drone control
- 369게임 만들기
- 360게임 만들기 with c
Archives
- Today
- Total
월레스와 그로밋: 코딩의 날
퍼셉트론(Perceptron _ AND, OR, NAND, XOR) 본문
import numpy as np
def AND(x1, x2):
x = np.array([x1, x2])
w = np.array([1.0, 1.0])
b = -1.5
tmp = np.sum(w*x) + b
if tmp <= 0:
return 0
else:
return 1
def OR(x1, x2):
x = np.array([x1, x2])
w = np.array([1.0, 1.0])
b = -0.5
tmp = np.sum(w*x) + b
if tmp <= 0:
return 0
else:
return 1
def NAND(x1, x2):
x = np.array([x1, x2])
w = np.array([-1.0, -1.0])
b = 1.5
tmp = np.sum(w*x) + b
if tmp <= 0:
return 0
else:
return 1
def XOR(x1, x2):
s1 = NAND(x1, x2)
s2 = OR(x1, x2)
y = AND(s1, s2)
return y
if __name__ == '__main__':
for xs in [(0, 0), (1, 0), (0, 1), (1, 1)]:
y = XOR(xs[0], xs[1]) # AND, OR, NAND, XOR
print(str(xs) + "->" + str(y))
output
[AND_Gate]
(0, 0)->0
(1, 0)->0
(0, 1)->0
(1, 1)->1
[OR_Gate]
(0, 0)->0
(1, 0)->1
(0, 1)->1
(1, 1)->1
[NAND_Gate]
(0, 0)->1
(1, 0)->1
(0, 1)->1
(1, 1)->0
[XOR_Gate]
(0, 0)->0
(1, 0)->1
(0, 1)->1
(1, 1)->0
'Python > Deep Learning' 카테고리의 다른 글
| 심층 신경망(Deep Neural Network, DNN)과 Iris 데이터셋 학습 (0) | 2025.02.07 |
|---|---|
| Flower Classification (0) | 2025.02.06 |