let us not love with words or tongue but actions and truth.

IT/자연어분석

Word Vector and Word embedding

sarah0518 2022. 5. 6. 14:53

NLP에서의 pre-training

pre-training의 결과를 가지고 주로 NLP분석을 수행함

(pre-training의 결과물: word embedding)

Auto Encoder 계열과 Restricted Boltzmann Machine 계열이 있음

** RBM과 auto encoder의 차이와 설명은 아래 내용을 참고해 주세요.

https://sarah0518.tistory.com/111

 

RBM과 DBN

지난번 적층 인코더와 유사한 느낌의 DBN과 그것의 기본 구조가 되는 RBM을 설명하고자 해요. 이 내용은 통계역학(통계 물리의 세부분야)에서 연구된 내용으로 Hinton(19830)이 볼츠만 머신(Boltzmann mac

sarah0518.tistory.com

 

 

NLP에서 단어를 표현하는 방법: Learning word representation for NLP

- (past) Local Representation

   main method: One-Hot 벡터 Representation

  • Integer Space
  • Very sparse
  • Very high dimensionality

 

- (Present) Distributed Representation

  main method: word embedding

  • Real value space
  • Desne
  • Low Dimensionality

 

word embedding에서 사용하는 2가지 알고리즘

1. skip-gram: target단어가 주어졌을때, 주변단어를 예측하는 것

2. CBOW(Continuous Bag of Words): 주변단어가 주어졌을 때, target 단어를 예측하는 것

** CBOW가 학습결과가 좀 더 좋음

 

 

word embedding이란?

input words가 one-hot벡터 형태로 들어오고 language모델을 학습시켰을 때 나오는 결과

아래그림에서 input과 output은 같은 차원의 one-hot벡터

이때 생성된 shared weight = word embedding

 

 

위에서 사용하는 2가지 training methods

1. negative training sampling기법을 사용

: 특정 일부분의 word만 sampling해서 Score(positive)>Score(negative)를 확인하는 것

eg) say=1일때만 학습하지말고 say=0일때도 몇개는 sampling해서 학습해보는 것

     ranking-based방법 참고

 2. softmax를 마지막 단계에서 추가하여 확률 값으로 뽑기

 

 

NLP network의 속도를 빠르게 하기위한 방법들

1. hidden layer 삭제

2. negative sampling

 

 

word embedding의 object function과 cost function

object function
cost function - minimize

 

 

word2vec의 단점:

동음이의어를 구별하지 못함

→ 해결책: ELMo, GPT, BERT

 

'IT > 자연어분석' 카테고리의 다른 글

BERT1  (0) 2022.05.26
LSTM and Sequential Labeling  (0) 2022.05.25
[자연어]Statistical Parsing  (0) 2022.04.20
[자연어]Part of Speech Tagging, Sequence Labeling, HMM  (0) 2022.04.08
[자연어]N-gram  (0) 2022.03.28