RNN and Language modeling
·
AI/이론
RNN and Language modeling¶ Basic structure¶ An unrolled recurrent neural network¶ Input and outputs of RNNs(rolled version)¶ $h_{t-1}$: old hidden-state vector $x_{t}$: input vector at some time step $h_{t}$: new hidden-state vector $f_{W}$: RNN function with parameters W $y_{t}$: output vector at time step t (can be obtained through $h_{t}$) ❗ 여기서 주의 점은 매 time step마다 같은 함수와 같은 parameters를 사용한다...
[Day16] NLP 기초
·
AI/부스트 캠프 AI tech
[Day16] NLP 기초 Intro to NLP, Bag of Words https://n-brogrammer.tistory.com/85 Word Embedding https://n-brogrammer.tistory.com/84 중요 CBOW 주변 단어들을 가지고 중심 단어를 예측하는 방식으로 학습한다. 전체 과정은 다음과 같다. 주변 단어들의 one-hot encoding 벡터를 각각의 embedding layer에 projection한다. 각각의 embedding 벡터를 얻고 이 embedding들을 element-wise한 덧셈으로 합친다. 다시 linear transformation하여 예측하고자 하는 중심 단어의 one-hot encoding벡터와 같은 사이즈의 벡터로 만든 뒤, 중심 단어의 ..
Bag of Words
·
AI/이론
Bag of Words¶ Bag of Words 표현¶ 1️⃣ unique words를 가지는 단어장을 만든다.¶ Example sentences: "John really really loves this movie", "Jane really likes this song" 위 문장이 있다면 공백을 기준으로 나눠서 각각의 단어를 단어장으로 만든다. Vocabulary: {“John“, “really“, “loves“, “this“, “movie“, “Jane“, “likes“, “song”} 여기서 really라는 단어는 2번 나오지만 단어장에는 1개가 들어간다. 2️⃣ 단어장의 단어를 one hot vectors로 encoding한다.¶ Vocabulary: {“John“, “really“, “loves“..
Word Embedding
·
AI/이론
Word Embedding¶ word를 vector로 표현한다. "cat"과 "kitty"와 같이 비슷한 비슷한 벡터로 표현 → 짧은 거리 "hamburger"와 같이 "cat"이나 "kitty"와 완전 다른 단어는 다른 벡터로 표현 → 먼 거리 Word2Vec¶ 같은 문장들 안에서 인접한 단어들은 의미가 비슷할 것이라고 가정 한 단어가 주변에 등장하는 단어들을 통해 의미를 알 수 있다는 사실에서 착안 Input: “study” [0, 1, 0] Output: “math” [0, 0, 1] 위 경우에 대해서는 위 그림과 같다. 주어진 학습 데이터가 "I study math"라고 하자. 먼저 tokenization을 진행하고 unique한 단어를 모아서 단어장을 만들게 된다. 그리고 각 단어를 one ho..