SlideShare uma empresa Scribd logo
1 de 26
Baixar para ler offline
Convolutional Neural Networks for
Sentence Classification
전희선
http://www.people.fas.harvard.edu/~yoonkim/
0. Abstract
(ex: 긍정/부정)(+word2vec)
pre-trained된 word vectors를 가지고 학습된 CNN을 통해 문장 분류를 한 여러 연구에 대해 보고
- 약간의 hyperparameter tuning이 들어간 간단한 CNN도 좋은 결과를 나타냄
- 총 7개 task 중 4개에서 다른 모델들 중 가장 좋은 결과를 보임
Word Embedding : 단어를 저차원의 벡터로 표현
(ex: Word2Vec, GloVe 등)
1. Introduction - Word2Vec
밀집 표현(Dense Representation) : 각 단어의 특징이 표현된 벡터 (저차원)
희소 표현(Sparse Representation) : 단어별 ID 생성 (고차원(단어 개수 만큼의 차원), one-hot encoding)
단점 : 고차원 + 단어 간 유사성을 표현할 수 X
(1) CBOW(Continuous Bag of Words) : 주변에 있는 단어로 중간 단어 예측
ex) 문장
“The fat cat sat on the mat”
window size = 2
1. Introduction - Word2Vec
[0, 1, 0, 0, 0, 0, 0]
[0, 0, 1, 0, 0, 0, 0]
[0, 0, 0, 0, 1, 0, 0]
[0, 0, 0, 0, 0, 1, 0]
[0, 0, 0, 1, 0, 0, 0]
output : 중심 단어
input : 주변 단어
(1) CBOW(Continuous Bag of Words) : 주변에 있는 단어로 중간 단어 예측
1. Introduction - Word2Vec
m : window size
V : 문장의 단어 개수 (= 7)
N : hidden layer 크기 (= 5)
(1) CBOW(Continuous Bag of Words) : 주변에 있는 단어로 중간 단어 예측
1. Introduction - Word2Vec
=
𝑧 𝑖
𝛴 𝑗ⅇ
𝑧 𝑗
(1) CBOW(Continuous Bag of Words) : 주변에 있는 단어로 중간 단어 예측
1. Introduction - Word2Vec
- 학습되는 mechanism은 CBOW와 동일
(2) skip-gram : 중간 단어로 주변에 있는 단어 예측
1. Introduction - Word2Vec
1. Introduction – CNN
Filter
1 0 1
0 1 0
1 0 1
2. Model – data(word vector) 준비
Google News의 1000억 개 단어로 구성된 데이터로 pre-trained된 Word2Vec(CBOW)을 word vector로 이용
(pre-trained된 word vector에 없는 단어는 random하게 벡터 값 초기화)
n: 단어 개수
k: word vector 차원
window size가 다른
여러 filter들 적용한
conv layer 병렬적으로 생성
(filter 크기 : window size * k)
window size = 2
window size = 3
2. Model – static | non-static | multi-channel
non-static (input으로 넣은 word-vector까지 backprop)
static (conv-layer까지 backprop)
multi-
channel
static channel
non-static channel
2. Model – step1 : concatenation
𝑥𝑖 ∈ ℝ 𝑘
: 문장 𝑖번째에 있는 단어의 k차원 word vector
𝑥1
𝑥2
𝑥9
.
.
.
.
.
(⊕ : concatenate operator
h : window size)
𝑥𝑖:𝑖+ℎ−1 = 𝑥𝑖 ⊕ 𝑥𝑖+1 ⊕ … ⊕ 𝑥𝑖+ℎ−1
: 𝑖번째부터 ℎ개의 단어 concatenate
𝑥1
𝑥2
𝑥9
.
.
.
.
.
𝑥1:2
𝑥8:9
𝑥4:6
2. Model – step1 : concatenation
2. Model – step2 : conv layer 생성
𝑐𝑖 = 𝑓 𝑤 ⋅ 𝑥𝑖:𝑖+ℎ−1 + 𝑏 (𝑓 : non-linear function(tanh 등)
ℎ : window size
𝑏 : bias term)
𝑥1
𝑥2
𝑥9
.
.
.
.
.
𝑥1:2
𝑥8:9
𝑥4:6
2. Model – step3 : max-over-time pooling
𝑥1
𝑥2
𝑥9
.
.
.
.
.
𝑥1:2
𝑥8:9
𝑥4:6
𝑐 = 𝑐1, … , 𝑐 𝑛−ℎ+1
: feature map
Ƹ𝑐 = max{𝑐}
각 conv layer마다 feature map 개수가 달라짐
→ 각 conv layer마다 feature map 中 가장 큰 값만 사용
각 window size마다 생성
2. Model – step4 : softmax
𝑥1
𝑥2
𝑥9
.
.
.
.
.
𝑥1:2
𝑥8:9
𝑥4:6
softmax function 통해
최종 output 나옴
Ԧ𝑧 = Ƹ𝑐1, ⋯ , Ƹ𝑐 𝑚
m : filter 개수
2.1 Regularization
- Dropout (keep probability p=0.5)
: feature 中 반은 dropout으로 제거 → 2~4% 정확도 향상
(train에서만 사용, test에서는 dropout 하지 않음)
- Test할 때 dropout을 하지 않으므로 ෡𝑤 = 𝑝𝑤 로 rescale
Ԧ𝑦 = 𝑤 ⋅ Ԧ𝑧 + 𝑏
Ԧ𝑧 = Ƹ𝑐1, ⋯ , Ƹ𝑐 𝑚
Ԧ𝑦 = 𝑤 ⋅ ( Ԧ𝑧 ∘ Ԧ𝑟) + 𝑏
masking vector
(dropout 여부를 0, 1[Bernoulli random variable]로 나타내 주는 vector)
dropout
m : filter 개수
∘ : element-wise operation
- 𝑤 2 > 𝑠일 경우 𝑤 2 = 𝑠로 rescale
3. Datasets and Experimental Setup
의미 label 수 문장 평균 길이
dataset
크기
단어 수
pre-trained word
vector에 포함된 단어 수
test set 크기
MR
(Movie Review)
영화 리뷰 문장 2 (긍정/부정) 20 10662 18765 16448 10-fold CV 사용
SST-1
(Stanford Sentiment
Treebank-1)
MR에서 test set 제공
+ label 5개로
5 (매우 긍정/
긍정/보통/부정
/매우 부정)
18 11855 17836 16262 2210
SST-2
(Stanford Sentiment
Treebank-1)
SST-1에서 보통 제거하고
binary label로
2 (긍정/부정) 19 9613 16185 14838 1821
Subj Subjectivity dataset 2 (주관/객관) 23 10000 21323 17913 10-fold CV 사용
TREC 의문문 dataset 6 (질문 종류) 10 5952 9592 9125 500
CR
(Consumer Review)
소비자 리뷰 문장
2 (긍정/부정)
19 3775 5340 5046 10-fold CV 사용
MPQA 의견 2 (의견 극성) 3 10606 6246 6083 10-fold CV 사용
3.1 Hyperparameters and Training
SST-2의 validation set으로 grid search 통해 설정
- Activation function : ReLU
- Filter windows : h = 3, 4, 5
- Feature map : 100개
- Dropout rate : p = 0.5
- L2 constraint : s = 3
- Mini-batch size : 50
3.2 Pre-trained Word Vectors
(앞에서 언급한 내용)
Google News의 1000억 개 단어로 구성된 데이터로 pre-trained된
Word2Vec을 word vector로 이용
* Train 시 CBOW 사용 / word vector 차원: 300차원
* pre-trained된 word vector에 없는 단어는 random하게 벡터 값 초기화
3.3 Model Variations - CNN-rand : word vector가 random으로 초기화
- CNN-static : word2vec 사용 + static
- CNN-non-static : word2vec 사용 + non-static
- CNN-multichannel : word2vec 두 set(channel이라고도 부름) 사용
- 하나는 static, 다른 하나는 non-static
4 Results and Discussion
성능 BAD
4.1 Multichannel vs. Single Channel Models
→ 항상 Multichannel이 single channel model보다 성능이 더 좋은 것은 아니다!
4.2 Static vs. Non-static Representations
→ non-static은 static보다 통사적인 부분까지 고려됨
참고 사이트
https://wikidocs.net/33520 word2vec
https://www.youtube.com/watch?v=EAJoRA0KX7I&list=PLoROMvodv4rOhcuXMZkNm7j3fVwBBY42z&index=11
CS224n – Lec11
https://www.youtube.com/watch?v=IRB2vXSet2E PR-015
https://zyint.tistory.com/575 논문요약1
https://arclab.tistory.com/149 논문요약2
https://ratsgo.github.io/natural%20language%20processing/2017/08/16/deepNLP/ NLP+Deep Learning
Usually, NLP ➔ RNN
하지만 RNN에도 문제가 있었으니...
* Why not RNN, but CNN?
RNN의 단점을 보완해줄 CNN!
* Why not RNN, but CNN?
* 한국어 ver
Word2vec이 큰 차이 없었던 이유:
- word2vec이 새로운 feature를 주지만
데이터가 대용량(65만건 이상)이라 데이
터 크기만으로도 충분히 큰 역할을 해서
- 다양한 카테고리를 시험해서 같은 단어
라도 중의적인 표현으로 쓰였기 때문
* 한국어 ver

