Google ML Bootcamp/Sequence Models
-
Transformer NetworksGoogle ML Bootcamp/Sequence Models 2023. 10. 4. 20:12
※ Self Attention - q : query - K : key - V : value - 이 벡터들은 각 단어에 대한 Attention 값을 계산하기 위한 핵심 input이다. - q = W^Q * x - K = W^K * x - V = W^V * x - q을 다른 자리에 있는 단어들과의 상관관계를 인식 시키기 위해 q * K, ..., q * K의 형태로 만들어 벡터화시킨다. 이렇게 모든 단어를 연결하여 문장의 의미로 인식되게 만든다. - 5개의 단어로 표현 될 수 있는 문장에서 A 단어를 표현하기 위해서 V, ..., V 와 q * K, ... q * K를 각각 곱하고 전의 모든 값들을 합한다. 이렇게 A ~ A의 모든 단어를 표현할 수 있다. - softmax 함수의 분모 d_k^(1/2)는 ..
-
Various Sequence To Sequence ArchitecturesGoogle ML Bootcamp/Sequence Models 2023. 10. 3. 12:59
※ Picking the Most Likely Sentence - Language model : 항상 0 벡터를 입력으로 해서 모델링한다. - Machine translation : 입력 문장의 표현을 파악하는 인코딩 부분 + 해당 입력 문장을 사용하여 디코딩된 네트워크를 사용함. -> 조건부 언어 모델이라 부르고, 어떤 문장의 확률을 모델링 하는 대신 입력한 어떤 문장에 대한 번역을 모델링한다. - 분포를 무작위로 샘플링 하지 않고, 조건부 확률을 극대화하는 문장 y를 찾는다. - 수식의 항을 최대화하는 y값을 찾도록 알고리즘을 짜야한다. - visiting 보다 going이 더 일반적으로 사용되는 단어라, 확률이 높기 때문에 greedy search를 하게 되면 두번째 문장이 선택되어 덜 최적인 문장..
-
Learning Word Embeddings: Word2vec & GloVeGoogle ML Bootcamp/Sequence Models 2023. 10. 2. 14:53
※ Word2Vec ■ Skip Gram Model - Vocab size가 10,000 이라고 할 때, context X와 target Y(learn 하고 싶은 단어)를 설정한다. - O_c -> E -> e_c -> O_softmax -> yhat (e_c = E * O_c) - E는 e_c에 해당하는 매개 변수를 가진다. - O_softmax에는 theta_t 매개 변수를 제공하는 매개 변수도 있다. - 모든 매개 변수를 기준으로 Loss Function을 최적화하면 실제로 상당량의 vector 포함 set을 얻을 수 있다. - softmax : p(t | c) - y라는 target vector를 형성했을 때, learn 하고 싶은 단어의 숫자가 4834라면 이는 target vector의 483..
-
Word EmbeddingsGoogle ML Bootcamp/Sequence Models 2023. 10. 1. 12:14
※ Using Word Embeddings - 낮은 차원의 feature vector를 사용할 수 있다. -> 1만 차원 one-hot vector를 사용하는 대신 300차원의 dense vector를 사용할 수 있다. - finetuning의 경우 차원이 매우 크고, 데이터가 많을 경우에만 사용한다. - 상대적으로 작은 훈련 세트를 가질 때 가장 큰 차이를 만드는 경향이 있다. - 명명된 Entity 인식, 텍스트 요약, 공동 참조 해결, 구문 분석에 유용하고, 언어 모델링, 기계 번역에 적합하지 않다. - A에 대한 데이터 양이 많은 경우에 가장 유용하고, B에 대해 상대적으로 작은 데이터 셋을 가질 때 유용하다. ※ Properties of Word Embeddings - e(man) - e(wom..
-
Recurrent Neural NetworksGoogle ML Bootcamp/Sequence Models 2023. 9. 29. 16:34
※ Recurrent Neural Network Model - Problem 1 : 입력과 출력이 다른 예시에서 다른 길일 수 있음. 모든 단일 예시가 같은 입력 길이 T_x 이거나 같은 대문자 길이 T_y를 가지지 않고 모든 문장은 최대 길이가 아니다. - Problem 2 : 텍스트의 서로 다른 위치에서 학습한 기능을 공유하지 않는다. - 단일 신경망에서와 같이 하나의 Input에 Output이 하나가 존재하는 느낌이 아니라, 신경망을 여러개 연결 하는 느낌으로 순환신경망을 구성한다. - 모든 노드마다 같은 파라미터값을 가지고 Input은 Wax, Output은 Wya가 된다. - yhat_Ty에서는 x_1, x_2, x_3, ..., x_Ty까지의 정보를 모두 얻을 수 있음. - 약점 : RNN은 ..