Perception import math import matplotlib.pyplot as plt import numpy as np 입력 : 입력: (x1, x2) 출력: a = x1 * w1 + x2 * w2 + b 계산 y = 1, a > 임계값= 0, a Example def step_function(x): if x > 0: return 1 else: return 0 > Execute x = np.arange(-3, 4) print('x = ', x) for x_i in x: print(step_function(x_i), end ='\t') > Result x = [-3 -2 -1 0 1 2 3] 0 0 0 0 1 1 1 > Numpy.exp()와 Math.exp() 비교 def step_funct..
Perceptron
Perceptron(퍼셉트론) 다수의 신호를 입력 받아서, 하나의 신호를 출력 - And Gate def and_gate(x1, x2): w1, w2 = 1.0, 1.0 # 가중치 bias = -1 y = x1 * w1 + x2 * w2 + bias if y > 0: return 1 else: return 0 - Or Gate def or_gate(x1, x2): w1, w2 = 1.0, 1.0 b = -0.5 y = x1 * w1 + x2 * w2 + b if y > 0: return 1 else: return 0 - Nand Gate def nand_gate(x1, x2): w1, w2 = 0.5, 0.5 # 가중치(weight) b = 0 # 편향(bias) y = x1 * w1 + x2 * w2 ..