((자연어 이해 Natural Language Unerstanding) 이 글은 아래 원문을 구글 번역을 이용하여 한글로 번역한 것입니다. 약간의 수정이 있을 수 있습니다. 이글의 번역은 비영리 목적입니다.)
Understanding Multi-Dimensionality in Vector Space Modeling
The code snippet assumes Anaconda 5.2.0 version of Python virtual environment
Acknowledgement
Some materials on this post are from CS224n: Natural Language Processing with Deep Learning at the Stanford University.
Check out the YouTube Lecture on Word Vectors and Word Senses taught by Dr. Chris Manning.
코드 조각은 Python 가상 환경의 Anaconda 5.2.0 버전을 가정합니다.
(알림)
이 게시물의 일부 자료는 CS224n : Stanford University의 딥 러닝을 사용한 자연어 처리에서 가져온 것입니다.
Chris Manning 박사가 가르치는 단어 벡터 및 단어 감각에 대한 YouTube 강의를 확인하십시오.
One of the critical components in Natural Langauge Processing (NLP) is to encode text information in a numerical format that can be fed into an NLP model. Such technique, representing words in a numerical vector space, is called Vector Space Modeling. It is often synonymous to word embedding. A typical vector space model that haven’t went through dimensional reduction has a dimension of V×NV×N, where VV is a size of unique vocabulary, and NN varies based on the choice of modeling method (Notes: in document-to-word embedding model like TF-IDF, VV is a number of documents and and NN is a size of unique vocabulary).
In this context, VV is basically a sample data size — the larger the VV, the bigger the training data set. It is always good to have more training data than the otherwise. Therefore, our prime interest lies within the size of NN, which affects the multi-dimensionality of a vector space model.
Here is a simple illustration of how words look like in a high dimensional vector space.
NLP (Natural Langauge Processing)의 중요한 구성 요소 중 하나는 NLP 모델에 제공 할 수있는 숫자 형식으로 텍스트 정보를 인코딩하는 것입니다. 숫자 벡터 공간에서 단어를 표현하는 이러한 기술을 벡터 공간 모델링이라고합니다. 종종 단어 임베딩과 동의어입니다. 차원 축소를 거치지 않은 일반적인 벡터 공간 모델의 차원은 V × NV × N입니다. 여기서 VV는 고유 한 어휘의 크기이고 NN은 선택한 모델링 방법에 따라 달라집니다 (참고 : 문서에서 TF-IDF와 같은 단어 임베딩 모델, VV는 여러 문서이며 NN은 고유 한 어휘의 크기입니다).
이 맥락에서 VV는 기본적으로 샘플 데이터 크기입니다 .- VV가 클수록 훈련 데이터 세트가 커집니다. 다른 것보다 더 많은 훈련 데이터를 갖는 것이 항상 좋습니다. 따라서 우리의 주요 관심사는 벡터 공간 모델의 다차원성에 영향을 미치는 NN의 크기에 있습니다.
다음은 고차원 벡터 공간에서 단어가 어떻게 보이는지에 대한 간단한 그림입니다.
Figure 1: simple 10-dimensional word vectors
Consider the two semantically similar words, “Success” and “Achieve”. When converted into 10-dimensional word vectors using a vector space model of one’s choice (Ex: Word2Vec), each word is a 1×101×10 vector where each value in a vector represent the word’s position in a 10D space. When projected on this high dimensional vector space, the similarity between words can be quantified by evaluating the similarity between these two word vectors. Observe that the vectors in the illustration above looks similar to each other: positions of non-zero values, and values of each cell. Similar word vectors will put similar words close to each other in a vector space, and as a result, “Success” and “Achieve” will have small Euclidean or Cosine Distance.
One might experience difficulty in trying to visualize the Euclidean or Cosine distance of the word vectors in a 10D vector space. In fact, you can’t visualize anything bigger then 3D. If one attempts to visualize the word vectors in a 2D or 3D space, he will have to represent the word vectors in 2D or 3D space first using dimensional reduction. Let’s assume that such dimensional reduction was performed and the word vectors for “Success” and “Achieve” are reduced to 3D vectors. The word vectors will then look like this:
의미 상 유사한 두 단어 인 “Success”와 “Achieve”를 고려하십시오. 자신이 선택한 벡터 공간 모델 (예 : Word2Vec)을 사용하여 10 차원 단어 벡터로 변환 할 때 각 단어는 벡터의 각 값이 10D 공간에서 단어의 위치를 나타내는 1x101x10 벡터입니다. 이 고차원 벡터 공간에 투영 될 때,이 두 단어 벡터 간의 유사성을 평가하여 단어 간의 유사성을 정량화 할 수 있습니다. 위 그림의 벡터는 0이 아닌 값의 위치와 각 셀의 값이 서로 비슷해 보이는지 확인합니다. 유사한 단어 벡터는 벡터 공간에서 유사한 단어를 서로 가깝게 배치하고 결과적으로 “성공”및 “달성”은 작은 유클리드 또는 코사인 거리를 갖습니다.
10D 벡터 공간에서 단어 벡터의 유클리드 또는 코사인 거리를 시각화하는 데 어려움을 겪을 수 있습니다. 사실 3D보다 더 큰 것은 시각화 할 수 없습니다. 2D 또는 3D 공간에서 단어 벡터를 시각화하려고 시도하면 먼저 차원 축소를 사용하여 2D 또는 3D 공간에서 단어 벡터를 표현해야합니다. 이러한 차원 축소가 수행되고 “Success”및 “Achieve”에 대한 단어 벡터가 3D 벡터로 축소되었다고 가정 해 보겠습니다. 단어 벡터는 다음과 같습니다.
Figure 2: Dimensional-reduced word vectors visualization in 3D
Observe the dissimilarity between two word vectors and their positions within the 3D vector space. This is because 3 dimensions are not enough to capture all relationship among words and as a result fails to maintain the semantic relationship between two similar words, “Success” and “Achieve”.
Multi-dimensionality in vector space modeling has great significance because it directly affects the performance of any NLP model. In this post, the concept and effect of multi-dimensionality in NLP will be illustrated using mainly Co-Occurence Matrix and some Word2Vec models.
두 단어 벡터와 3D 벡터 공간 내 위치 간의 차이를 관찰합니다. 이는 3 차원이 단어 간의 모든 관계를 포착하기에 충분하지 않아 결과적으로 두 개의 유사한 단어 인 “Success”와 “Achieve”간의 의미 관계를 유지하지 못하기 때문입니다.
벡터 공간 모델링의 다차원 성은 NLP 모델의 성능에 직접적인 영향을 미치기 때문에 큰 의미를 갖습니다. 이 게시물에서는 주로 Co-Occurence Matrix와 일부 Word2Vec 모델을 사용하여 NLP에서 다차원 성의 개념과 효과를 설명합니다.
Review on Vector Space Model Techniques
Before we talk about the significance of the size of dimensions (NN), let us review how text information is transformed into a numerical matrix. Please feel free to skip this part if you are already knowledgable about this topic.
There are two types of methods for word embedding: Frequency-Based Methods and Prediction-Based Methods. The below table lists some options we have for each type of embedding method.
벡터 공간 모델 기법 검토
차원 크기 (NN)의 중요성에 대해 이야기하기 전에 텍스트 정보가 숫자 행렬로 어떻게 변환되는지 살펴 보겠습니다. 이 주제에 대해 이미 알고있는 경우이 부분을 건너 뛰어도됩니다.
단어 임베딩 방법에는 빈도 기반 방법과 예측 기반 방법의 두 가지 유형이 있습니다. 아래 표에는 각 임베딩 방법 유형에 대한 몇 가지 옵션이 나열되어 있습니다.
Frequency-based methods are pretty straightforward to understand. It counts how many times each word appeared in each document, or how many times each word appeared together with each words. Co-Occurence Matrix is a type of frequency-based methods.
빈도수-기반 방법(%주파수기반 방법을 빈도수 기반 방법으로 수정했습니다.%) 은 이해하기 매우 간단합니다. 각 단어가 각 문서에 나타난 횟수 또는 각 단어가 각 단어와 함께 나타난 횟수를 계산합니다. Co-Occurence Matrix는 주파수 기반 방법(% 이건 수정하지 않았습니다.%) 의 한 유형입니다.
(% Frequency-based methods를 구글번역이 주파수 기반이라고 번역해서 빈도수 기반으로 수정해주었더니 다음에는 빈도수 기반이라고 번역하네요. 단락 단락을 순차적으로 COPY & PASTE 해서 번역을 시켰는데… 맥락적으로 그렇게 된 것인지 아니면 수정이 실시간 반영된 것인지는 모르겠네요. 그리고 이렇게 번역을 해보니 영어원문 본문을 이해하는 것하고 그 이론을 적용한 구글번역을 체험해보고 또 수정도 해보면서 여러가지 효과가 있는 것 같습니다.)
Co-Occurence Matrix
The value of NN for co-occurence matrix is the size of unique vocabulary. In the other words, co-occurence matrix is a square matrix of size V×VV×V.
Consider a co-occurence matrix with a fixed window size of n=1n=1. Setting window size n=1n=1 will tell the model to search adjacent context words that are positioned directly left or right of a center word. The matrix is contructed using the following two input documents:
Document 1: “all that glitters is not gold”
Document 2: “all is well that ends well”
동시 발생 매트릭스
동시 발생 행렬에 대한 N 값은 고유 한 어휘의 크기입니다. 즉, 동시 발생 행렬은 V × V 크기의 정사각형 행렬입니다.
고정 창 크기가 n = 1 인 동시 발생 행렬을 고려하십시오. 창 크기를 n = 1로 설정하면 모델이 중앙 단어의 바로 왼쪽 또는 오른쪽에있는 인접한 컨텍스트 단어를 검색하도록합니다. 행렬은 다음 두 입력 문서를 사용하여 구성됩니다.
문서 1 : “빛나는 것은 금이 아니다”
문서 2 : “잘 끝나는 모든 것이 잘됨”
원문 Table 1: Co-Occurence Matrix 참조
Notes: START and END tokens
In NLP, we often add START and END tokens to represent the beginning and end of sentences, paragraphs or documents. In thise case we imagine START and END tokens encapsulating each document, e.g., “START All that glitters is not gold END”, and include these tokens in our co-occurrence counts.
참고 : START 및 END 토큰
NLP에서 우리는 종종 문장, 단락 또는 문서의 시작과 끝을 나타내는 START 및 END 토큰을 추가합니다. 이 경우 각 문서를 캡슐화하는 START 및 END 토큰 (예 : “START 반짝이는 모든 것은 금이 아닙니다 END”)을 상상하고 이러한 토큰을 동시 발생 횟수에 포함합니다.
This co-occurence matrix is essentially a vector space model of VV-dimensional (VV columns) matrix, in which V=10V=10. However, in most NLP tasks, this co-occurence matrix goes through PCA or SVD for dimensional reduction and decomposed into a new kk-dimensional matrix.
이 동시 발생 행렬은 본질적으로 V = 10 인 V 차원 (V 열) 행렬의 벡터 공간 모델입니다. 그러나 대부분의 NLP 작업에서이 동시 발생 행렬은 차원 축소를 위해 PCA 또는 SVD를 거쳐 새로운 k 차원 행렬로 분해됩니다.
원문 Table 2: Dimension Reduced Co-Occurence Matrix 참조
The original matrix was 10D matrix (10 columns) — this can’t be visualized. Humans can understand only up to 3D visualizations. However, dimensional reduction was performed with sklearn.decomposition.TruncatedSVD(n_components=2)
, and the output table yielded a new matrix with reduced dimension of k=2k=2. This was because I set n_components = 2
. The word vectors can now be visualized in a 2D space.
Further discussions about the choice of n_components
and dimensional reduction will be followed in the later section of this post.
원래의 행렬은 10D 행렬 (10 열)-시각화 할 수 없습니다. 인간은 최대 3D 시각화 만 이해할 수 있습니다. 그러나 차원 축소는 sklearn.decomposition.TruncatedSVD (n_components = 2)로 수행되었으며 출력 테이블은 감소 된 차원이 k = 2k = 2 인 새 행렬을 생성했습니다. n_components = 2로 설정했기 때문입니다. 이제 단어 벡터를 2D 공간에서 시각화 할 수 있습니다.
n_components의 선택과 차원 축소에 대한 추가 논의는이 게시물의 뒷부분에서 이어질 것입니다.
Figure 3: Dimensional-reduced word vectors visualization in 2D
Word2Vec
Contrary to frequency-based methods, prediction-based methods are more difficult to understand. As the name ‘prediction’ implies, their methodologies are based on predicting context words given a center word (Word2Vec Skip-Gram: P(wcontext∣wcenter)P(wcontext∣wcenter)), or a center word given context words (Continuous Bag of Words: P(wcenter∣wcontext)P(wcenter∣wcontext)).
Prediction-based methods use neural network algorithm, which means that we have to worry about the number of neurons (weights) in a network. In Word2Vec model, the model matrix has a dimension of V×NV×N, where VV is the size of unique vocabulary and the size of NN is the number of neurons in a network.
빈도 기반 방법(%여기서는 frequency-based methods를 구글이 빈도 기반 방법이라고 번역했습니다.%) 과 달리 예측 기반 방법은 이해하기가 더 어렵습니다. ‘예측’이라는 이름에서 알 수 있듯이, 그 방법론은 중심 단어 (Word2Vec Skip-Gram : P (wcontext∣wcenter) P (wcontext∣wcenter)) 또는 중심 단어 (Continuous Bag 단어 수 : P (wcenter∣wcontext) P (wcenter∣wcontext)).
예측 기반 방법은 신경망 알고리즘을 사용하므로 네트워크의 뉴런 (가중치) 수에 대해 걱정해야합니다. Word2Vec 모델에서 모델 행렬의 차원은 V × NV × N입니다. 여기서 VV는 고유 한 어휘의 크기이고 NN의 크기는 네트워크의 뉴런 수입니다.
Figure 3: Skip-Gram algorithm structure for Word2Vec
During the forward and back propagation process, the weights in Matrix WW (Embedding matrix) of size V×NV×N and Matrix W′W′ (Context matrix) of size N×VN×V are optimized to minimize a loss function. Recall that the number of neurons (NN) is a hyper-parameter that needs to be empirically optimized. Choosing different values for NN will yield different output performances. N=300N=300 is a dimensional parameter known to work well with Word2Vec models. Note that a matrix with a dimension of 300 cannot be visualized. However, the dimension can be reduced down to 2D or 3D using t-distributed stochastic neighbor embedding (t-SNE), or PCA. For NLP visualization purpose, T-SNE is often preferred over PCA or SVD due to its ability to reduce high dimensions to low dimensions while capturing complex relationships with neighboring wods. More comparison about PCA vs T-SNE will be illustrated later.
순방향 및 역방향 전파 과정에서 손실 함수를 최소화하기 위해 크기 VxN의 Matrix W (임베딩 행렬) 및 크기 NxV의 Matrix W ‘(컨텍스트 행렬)의 가중치를 최적화합니다. 뉴런의 수 (N)는 경험적으로 최적화해야하는 하이퍼 매개 변수라는 것을 상기하십시오. N에 대해 다른 값을 선택하면 다른 출력 성능이 생성됩니다. N = 300은 Word2Vec 모델에서 잘 작동하는 것으로 알려진 치수 매개 변수입니다. 차원이 300 인 행렬은 시각화 할 수 없습니다. 그러나 t- 분산 확률 적 인접 임베딩 (t-SNE) 또는 PCA를 사용하여 차원을 2D 또는 3D로 줄일 수 있습니다. NLP 시각화 목적의 경우 T-SNE는 높은 차원을 낮은 차원으로 줄이는 동시에 인접한 wod와의 복잡한 관계를 캡처 할 수 있기 때문에 PCA 또는 SVD보다 선호되는 경우가 많습니다. PCA와 T-SNE에 대한 자세한 비교는 나중에 설명합니다.
Notes: Word2Vec algorithm
The theory behind Word2Vec skip-gram algorithm maybe complex and difficult to understand for beginners. I encourage you to read the following two and articles that explain the theory. They do it quite well.
참고 : Word2Vec 알고리즘
Word2Vec 스킵 그램 알고리즘의 이론은 초보자에게 복잡하고 이해하기 어려울 수 있습니다. 이론을 설명하는 다음 두 가지 기사와 기사를 읽어 보시기 바랍니다. 그들은 그것을 아주 잘합니다.
Why is Multi-Dimensionality Important?
First, high dimensionality leads to high computational cost. This is especially true in the case of co-occurence matrix, in which it has a dimension of V×VV×V, where VV is the size of vocabulary in a corpus. The previous example shown in Table 1 had a corpus size of 12 words, and vocab size of 10 words. In real-life applications, corpus size easily exceeds 10’s or 100 GB’s. For example, Gensim’s pre-trained Word2Vec model trained from Google News had a vocab size of three million (Github Source). If we obtain a co-occurence matrix and feed it into an NLP model without dimensional reduction, we will be training our model with a matrix size of 3M×3M3M×3M. This is unrealistic. We need to choose an optimal value for reduced dimension kk that will best describe the variability of the data while significantly cutting down the computational cost.
다차원 성이 중요한 이유는 무엇입니까?
첫째, 높은 차원 성은 높은 계산 비용으로 이어집니다. 이것은 V × V의 차원을 갖는 동시 발생 행렬의 경우 특히 그렇습니다. 여기서 V는 말뭉치의 어휘 크기입니다. 표 1에 표시된 이전 예는 말뭉치 크기가 12 단어이고 어휘 크기가 10 단어입니다. 실제 애플리케이션에서 말뭉치 크기는 10GB 또는 100GB를 쉽게 초과합니다. 예를 들어, Gensim의 사전 훈련 된 Google 뉴스에서 훈련 된 Word2Vec 모델의 어휘 크기는 3 백만입니다 (Github Source). 동시 발생 행렬을 얻어 차원 축소없이 NLP 모델에 공급하면 3M x 3M의 행렬 크기로 모델을 훈련합니다. 이것은 비현실적입니다. 계산 비용을 크게 줄이면서 데이터의 변동성을 가장 잘 설명하는 축소 차원 k에 대한 최적 값을 선택해야합니다.
On the other hand, computational cost due to high dimensionality is NOT a big concern with Word2Vec, because the most optimal dimension for Word2Vec are already known to be between 200–600 (Note: this doesn’t mean that Word2Vec is superior to co-occurence matrix. Each has its own pros and cons).
It is natural to think that high dimension would lead to higher accuracy, but this happens at the cost of increased computation time. One needs to find a “sweet spot” that optimizes the trade-off between accuracy vs. computation time. The recent paper submitted in Dec 2018 proposed a deterministic way to compute the optimal number of kk-dimensions. It’s code implementation is available on this Github repo.
Second, dimension is a critical parameter in word embedding. Too low dimension leads to underfitting and makes your model not expressive enough to capture all possible word relations. On the other hand, too high dimension results in overfitting. However, in the recent paper, it was discovered that Word2Vec and GloVe models are not sensitive to overfitting.
반면에 Word2Vec에 대한 최적의 차원이 이미 200–600 사이 인 것으로 알려져 있기 때문에 높은 차원 성으로 인한 계산 비용은 Word2Vec에서 큰 문제가되지 않습니다 (참고 : Word2Vec이 공동보다 우수하다는 의미는 아닙니다. 각각의 장단점이 있습니다.)
높은 차원이 더 높은 정확도로 이어질 것이라고 생각하는 것은 당연하지만 이는 계산 시간이 늘어나는 대신 발생합니다. 정확도와 계산 시간 사이의 균형을 최적화하는 “스위트 스팟”을 찾아야합니다. 2018 년 12 월에 제출 된 최근 논문은 최적의 k 차원 수를 계산하는 결정 론적 방법을 제안했습니다. 이 Github 저장소에서 코드 구현을 사용할 수 있습니다.
둘째, 차원은 단어 임베딩에서 중요한 매개 변수입니다. 차원이 너무 낮 으면 과소 적합으로 이어지고 가능한 모든 단어 관계를 포착 할 수있을만큼 모델의 표현력이 떨어집니다. 반면에 차원이 너무 높으면 과적 합이 발생합니다. 그러나 최근 논문에서 Word2Vec 및 GloVe 모델은 과적 합에 민감하지 않다는 것이 밝혀졌습니다.
Figure 4: skip-gram Word2Vec: over-parametrization does not significantly hurt performance
Figure 5: GloVe: over-parametrization does not significantly hurt performance
The spikes of the skip gram Word2Vec and and GloVe models revealed the existence of the “sweet spot” in which a certain number of dimensions leads to the highest accuracy. The sharp rise in accuracy in the far left zone showed that too low number of dimensions results in underfitting. However, it is interesting to note that the flat right tail of the charts showed that indefinitely increasing the number of dimensions did not really result in overfitting. Often times in neural net applications, too high number of dimensions (neurons) results in overfitting, but in skip-gram Word2Vec and GloVe, this was not the case.
A typical good NLP model trained on a wide variety of corpora has a dimension in the order of hundreds. The famous Mikolov et al. 2013 paper on skip-gram Word2Vec model suggests 300 neurons, and Rohde et al. ms., 2005 paper on co-occurence/correlation matrix suggests 600–800 dimensions (columns) as the optimum parameters for vector space modeling.
스킵 그램 Word2Vec 및 GloVe 모델의 스파이크는 특정 수의 치수가 가장 높은 정확도로 이어지는 “스위트 스팟”의 존재를 나타냅니다. 맨 왼쪽 영역의 정확도가 급격히 증가한 결과 치수 수가 너무 적 으면 적합하지 않은 것으로 나타났습니다. 그러나 차트의 평평한 오른쪽 꼬리는 차원 수를 무한정 늘리더라도 실제로 과적 합이 발생하지 않았 음을 보여 주었다는 점이 흥미 롭습니다. 종종 신경망 애플리케이션에서 너무 많은 수의 차원 (뉴런)이 과적 합을 초래하지만 스킵 그램 Word2Vec 및 GloVe에서는 그렇지 않습니다.
다양한 말뭉치에서 훈련 된 일반적인 좋은 NLP 모델은 대략 수백 개의 차원을 가지고 있습니다. 유명한 Mikolov et al. Skip-gram Word2Vec 모델에 대한 2013 년 논문은 300 개의 뉴런을 제안하고 Rohde et al. co-occurence / correlation matrix에 관한 2005 년 논문은 벡터 공간 모델링을위한 최적의 매개 변수로 600–800 차원 (열)을 제안합니다.
Vector Space Modeling: Crude Oil News
벡터 공간 모델링 : 원유 뉴스
Figure 6: International news organization, Reuters
그림 6 : 국제 뉴스 조직, Reuters
Enough of theories. Now let’s dive into the actual application of vector space modeling with Python code implementation. We will explore multi-dimensionality in NLP task using Reuters news articles on crude oil.
Take a glance at the overall content of the crude oil articles with the following WordCloud visualizaiton.
충분한 이론. 이제 Python 코드 구현을 사용하여 벡터 공간 모델링의 실제 적용에 대해 알아 보겠습니다. 우리는 원유에 관한 Reuters 뉴스 기사를 사용하여 NLP 작업의 다차원 성을 탐구 할 것입니다.
다음 WordCloud 시각화를 통해 원유 기사의 전체 내용을 한눈에 볼 수 있습니다.
Figure 7: WordCloud of crude oil articles
그림 7 : 원유 기사의 WordCloud
.
.
.
(여기서부터 결론 이전까지의 코드와 설명은 각자 구글번역 등을 이용하여 원문을 읽어보세요~)
.
.
.
Conclusion
It is known that a well trained Word2Vec model has 300 dimensions. Think of each dimension in Word2Vec vector space as an entity that represents word relationships: man vs woman, objects vs living, humans vs animals, nation vs city, drink vs food, action vs concept, and many more. Assume that that there are 300 of these kinds of relationships among all words in this world, represented by a single dimension per relationship.
The 3D visualization from the co-occurrence matrix model was able to capture the cluster of oil-producing entities (Sixth observation). But it wasn’t able to differentiate between nations and companies, because it simply didn’t have a dimension that captures that kind of relationship (Eighth observation).
In Figure 10, the model sensed the negative feelings that “discouraged” and “violations” conveyed, and put them in a close vector space (Second observation). But when viewed from a different angle, or to put it better, viewed from a different dimension, the model put them far apart because they do not convey similar meanings (Figure 11 & 12).
On the other hand, the model completely failed to distinguish between “paris” vs “barrels” + “bpd” (Fifth observation). Recall that our explained_variance_ratio_
for 3-dimension was 92.3% above. Some information about "paris" could've been lost during dimensional reduction and that might have caused the error in word vector projection on a 3D vector space. Or, we simply did not have sufficient training data.
Having more dimensions allows a model to capture more complex relationships among words, and that’s precisly why Google’s Word2Vec model had 300 dimensions.
결론
잘 훈련 된 Word2Vec 모델에는 300 차원이있는 것으로 알려져 있습니다. Word2Vec 벡터 공간의 각 차원을 남자 대 여자, 사물 대 생활, 인간 대 동물, 국가 대 도시, 음료 대 음식, 행동 대 개념 등 단어 관계를 나타내는 엔티티로 생각하십시오. 이 세상의 모든 단어들 사이에 관계 당 하나의 차원으로 표현되는 이러한 종류의 관계가 300 개 있다고 가정합니다.
동시 발생 매트릭스 모델의 3D 시각화는 석유 생산 개체의 클러스터를 포착 할 수있었습니다 (6 번째 관찰). 그러나 국가와 기업을 구분할 수 없었습니다. 단순히 그런 관계를 포착하는 차원이 없었기 때문입니다 (8 번째 관찰).
그림 10에서 모델은 “낙담 한”및 “위반”이 전달하는 부정적인 감정을 감지하여 가까운 벡터 공간에 배치했습니다 (두 번째 관찰). 그러나 다른 각도에서 보거나 더 잘 표현하기 위해 다른 차원에서 볼 때 모델은 유사한 의미를 전달하지 않기 때문에 멀리 떨어져 있습니다 (그림 11 및 12).
반면에 모델은 “paris”와 “barrels”+ “bpd”를 완전히 구분하지 못했습니다 (다섯 번째 관찰). 3 차원에 대한 explain_variance_ratio_가 92.3 % 이상이었습니다. 차원 축소 중에 “paris”에 대한 일부 정보가 손실되었을 수 있으며 이로 인해 3D 벡터 공간에서 단어 벡터 투영 오류가 발생했을 수 있습니다. 또는 단순히 훈련 데이터가 충분하지 않았습니다.
더 많은 차원을 사용하면 모델이 단어 간의 더 복잡한 관계를 캡처 할 수 있으며, 이것이 바로 Google의 Word2Vec 모델에 300 차원이있는 이유입니다.