Mais conteúdo relacionado

Semelhante a CNN for sentence classification

Image Deep Learning 실무적용
Image Deep Learning 실무적용Image Deep Learning 실무적용
Image Deep Learning 실무적용Youngjae Kim
 
History of Vision AI
History of Vision AIHistory of Vision AI
History of Vision AITae Young Lee
 
[226]대용량 텍스트마이닝 기술 하정우
[226]대용량 텍스트마이닝 기술 하정우[226]대용량 텍스트마이닝 기술 하정우
[226]대용량 텍스트마이닝 기술 하정우NAVER D2
 
파이썬을 활용한 챗봇 서비스 개발 3일차
파이썬을 활용한 챗봇 서비스 개발 3일차파이썬을 활용한 챗봇 서비스 개발 3일차
파이썬을 활용한 챗봇 서비스 개발 3일차Taekyung Han
 
Deep learningwithkeras ch3_1
Deep learningwithkeras ch3_1Deep learningwithkeras ch3_1
Deep learningwithkeras ch3_1PartPrime
 
Scala, Scalability
Scala, ScalabilityScala, Scalability
Scala, ScalabilityDongwook Lee
 
Multiple vector encoding (KOR. version)
Multiple vector encoding (KOR. version)Multiple vector encoding (KOR. version)
Multiple vector encoding (KOR. version)상근 정
 
