Word Embedding
- 정의
- 단어를 실수으 벡터로 매핑시키는 것
- 매핑된 벡터를 Word Representation 이라고도 함
- 방법론
- One-hot Encoding
- Latent Sentiment Analysis
- NNLM, RNNLM (Word2vec의 전 버전)
- Word2vec
- GloVe
- FastText
One-hot Encoding
- 입력값 사이즈만큼 벡터가 만들어져야 함 → 차원의 저주
- 모든 벡터가 Orthogonal하고 거리가 같음 = 서로 Independent → 연관성, 유사성을 표현할 수 없음
Distributed Representation
- One-hot Encoding의 문제점
- Sparsity: 다 0이고 한 차원만 1
- Independence: 단어 간의 연관성 표현 X
- Solution
- Distributed Representation
- 연속적이고 작고 dense 벡터로 표현
- |V| >> n (V : Vocabulary Size)
Word2vec
- Distributed Representation을 만드는 Word Embedding Model
- 단어 간의 의미적 관계를 고려한 Representation을 생성
- 이전 모델들(LSA, NNLM 등) 보다 계산 복잡도를 줄이고, 성능을 높임
Continuous Bag-of-Words(CBOW)
Language model을 neural net으로 구현한 것
주변 단어를 이용해서 중앙 단어를 예측
ex. 나는 _에 간다 (input: context, output: word(target))

💡 Skip-gram과의 차이점은 여러 개의 임베딩 벡터를 평균하여 하나의 벡터로 처리
Continuous Skip-gram (Skip-gram)
중앙 단어를 이용해서 주변 단어를 예측
ex. _는 외나무다리에서 _ (input: word(target), output: context)


- Objective Function
- Equation1을 최대화하는 방향으로 학습
- Equation1의 조건부 확률은 Equation2의 softmax 함수를 통해 구할 수 있음


Conclusion
- Word Embedding이란 단어를 Vector로 매핑하는 것
- Word2Vec은 Embedding model 중 하나
- 함께 나타난 (co-occurrence) 주변 단어와의 의미적 관계를 학습 : 주변도 비슷할 것이라는 가정
- 대부분의 NLP model에서 pre-trained embedding으로 사용 (주로 skip gram)
- Future Works
- Negative Sampling: 흔한 단어는 negative하게 sampling할 때 제외
- Other Embedding Models (GloVe, FastText: skip-gram의 변형)
- Contextual Embedding Models (ELMo, ULMFiT) : 문맥 정보까지 모델링
'수업정리 > Deep Learning' 카테고리의 다른 글
| 16. Transformers (0) | 2025.01.23 |
|---|---|
| 03. Shallow Neural Network (0) | 2025.01.22 |
| 01. Quick Introduction & 02. Logistic Regression (0) | 2025.01.21 |