728x90
반응형

전체 글 284

[딥러닝] 딥러닝 동작 원리 7가지(순전파, 역전파 등)

딥러닝 동작원리 7가지 공식을 공부합니다. 1. 순전파 : y=x*w+1*b 입력 노드 1개, 출력 노드 1개, 편향으로 구성된 단일 인공 신경입니다. x=2 w=3 b=1 y=x*w+1*b y 2. 평균 제곱 오차 : E=(y-yT)*(y-yT)/2 E는 오차, y는 순저차에 의한 예측값, yT는 목표값 또는 라벨을 의미하며, yT는 입력값 x에 대해 실제로 나오기를 원하는 값입니다. 오차(error)는 손실(loss) 또는 비용(cost)라고도 하며, 오차값이 작을수록 예측을 잘하는 인공신경망입니다. yT=10 E=(y-yT)**2/2 E 3. 역전파 오차 : yE=y-yT yE는 역전파 오차, y는 순전파에 의한 예측값, yT는 목표값 또는 라벨을 나타냅니다. yE의 정확한 의미는 y에 대한 오차 ..

[딥러닝] 알고리즘 파이썬 기반 XOR의 AND, NAND, OR 구현하기

퍼셉트론의 한계 : XOR 단층 신경망은 입력값과 가중치의 곱의 합을 바로 출력값으로 내보내어 XOR 문제를 해결하려고 시도하는 과정에서 한계에 다다릅니다. 단층 신경망으로 구현할 수 없었던 XOR 게이트 문제를 다층 퍼셉트론이 개발되면서 해결되었습니다. 다층 퍼셉트론은 입력층, 은닉층, 출력층으로 구성된 모델로 XOR 게이트의 경우 두개의 입력값과 하나의 출력값을 가진 단층 퍼셉트론 세개를 조합하여 해결할 수 있습니다. AND 구현 def AND(x1,x2): w1,w2=0.4,0.4 # 가지돌기의 굵기 b=-0.6 # 축삭돌기의 굵기(두께), 역치 s=x1*w1+x2*w2+b return 0 if s

[파이썬] 기초 다지기 클래스(class)

class 정의하기 객체 사용하기 (shell에서 실행하기) class Student: def __init__(inst,name,age,gender): inst.name=name inst.age=age inst.gender=gender def info(inst): return inst.name,inst.age,inst.gender student_1=Student('일지매',25,'남자') student_1.info() 클래스 활용하기 1 (shell에서 실행하기) class RCCar: def __init__(inst): inst.dir='stop' inst.spd=0 def go_forward(inst): inst.dir='forward' def go_backward(inst): inst.dir='ba..

[파이썬] 기초 다지기 함수 2

함수와 for 문 2 : zip(리스트 항목별 묶기, 일회용) (shell에서 실행하기) L1=['americano','caffe latte','espresso'] L2=[1500,2500,1600] z=zip(L1,L2) for coffee,price in z: coffee,price for coffee,price in z: coffee,price 무명 함수 : lambda(한줄짜리 함수) (shell에서 실행하기) f=lambda a,b:a*b f(10,20) f2=lambda a:a**2 f2(3) f3=lambda a:a>2 f3(3) lambda, map, for~in 문의 활용(map은 일회용) (shell에서 실행하기) f=lambda a:a**2 L=[1,2,3,4] for m in map..

[파이썬] 기초 다지기 함수 1

둘 이상의 함수 반환 값 (shell에서 실행하기) def k(a,b): q=a//b r=a%b return q,r a,b=19,5 q,r=k(a,b) q,r 위치 기반 인자, 키워드 기반 인자 (shell에서 실행하기) def func(a,b): a,b func(10,20) func('hello','world') func(a=3000,b=100) func(b=100,a=3000) 함수와 커피 자판기 (shell에서 실행하기) menu={'americano':1500, 'caffe latte':2500, 'espresso':1500 } totalMoney=0 def coffeeMachine(moneyIn,coffeeIn): change,coffeeOut=moneyIn,None if coffeeIn in ..

[파이썬] 기초 다지기 dict(딕셔너리 함수)

dict 생성하기 (shell에서 실행하기) shopping={} shopping['apple']=2 shopping['pear']=3 shopping['hanrabong']=2 shopping['pine apple']=1 shopping dict 항목 읽기 (shell에서 실행하기) shopping['apple'] shopping['pear'] shopping['mango'] shopping.get('mango','does not exist') shopping.get('hanrabong','does not exist') dict 주요함수 (shell에서 실행하기) shopping={'apple':2, 'pear':3, 'hanrabong':2, 'pine apple':1} shopping.keys() ..

[파이썬] 기초 다지기 tuple, dict, set와 packing operator

tuple, dict, set(집합, 중복된 것을 정리) 소개 (shell에서 실행하기) t={1,2,3,4} d={'a':1,'b':2,'c':3,'d':4} s={1,2,2,3,3,3,4,4,4,4} t d s 튜플, 사전, 집합 : 내포와 생성자 (shell에서 실행하기) t=(i for i in range(5)) d={('key'+str(i)):i for i in range(5)} s={i for i in range(5)} t d s type(t) type(d) type(s) 튜플의 기본적인 활용(콤마(,)로 분리된 항목들 / 병렬대입 / 암시적인 대입(함수를 사용한 인자) (shell에서 실행하기) a=(1,2,3,4) a type(a) b=(1) b type(b) c=(1,) type(c) 튜..

728x90
반응형