Bidirectional attention flow for machine comprehension
Bidirectional attention flow for machine comprehensionBidirectional attention flow for machine comprehension
Bidirectional attention flow for machine comprehensionWoodam Lim
 
Attention is all you need 설명
Attention is all you need 설명Attention is all you need 설명
Attention is all you need 설명Junho Lee
 
NDC11_슈퍼클래스
NDC11_슈퍼클래스NDC11_슈퍼클래스
NDC11_슈퍼클래스noerror
 
Adversarial Attack in Neural Machine Translation
Adversarial Attack in Neural Machine TranslationAdversarial Attack in Neural Machine Translation
Adversarial Attack in Neural Machine TranslationHyunKyu Jeon
 
2.supervised learning(epoch#2)-3
2.supervised learning(epoch#2)-32.supervised learning(epoch#2)-3
2.supervised learning(epoch#2)-3Haesun Park
 
[Hello world 오픈세미나]n grinder helloworld발표자료_저작권free
[Hello world 오픈세미나]n grinder helloworld발표자료_저작권free[Hello world 오픈세미나]n grinder helloworld발표자료_저작권free
[Hello world 오픈세미나]n grinder helloworld발표자료_저작권freeNAVER D2
 
[Tf2017] day2 jwkang_pub
[Tf2017] day2 jwkang_pub[Tf2017] day2 jwkang_pub
[Tf2017] day2 jwkang_pubJaewook. Kang
 
댓글 감성 분석 상용화 개발기(Ver. 2)
댓글 감성 분석 상용화 개발기(Ver. 2)댓글 감성 분석 상용화 개발기(Ver. 2)
댓글 감성 분석 상용화 개발기(Ver. 2)Jeffrey Kim
 

Semelhante a CNN for sentence classification (20)

Image Deep Learning 실무적용
Image Deep Learning 실무적용Image Deep Learning 실무적용
Image Deep Learning 실무적용
 
History of Vision AI
History of Vision AIHistory of Vision AI
History of Vision AI
 
Mylab
MylabMylab
Mylab
 
[226]대용량 텍스트마이닝 기술 하정우
[226]대용량 텍스트마이닝 기술 하정우[226]대용량 텍스트마이닝 기술 하정우
[226]대용량 텍스트마이닝 기술 하정우
 
Convolutional rnn
Convolutional rnnConvolutional rnn
Convolutional rnn
 
파이썬을 활용한 챗봇 서비스 개발 3일차
파이썬을 활용한 챗봇 서비스 개발 3일차파이썬을 활용한 챗봇 서비스 개발 3일차
파이썬을 활용한 챗봇 서비스 개발 3일차
 
Deep learningwithkeras ch3_1
Deep learningwithkeras ch3_1Deep learningwithkeras ch3_1
Deep learningwithkeras ch3_1
 
자연어4 | 1차강의
자연어4 | 1차강의자연어4 | 1차강의
자연어4 | 1차강의
 
Scala, Scalability
Scala, ScalabilityScala, Scalability
Scala, Scalability
 
Scalability
ScalabilityScalability
Scalability
 
Multiple vector encoding (KOR. version)
Multiple vector encoding (KOR. version)Multiple vector encoding (KOR. version)
Multiple vector encoding (KOR. version)
 
Bidirectional attention flow for machine comprehension
Bidirectional attention flow for machine comprehensionBidirectional attention flow for machine comprehension
Bidirectional attention flow for machine comprehension
 
Attention is all you need 설명
Attention is all you need 설명Attention is all you need 설명
Attention is all you need 설명
 
NDC11_슈퍼클래스
NDC11_슈퍼클래스NDC11_슈퍼클래스
NDC11_슈퍼클래스
 
Adversarial Attack in Neural Machine Translation
Adversarial Attack in Neural Machine TranslationAdversarial Attack in Neural Machine Translation
Adversarial Attack in Neural Machine Translation
 
2.supervised learning(epoch#2)-3
2.supervised learning(epoch#2)-32.supervised learning(epoch#2)-3
2.supervised learning(epoch#2)-3
 
[Hello world 오픈세미나]n grinder helloworld발표자료_저작권free
[Hello world 오픈세미나]n grinder helloworld발표자료_저작권free[Hello world 오픈세미나]n grinder helloworld발표자료_저작권free
[Hello world 오픈세미나]n grinder helloworld발표자료_저작권free
 
[Tf2017] day2 jwkang_pub
[Tf2017] day2 jwkang_pub[Tf2017] day2 jwkang_pub
[Tf2017] day2 jwkang_pub
 
Deep learning overview
Deep learning overviewDeep learning overview
Deep learning overview
 
댓글 감성 분석 상용화 개발기(Ver. 2)
댓글 감성 분석 상용화 개발기(Ver. 2)댓글 감성 분석 상용화 개발기(Ver. 2)
댓글 감성 분석 상용화 개발기(Ver. 2)
 

Mais de KyeongUkJang

Photo wake up - 3d character animation from a single photo
Photo wake up - 3d character animation from a single photoPhoto wake up - 3d character animation from a single photo
Photo wake up - 3d character animation from a single photoKyeongUkJang
 
GAN - Generative Adversarial Nets
GAN - Generative Adversarial NetsGAN - Generative Adversarial Nets
GAN - Generative Adversarial NetsKyeongUkJang
 
Distilling the knowledge in a neural network
Distilling the knowledge in a neural networkDistilling the knowledge in a neural network
Distilling the knowledge in a neural networkKyeongUkJang
 
Latent Dirichlet Allocation
Latent Dirichlet AllocationLatent Dirichlet Allocation
Latent Dirichlet AllocationKyeongUkJang
 
Gaussian Mixture Model
Gaussian Mixture ModelGaussian Mixture Model
Gaussian Mixture ModelKyeongUkJang
 
Visualizing data using t-SNE
Visualizing data using t-SNEVisualizing data using t-SNE
Visualizing data using t-SNEKyeongUkJang
 
Playing atari with deep reinforcement learning
Playing atari with deep reinforcement learningPlaying atari with deep reinforcement learning
Playing atari with deep reinforcement learningKyeongUkJang
 
Chapter 20 Deep generative models
Chapter 20 Deep generative modelsChapter 20 Deep generative models
Chapter 20 Deep generative modelsKyeongUkJang
 
Chapter 19 Variational Inference
Chapter 19 Variational InferenceChapter 19 Variational Inference
Chapter 19 Variational InferenceKyeongUkJang
 
Natural Language Processing(NLP) - basic 2
Natural Language Processing(NLP) - basic 2Natural Language Processing(NLP) - basic 2
Natural Language Processing(NLP) - basic 2KyeongUkJang
 
Natural Language Processing(NLP) - Basic
Natural Language Processing(NLP) - BasicNatural Language Processing(NLP) - Basic
Natural Language Processing(NLP) - BasicKyeongUkJang
 
Chapter 17 monte carlo methods
Chapter 17 monte carlo methodsChapter 17 monte carlo methods
Chapter 17 monte carlo methodsKyeongUkJang
 
Chapter 16 structured probabilistic models for deep learning - 2
Chapter 16 structured probabilistic models for deep learning - 2Chapter 16 structured probabilistic models for deep learning - 2
Chapter 16 structured probabilistic models for deep learning - 2KyeongUkJang
 
Chapter 16 structured probabilistic models for deep learning - 1
Chapter 16 structured probabilistic models for deep learning - 1Chapter 16 structured probabilistic models for deep learning - 1
Chapter 16 structured probabilistic models for deep learning - 1KyeongUkJang
 
Chapter 15 Representation learning - 2
Chapter 15 Representation learning - 2Chapter 15 Representation learning - 2
Chapter 15 Representation learning - 2KyeongUkJang
 

Mais de KyeongUkJang (20)

Photo wake up - 3d character animation from a single photo
Photo wake up - 3d character animation from a single photoPhoto wake up - 3d character animation from a single photo
Photo wake up - 3d character animation from a single photo
 
YOLO
YOLOYOLO
YOLO
 
AlphagoZero
AlphagoZeroAlphagoZero
AlphagoZero
 
GoogLenet
GoogLenetGoogLenet
GoogLenet
 
GAN - Generative Adversarial Nets
GAN - Generative Adversarial NetsGAN - Generative Adversarial Nets
GAN - Generative Adversarial Nets
 
Distilling the knowledge in a neural network
Distilling the knowledge in a neural networkDistilling the knowledge in a neural network
Distilling the knowledge in a neural network
 
Latent Dirichlet Allocation
Latent Dirichlet AllocationLatent Dirichlet Allocation
Latent Dirichlet Allocation
 
Gaussian Mixture Model
Gaussian Mixture ModelGaussian Mixture Model
Gaussian Mixture Model
 
Visualizing data using t-SNE
Visualizing data using t-SNEVisualizing data using t-SNE
Visualizing data using t-SNE
 
Playing atari with deep reinforcement learning
Playing atari with deep reinforcement learningPlaying atari with deep reinforcement learning
Playing atari with deep reinforcement learning
 
Chapter 20 - GAN
Chapter 20 - GANChapter 20 - GAN
Chapter 20 - GAN
 
Chapter 20 - VAE
Chapter 20 - VAEChapter 20 - VAE
Chapter 20 - VAE
 
Chapter 20 Deep generative models
Chapter 20 Deep generative modelsChapter 20 Deep generative models
Chapter 20 Deep generative models
 
Chapter 19 Variational Inference
Chapter 19 Variational InferenceChapter 19 Variational Inference
Chapter 19 Variational Inference
 
Natural Language Processing(NLP) - basic 2
Natural Language Processing(NLP) - basic 2Natural Language Processing(NLP) - basic 2
Natural Language Processing(NLP) - basic 2
 
Natural Language Processing(NLP) - Basic
Natural Language Processing(NLP) - BasicNatural Language Processing(NLP) - Basic
Natural Language Processing(NLP) - Basic
 
Chapter 17 monte carlo methods
Chapter 17 monte carlo methodsChapter 17 monte carlo methods
Chapter 17 monte carlo methods
 
Chapter 16 structured probabilistic models for deep learning - 2
Chapter 16 structured probabilistic models for deep learning - 2Chapter 16 structured probabilistic models for deep learning - 2
Chapter 16 structured probabilistic models for deep learning - 2
 
Chapter 16 structured probabilistic models for deep learning - 1
Chapter 16 structured probabilistic models for deep learning - 1Chapter 16 structured probabilistic models for deep learning - 1
Chapter 16 structured probabilistic models for deep learning - 1
 
Chapter 15 Representation learning - 2
Chapter 15 Representation learning - 2Chapter 15 Representation learning - 2
Chapter 15 Representation learning - 2
 

CNN for sentence classification

  • 1. Convolutional Neural Networks for Sentence Classification 전희선
  • 2. http://www.people.fas.harvard.edu/~yoonkim/ 0. Abstract (ex: 긍정/부정)(+word2vec) pre-trained된 word vectors를 가지고 학습된 CNN을 통해 문장 분류를 한 여러 연구에 대해 보고 - 약간의 hyperparameter tuning이 들어간 간단한 CNN도 좋은 결과를 나타냄 - 총 7개 task 중 4개에서 다른 모델들 중 가장 좋은 결과를 보임
  • 3. Word Embedding : 단어를 저차원의 벡터로 표현 (ex: Word2Vec, GloVe 등) 1. Introduction - Word2Vec 밀집 표현(Dense Representation) : 각 단어의 특징이 표현된 벡터 (저차원) 희소 표현(Sparse Representation) : 단어별 ID 생성 (고차원(단어 개수 만큼의 차원), one-hot encoding) 단점 : 고차원 + 단어 간 유사성을 표현할 수 X
  • 4. (1) CBOW(Continuous Bag of Words) : 주변에 있는 단어로 중간 단어 예측 ex) 문장 “The fat cat sat on the mat” window size = 2 1. Introduction - Word2Vec
  • 5. [0, 1, 0, 0, 0, 0, 0] [0, 0, 1, 0, 0, 0, 0] [0, 0, 0, 0, 1, 0, 0] [0, 0, 0, 0, 0, 1, 0] [0, 0, 0, 1, 0, 0, 0] output : 중심 단어 input : 주변 단어 (1) CBOW(Continuous Bag of Words) : 주변에 있는 단어로 중간 단어 예측 1. Introduction - Word2Vec
  • 6. m : window size V : 문장의 단어 개수 (= 7) N : hidden layer 크기 (= 5) (1) CBOW(Continuous Bag of Words) : 주변에 있는 단어로 중간 단어 예측 1. Introduction - Word2Vec
  • 7. = 𝑧 𝑖 𝛴 𝑗ⅇ 𝑧 𝑗 (1) CBOW(Continuous Bag of Words) : 주변에 있는 단어로 중간 단어 예측 1. Introduction - Word2Vec
  • 8. - 학습되는 mechanism은 CBOW와 동일 (2) skip-gram : 중간 단어로 주변에 있는 단어 예측 1. Introduction - Word2Vec
  • 9. 1. Introduction – CNN Filter 1 0 1 0 1 0 1 0 1
  • 10. 2. Model – data(word vector) 준비 Google News의 1000억 개 단어로 구성된 데이터로 pre-trained된 Word2Vec(CBOW)을 word vector로 이용 (pre-trained된 word vector에 없는 단어는 random하게 벡터 값 초기화) n: 단어 개수 k: word vector 차원 window size가 다른 여러 filter들 적용한 conv layer 병렬적으로 생성 (filter 크기 : window size * k) window size = 2 window size = 3
  • 11. 2. Model – static | non-static | multi-channel non-static (input으로 넣은 word-vector까지 backprop) static (conv-layer까지 backprop) multi- channel static channel non-static channel
  • 12. 2. Model – step1 : concatenation 𝑥𝑖 ∈ ℝ 𝑘 : 문장 𝑖번째에 있는 단어의 k차원 word vector 𝑥1 𝑥2 𝑥9 . . . . .
  • 13. (⊕ : concatenate operator h : window size) 𝑥𝑖:𝑖+ℎ−1 = 𝑥𝑖 ⊕ 𝑥𝑖+1 ⊕ … ⊕ 𝑥𝑖+ℎ−1 : 𝑖번째부터 ℎ개의 단어 concatenate 𝑥1 𝑥2 𝑥9 . . . . . 𝑥1:2 𝑥8:9 𝑥4:6 2. Model – step1 : concatenation
  • 14. 2. Model – step2 : conv layer 생성 𝑐𝑖 = 𝑓 𝑤 ⋅ 𝑥𝑖:𝑖+ℎ−1 + 𝑏 (𝑓 : non-linear function(tanh 등) ℎ : window size 𝑏 : bias term) 𝑥1 𝑥2 𝑥9 . . . . . 𝑥1:2 𝑥8:9 𝑥4:6
  • 15. 2. Model – step3 : max-over-time pooling 𝑥1 𝑥2 𝑥9 . . . . . 𝑥1:2 𝑥8:9 𝑥4:6 𝑐 = 𝑐1, … , 𝑐 𝑛−ℎ+1 : feature map Ƹ𝑐 = max{𝑐} 각 conv layer마다 feature map 개수가 달라짐 → 각 conv layer마다 feature map 中 가장 큰 값만 사용 각 window size마다 생성
  • 16. 2. Model – step4 : softmax 𝑥1 𝑥2 𝑥9 . . . . . 𝑥1:2 𝑥8:9 𝑥4:6 softmax function 통해 최종 output 나옴 Ԧ𝑧 = Ƹ𝑐1, ⋯ , Ƹ𝑐 𝑚 m : filter 개수
  • 17. 2.1 Regularization - Dropout (keep probability p=0.5) : feature 中 반은 dropout으로 제거 → 2~4% 정확도 향상 (train에서만 사용, test에서는 dropout 하지 않음) - Test할 때 dropout을 하지 않으므로 ෡𝑤 = 𝑝𝑤 로 rescale Ԧ𝑦 = 𝑤 ⋅ Ԧ𝑧 + 𝑏 Ԧ𝑧 = Ƹ𝑐1, ⋯ , Ƹ𝑐 𝑚 Ԧ𝑦 = 𝑤 ⋅ ( Ԧ𝑧 ∘ Ԧ𝑟) + 𝑏 masking vector (dropout 여부를 0, 1[Bernoulli random variable]로 나타내 주는 vector) dropout m : filter 개수 ∘ : element-wise operation - 𝑤 2 > 𝑠일 경우 𝑤 2 = 𝑠로 rescale
  • 18. 3. Datasets and Experimental Setup 의미 label 수 문장 평균 길이 dataset 크기 단어 수 pre-trained word vector에 포함된 단어 수 test set 크기 MR (Movie Review) 영화 리뷰 문장 2 (긍정/부정) 20 10662 18765 16448 10-fold CV 사용 SST-1 (Stanford Sentiment Treebank-1) MR에서 test set 제공 + label 5개로 5 (매우 긍정/ 긍정/보통/부정 /매우 부정) 18 11855 17836 16262 2210 SST-2 (Stanford Sentiment Treebank-1) SST-1에서 보통 제거하고 binary label로 2 (긍정/부정) 19 9613 16185 14838 1821 Subj Subjectivity dataset 2 (주관/객관) 23 10000 21323 17913 10-fold CV 사용 TREC 의문문 dataset 6 (질문 종류) 10 5952 9592 9125 500 CR (Consumer Review) 소비자 리뷰 문장 2 (긍정/부정) 19 3775 5340 5046 10-fold CV 사용 MPQA 의견 2 (의견 극성) 3 10606 6246 6083 10-fold CV 사용
  • 19. 3.1 Hyperparameters and Training SST-2의 validation set으로 grid search 통해 설정 - Activation function : ReLU - Filter windows : h = 3, 4, 5 - Feature map : 100개 - Dropout rate : p = 0.5 - L2 constraint : s = 3 - Mini-batch size : 50 3.2 Pre-trained Word Vectors (앞에서 언급한 내용) Google News의 1000억 개 단어로 구성된 데이터로 pre-trained된 Word2Vec을 word vector로 이용 * Train 시 CBOW 사용 / word vector 차원: 300차원 * pre-trained된 word vector에 없는 단어는 random하게 벡터 값 초기화
  • 20. 3.3 Model Variations - CNN-rand : word vector가 random으로 초기화 - CNN-static : word2vec 사용 + static - CNN-non-static : word2vec 사용 + non-static - CNN-multichannel : word2vec 두 set(channel이라고도 부름) 사용 - 하나는 static, 다른 하나는 non-static 4 Results and Discussion 성능 BAD
  • 21. 4.1 Multichannel vs. Single Channel Models → 항상 Multichannel이 single channel model보다 성능이 더 좋은 것은 아니다! 4.2 Static vs. Non-static Representations → non-static은 static보다 통사적인 부분까지 고려됨
  • 22. 참고 사이트 https://wikidocs.net/33520 word2vec https://www.youtube.com/watch?v=EAJoRA0KX7I&list=PLoROMvodv4rOhcuXMZkNm7j3fVwBBY42z&index=11 CS224n – Lec11 https://www.youtube.com/watch?v=IRB2vXSet2E PR-015 https://zyint.tistory.com/575 논문요약1 https://arclab.tistory.com/149 논문요약2 https://ratsgo.github.io/natural%20language%20processing/2017/08/16/deepNLP/ NLP+Deep Learning
  • 23. Usually, NLP ➔ RNN 하지만 RNN에도 문제가 있었으니... * Why not RNN, but CNN?
  • 24. RNN의 단점을 보완해줄 CNN! * Why not RNN, but CNN?
  • 26. Word2vec이 큰 차이 없었던 이유: - word2vec이 새로운 feature를 주지만 데이터가 대용량(65만건 이상)이라 데이 터 크기만으로도 충분히 큰 역할을 해서 - 다양한 카테고리를 시험해서 같은 단어 라도 중의적인 표현으로 쓰였기 때문 * 한국어 ver