분류 전체보기
-
14. LSTM (Long Short Term Memory) 개념 + GRU딥러닝 2023. 11. 15. 16:04
이 포스트는 Do it 딥러닝 교과서 (윤성진 저)를 참고하여 만들어졌음! LSTM (Long Short Term Memory) LSTM에 들어가기 전에 기존 RNN의 문제점에 대해 살펴본다. 이전까지 배운 RNN은 Vanilla RNN으로, 순환신경망의 기초 동작원리를 설명한다고 볼 수 있다. Vanilla RNN은 다음과 같은 문제점을 갖는다. 1. 장기의존성 (long-term dependency) : 시간 상 멀리 떨어진 입력의 영향이 약해진다. 즉 어떤 입력 데이터가 실제로 멀리 떨어진 입력에 대해 장기 의존성이 있음에도 불구하고 Vanilla RNN으로는 이를 파악할 수 없다. 따라서 순차열이 길어질수록 데이터의 정보가 서서히 사라진다. → 모델의 기억력이 짧다! 2. Gradient Vani..
-
13. RNN 코드실습딥러닝 2023. 10. 31. 15:25
이 포스트는 '텐초의 파이토치 딥러닝 특'을 참고하여 만들어졌음! RNN 개념도 물론 중요하지만 요것들을 실제로 적용하는 과정에서 무수한 궁금증이 생기기 때문에 한 번 코드실습을 해보는 시간을 가져보겠다. 결과가 가시적인 CNN과는 달리 RNN은 개념도 그렇고 코드 칠 때도 뭐가 뭔지 모르는 부분이 많았다. 텐초의 파이토치 딥러닝 특강의 '6장 넷플릭스 주가 예측하기 RNN으로 첫 시계열 학습'을 참고하여 RNN 코드 실습을 진행하였다. ㄱㄱ씽~ 1. 데이터 가져오기 import pandas as pd data = pd.read_csv("/content/train.csv") data.head() 실습에 사용할 데이터는 https://www.kaggle.com/c/netflix-stock-predicti..
-
12. RNN (Recurrent Neural Network) 이론딥러닝 2023. 10. 6. 10:54
이 포스트는 Do it 딥러닝 교과서 (윤성진 저)를 참고하여 만들어졌음! RNN 시간 혹 공간적 순서 관계가 있는 데이터를 순차 데이터(sequence data)라고 부른다. 순차 데이터는 시공간의 순서 관계에 의해 문맥 혹은 context를 갖는다. 예를 들어 '나는', '밥이', '먹고싶다' 라는 텍스트 데이터는 '나는 밥이 먹고싶다'의 순서로 진행되는 한 문장이다. 하지만 각 세 데이터를 순방향 신경망에 차례대로 입력하는 경우 순방향 신경망은 세 단어 간 문맥을 파악하지 못하여 한 문장을 완성하지 못한다. 이러한 한계점을 돌파하여 데이터의 순차 구조를 인식하고 기억하도록 개발된 것이 바로 순환 신경망 (RNN: recurrent neural network)이다. RNN structure 기존 신경..
-
VGG net 논문리뷰 + 실습딥러닝 2023. 10. 4. 16:27
VGG net 이 포스팅에서는 CNN을 공부해봤다면 반드시 한 번쯤은 써봤을 법한 모델 VGG 논문을 리뷰해보도록 한다. 논문 발표시점은 2014년으로 ImageNet의 이미지 분류대회 ILSVRC가 활발히 진행되던 시점이라 해당 대회의 이야기가 논문 스토리텔링의 중추가 되었다. (ILSVRC은 2010년 부터 2017년까지 매년 개최되었다.) Introduction은 가볍게 건너뛰고 해당 논문에서 제시하는 Convnet (convolutional network)의 구조와 몇가지 설정사항을 확인해보도록 한다. Input image size는 224x224x3 (RGB channel)으로 고정한다. (very small receptive field를 가지는) 3x3 filter를 사용한다. (3x3 fil..
-
11. 컨볼루션 신경망, CNN (Convolution neural network)딥러닝 2023. 9. 27. 12:39
이 포스트는 Do it 딥러닝 교과서 (윤성진 저)를 참고하여 만들어졌음! CNN의 역사 앞서 배운 MLP(Multi layer perceptron)로 이미지 데이터도 학습할 수 있을까? $\rightarrow$ 가능하다. 비록 성능은 떨어지겠지만 input data의 크기가 작고 특징이 적은 경우(MNIST 숫자 손글씨 이미지 등) 에 학습이 잘 된다. 하지만 Image data를 MLP에 입력하면, 예를들어 위 그림에서 2라는 숫자가 1차원 벡터로 flatten된 후 입력되기 때문에 숫자 2라는 형태를 유지할 수 없다. MLP를 이용해서는 Image data의 특징을 추출할 수가 없는 것이다. 더불어 이미지 데이터의 각 픽셀은 입력벡터의 각 차원이 되기 때문에 28x28 image에서 30x30 im..
-
9. 초기화 Initialization딥러닝 2023. 9. 21. 15:46
이 포스트는 Do it 딥러닝 교과서 (윤성진 저)를 참고하여 만들어졌음! 신경망 모델을 학습할 때 loss function의 최적해와 가까운 곳에서 학습을 시작하면 빠르게 최적해를 찾을 수 있다. loss function의 차원은 신경망 모델의 parameter 개수와 같다. (신경망 모델의 parameter 전부를 거쳐서 나온 output과 target을 비교하여 loss를 계산하므로) 따라서 loss function을 간략하게 도식화 하는 것 조차 불가능한 와중에 어느 지점이 최적해와 가까운지 어림잡는 것은 불가능해 보인다. weights의 학습 시작지점에 따라 모델의 성능이 크게 변동될 수 있기 때문에 초기화를 잘 해주는 것 역시 중요하다. 상수 초기화 가중치를 전부 0으로 초기화 이때 hidde..
-
8. 최적화 Optimization딥러닝 2023. 9. 20. 15:03
이 포스트는 Do it 딥러닝 교과서 (윤성진 저)를 참고하여 만들어졌음! 확률적 경사 하강법 (SGD)는 역전파 알고리즘이 탄생했던 1980년부터 사용되던 초창기 알고리즘이다. SGD는 weights update를 위해 하나의 sample만을 사용하므로 메모리 사용을 최소화 할 수 있고, 온라인 학습시 데이터가 추가될 때마다 모델을 update할 수 있다는 장점을 가진다. 하지만 학습 과정에서 발생하는 다양한 상황에 대처하기 어렵고 학습 속도가 느리다는 단점을 갖는다. SGD가 가진 문제점들에 대해 살펴보는 것을 시작으로 optimization에 대해 공부해본다. Learning rate Learning rate(학습률)은 optimization 과정에서 한 update step당 이동하는 step s..
-
7. 손실함수 Loss function딥러닝 2023. 9. 15. 16:06
이 포스트는 Do it 딥러닝 교과서 (윤성진 저)를 참고하여 만들어졌음! 신경망 모델은 관측 데이터를 잘 설명하는 함수를 표현해야 한다. 모델이 표현하는 함수의 형태를 결정하는 것이 loss function이다. loss function은 모델이 관측 데이터를 잘 표현하도록 정의해야 한다. 손실함수는 모델이 Error minimization이 되도록 정의하거나 모델이 추정하는 관측 데이터의 확률이 최대화 되도록 maximum likelihood estimation (MLE) 방식으로 정의한다. Error minimization에서의 Loss function 정의 신경망 모델의 파라미터를 $\vec{\theta}$로 두고 데이터를 $D={(\vec{x}_i, t_i): i=1, \cdots, N}$로 둔..