arxiv: v1 [cs.cl] 19 Apr 2017

Similar documents
Learning Structural Correspondences Across Different Linguistic Domains with Synchronous Neural Language Models

System Implementation for SemEval-2017 Task 4 Subtask A Based on Interpolated Deep Neural Networks

arxiv: v1 [cs.cl] 20 Jul 2015

Semi-supervised methods of text processing, and an application to medical concept extraction. Yacine Jernite Text-as-Data series September 17.

arxiv: v1 [cs.cl] 2 Apr 2017

A deep architecture for non-projective dependency parsing

LIM-LIG at SemEval-2017 Task1: Enhancing the Semantic Similarity for Arabic Sentences with Vectors Weighting

Unsupervised Learning of Word Semantic Embedding using the Deep Structured Semantic Model

Georgetown University at TREC 2017 Dynamic Domain Track

Linking Task: Identifying authors and book titles in verbose queries

Probabilistic Latent Semantic Analysis

Training a Neural Network to Answer 8th Grade Science Questions Steven Hewitt, An Ju, Katherine Stasaski

Learning Methods for Fuzzy Systems

Online Updating of Word Representations for Part-of-Speech Tagging

Target Language Preposition Selection an Experiment with Transformation-Based Learning and Aligned Bilingual Data

Modeling function word errors in DNN-HMM based LVCSR systems

A Case Study: News Classification Based on Term Frequency

POS tagging of Chinese Buddhist texts using Recurrent Neural Networks

Detecting English-French Cognates Using Orthographic Edit Distance

A study of speaker adaptation for DNN-based speech synthesis

Switchboard Language Model Improvement with Conversational Data from Gigaword

Using dialogue context to improve parsing performance in dialogue systems

Twitter Sentiment Classification on Sanders Data using Hybrid Approach

Unsupervised Cross-Lingual Scaling of Political Texts

Lecture 1: Machine Learning Basics

Deep Neural Network Language Models

Python Machine Learning

Modeling function word errors in DNN-HMM based LVCSR systems

Assignment 1: Predicting Amazon Review Ratings

Topic Modelling with Word Embeddings

Semantic and Context-aware Linguistic Model for Bias Detection

Word Embedding Based Correlation Model for Question/Answer Matching

MULTILINGUAL INFORMATION ACCESS IN DIGITAL LIBRARY

Dialog-based Language Learning

Web as Corpus. Corpus Linguistics. Web as Corpus 1 / 1. Corpus Linguistics. Web as Corpus. web.pl 3 / 1. Sketch Engine. Corpus Linguistics

Cross-Lingual Dependency Parsing with Universal Dependencies and Predicted PoS Labels

Second Exam: Natural Language Parsing with Neural Networks

Indian Institute of Technology, Kanpur

Differential Evolutionary Algorithm Based on Multiple Vector Metrics for Semantic Similarity Assessment in Continuous Vector Space

Autoencoder and selectional preference Aki-Juhani Kyröläinen, Juhani Luotolahti, Filip Ginter

Module 12. Machine Learning. Version 2 CSE IIT, Kharagpur

Probing for semantic evidence of composition by means of simple classification tasks

arxiv: v4 [cs.cl] 28 Mar 2016

A Neural Network GUI Tested on Text-To-Phoneme Mapping

A Vector Space Approach for Aspect-Based Sentiment Analysis

Role of Pausing in Text-to-Speech Synthesis for Simultaneous Interpretation

Ensemble Technique Utilization for Indonesian Dependency Parser

Rule Learning With Negation: Issues Regarding Effectiveness

METHODS FOR EXTRACTING AND CLASSIFYING PAIRS OF COGNATES AND FALSE FRIENDS

Lessons from a Massive Open Online Course (MOOC) on Natural Language Processing for Digital Humanities

The Internet as a Normative Corpus: Grammar Checking with a Search Engine

SEMAFOR: Frame Argument Resolution with Log-Linear Models

There are some definitions for what Word

A Comparison of Two Text Representations for Sentiment Analysis

Cross Language Information Retrieval

arxiv: v2 [cs.cl] 26 Mar 2015

On document relevance and lexical cohesion between query terms

Multi-Lingual Text Leveling

ON THE USE OF WORD EMBEDDINGS ALONE TO

A JOINT MANY-TASK MODEL: GROWING A NEURAL NETWORK FOR MULTIPLE NLP TASKS

What Can Neural Networks Teach us about Language? Graham Neubig a2-dlearn 11/18/2017

A Latent Semantic Model with Convolutional-Pooling Structure for Information Retrieval

Prediction of Maximal Projection for Semantic Role Labeling

Measurement. When Smaller Is Better. Activity:

Intra-talker Variation: Audience Design Factors Affecting Lexical Selections

A Simple VQA Model with a Few Tricks and Image Features from Bottom-up Attention

BENCHMARK TREND COMPARISON REPORT:

Reducing Features to Improve Bug Prediction

SINGLE DOCUMENT AUTOMATIC TEXT SUMMARIZATION USING TERM FREQUENCY-INVERSE DOCUMENT FREQUENCY (TF-IDF)

arxiv: v2 [cs.ir] 22 Aug 2016

Human Emotion Recognition From Speech

CS Machine Learning

Boosting Named Entity Recognition with Neural Character Embeddings

OCR for Arabic using SIFT Descriptors With Online Failure Prediction

Artificial Neural Networks written examination

THE ROLE OF DECISION TREES IN NATURAL LANGUAGE PROCESSING

Distant Supervised Relation Extraction with Wikipedia and Freebase

The taming of the data:

The Karlsruhe Institute of Technology Translation Systems for the WMT 2011

(Sub)Gradient Descent

Speech Recognition at ICSI: Broadcast News and beyond

Speech Emotion Recognition Using Support Vector Machine

Multilingual Sentiment and Subjectivity Analysis

Residual Stacking of RNNs for Neural Machine Translation

Noisy SMS Machine Translation in Low-Density Languages

Memory-based grammatical error correction

Mandarin Lexical Tone Recognition: The Gating Paradigm

Learning Methods in Multilingual Speech Recognition

Rule Learning with Negation: Issues Regarding Effectiveness

Improving Machine Learning Input for Automatic Document Classification with Natural Language Processing

Natural Language Processing. George Konidaris

FBK-HLT-NLP at SemEval-2016 Task 2: A Multitask, Deep Learning Approach for Interpretable Semantic Textual Similarity

TRANSFER LEARNING IN MIR: SHARING LEARNED LATENT REPRESENTATIONS FOR MUSIC AUDIO CLASSIFICATION AND SIMILARITY

Chunk Parsing for Base Noun Phrases using Regular Expressions. Let s first let the variable s0 be the sentence tree of the first sentence.

2/15/13. POS Tagging Problem. Part-of-Speech Tagging. Example English Part-of-Speech Tagsets. More Details of the Problem. Typical Problem Cases

Towards a Machine-Learning Architecture for Lexical Functional Grammar Parsing. Grzegorz Chrupa la

Enhancing Unlexicalized Parsing Performance using a Wide Coverage Lexicon, Fuzzy Tag-set Mapping, and EM-HMM-based Lexical Probabilities

Literal or idiomatic? Identifying the reading of single occurrences of German multiword expressions using word embeddings

Vocabulary Usage and Intelligibility in Learner Language

Word Segmentation of Off-line Handwritten Documents

Transcription:

Redefining Context Windows for Word Embedding Models: An Experimental Study Pierre ison Norwegian Computing Center Oslo, Norway plison@nr.no Andrei Kutuzov anguage Technology Group University of Oslo andreku@ifi.uio.no arxiv:1704.05781v1 [cs.c] 19 Apr 2017 Abstract Distributional semantic models learn vector representations of words through the contexts they occur in. Although the choice of context (which often takes the form of a sliding window) has a direct influence on the resulting embeddings, the exact role of this model component is still not fully understood. This paper presents a systematic analysis of context windows based on a set of four distinct hyperparameters. We train continuous Skip- Gram models on two English-language corpora for various combinations of these hyper-parameters, and evaluate them on both lexical similarity and analogy tasks. Notable experimental results are the positive impact of cross-sentential contexts and the surprisingly good performance of right-context windows. 1 Introduction Distributional semantic models represent words through real-valued vectors of fixed dimensions, based on the distributional properties of these words observed in large corpora. Recent approaches such as prediction-based models (Mikolov et al., 2013b) and GloVe (Pennington et al., 2014) have shown that it is possible to estimate dense, low-dimensional vectors (often called embeddings) able to capture various functional or topical relations between words. These embeddings are used in a wide range of NP tasks, including part-of-speech tagging, syntactic parsing, named entity recognition and semantic role labelling; see (Collobert et al., 2011; in et al., 2015; Zhou and Xu, 2015; ample et al., 2016), among others. As recently shown by (evy et al., 2015), the empirical variations between embedding models are largely due to differences in hyper-parameters (many of which are tied to the underlying definition of context) rather than differences in the embedding algorithms themselves. In this paper, we further develop their findings with a comprehensive analysis of the role played by context window parameters when learning word embeddings. Four specific aspects are investigated: 1. The maximum size of the context window; 2. The weighting scheme of context words according to their distance to the focus word; 3. The relative position of the context window (symmetric, left or right side); 4. The treatment of linguistic boundaries such as end-of-sentence markers. The next section 2 provides a brief overview on word embeddings and context windows. Section 3 describes the experimental setup used to evaluate the influence of these four aspects. Finally, Section 4 presents and discusses the results. 2 Background The works of (Bengio et al., 2003) and (Mikolov et al., 2013b) introduced a paradigm-shift for distributional semantic models with new predictionbased algorithms outperforming the existing count-based approaches (Baroni et al., 2014). The word2vec models from (Mikolov et al., 2013b), comprising the Continuous Skip-gram and the Continuous Bag-of-Words algorithms, are now a standard part of many NP pipelines. Despite their differences, all types of distributional semantic models require the definition of a context for each word observed in a given corpus. Given a set of (word, context) pairs extracted from the corpus, vector representations of words can be derived through various estimation methods, such as predicting words given their contexts

(CBOW), predicting the contexts from the words (Skip-Gram), or factorizing the log of their cooccurrence matrix (GloVe). In all of these approaches, the choice of context is a crucial factor that directly affects the resulting vector representations. The most common method for defining this context is to rely on a window centered around the word to estimate (often called the focus word) 1. The context window thus determines which contextual neighbours are taken into account when estimating the vector representations. The most prominent hyper-parameter associated to the context window is the maximum window size (i.e. the maximum distance between the focus word and its contextual neighbours). This parameter is the easiest one to adjust using existing software, which is why it is comparatively well studied. arger windows are known to induce embeddings that are more topical or associative, improving their performance on analogy test sets, while smaller windows induce more functional and synonymic models, leading to better performance on similarity test sets (Goldberg, 2016). However, the context window is also affected by other, less obvious hyper-parameters. Inside a given window, words that are closer to the focus word should be given more weights than more distant ones. To this end, CBOW and Continuous Skip-gram rely on a dynamic window mechanism where the actual size of the context window is sampled uniformly from 1 to, where is the maximum. This mechanism is equivalent to sampling each context word w j with a probability that decreases linearly with the distance j i to the focus word w i : P(w j w i ) = window=1 = 1 ( j i + 1) P(w j w i,window)p(window) where window is the actual (from 1 to ) sampled by the algorithm. Similarly, the cooccurrence statistics used by GloVe rely on harmonic series where words at distance d from the focus word are assigned a weight 1 d. For example, with the 3, the context word at the position 2 will be sampled with the probability of 2/3 in word2vec and the probability of 1 /2 in GloVe. 1 Other types of context have been proposed, such as dependency-based contexts (evy and Goldberg, 2014) or multilingual contexts (Upadhyay et al., 2016), but these are outside the scope of the present paper. Another implicit hyper-parameter is the symmetric nature of the context window. The word2vec and GloVe models pay equivalent attention to the words to the left and to the right of the focus word. However, the relative importance of left or right contexts may in principle depend on the linguistic properties of the corpus language, in particular its word ordering constraints. Finally, although distributional semantic models do not themselves enforce any theoretical limit on the boundaries of context windows, word embeddings are in practice often estimated on a sentence by sentence basis, thus constraining the context windows to stop at sentence boundaries. However, to the best of our knowledge, there is no systematic evaluation of how this sentence-boundary constraint affects the resulting embeddings. 3 Experimental setup To evaluate how context windows affect the embeddings, we trained Continuous Skip-gram with Negative Sampling (SGNS) embeddings for various configurations of hyper-parameters, whose values are detailed in Table 1. In particular, the weighting scheme encodes how the context words should be weighted according to their distance with the focus word. This hyperparameter is given two possible values: a linear weighting scheme corresponding to the default word2vec weights, or an alternative scheme using the squared root of the distance. Hyper-parameter Possible values Max. {1, 2, 5, 10} Weighting scheme { d+1, d+1 } Window position {left, right, symmetric} Cross-sentential {yes, no} Stop words removal {yes, no} Table 1: Range of possible hyper-parameter values evaluated in the experiment. The embeddings were trained on two Englishlanguage corpora: Gigaword v5 (Parker et al., 2011), a large newswire corpus of approx. 4 billion word tokens, and the English version of OpenSubtitles (ison and Tiedemann, 2016), a large repository of movie and TV subtitles, of approx. 700 million word tokens. The two corpora correspond to distinct linguistic genres, Gigaword being a corpus of news documents (average sentence length

21.7 tokens) while OpenSubtitles is a conversational corpus (average sentence length 7.3 tokens). OpenSubtitles notably contains a large number of non-sentential utterances, which are utterances lacking an overt predicate and depend on the surrounding dialogue context for their interpretation (Fernández, 2006). The corpora were lemmatized and POS-tagged with the Stanford CoreNP (Manning et al., 2014) and each token was replaced with its lemma and POS tag. Two versions of the corpora were used for the evaluation: one raw version with all tokens, and one filtered version after removal of stop words and punctuation. The word embeddings were trained with 300- dimensional vectors, 10 negative samples per word and 5 iterations. Very rare words (less than 100 occurrences in Gigaword, less than 10 in OpenSubtitles) were filtered out. The models were then evaluated using two standard test workflows: Spearman correlation against Simex-999 semantic similarity dataset (Hill et al., 2015) and accuracy on the semantic sections of the Google Analogies Dataset (Mikolov et al., 2013a). 4 Results All in all, we trained 96 models on Gigaword (GW) and 96 models on OpenSubtitles (OS) 2. Figure 1 illustrates the results for the SGNS embeddings on lexical similarity and analogy tasks using various types of context windows. The main findings from the experiments are as follows. Window size As expected for a lexical similarity task (Schütze and Pedersen, 1993), narrow context windows perform best with the Simex999 dataset, which contains pairs of semantically similar words (not just related). For the analogy task, larger context windows are usually beneficial, but not always: the word embeddings trained on OpenSubtitles perform best with the of 10, while the best results on the analogy task for Gigaword are obtained with the of 2. Window position Table 2 shows how the position of the context window influences the average model performance. Note that symmetric windows of, for instance, 10 are in fact 2 times larger than the left or right 2 Encompassing different values of, weighting scheme, window position, cross-sentential boundaries and stop-words removal (4 2 3 2 2 = 96). Window position Simex999 Analogies OS left OS right 3 OS symmetric 3 GW left 3 4 GW right 4 5 GW symmetric 8 Table 2: Average performance across all models depending on the window position. windows of the same size, as they consider 10 words both to the left and to the right of the focus word. This is most likely why symmetric windows consistently outperform single-sided ones on the analogy task, as they are able to include twice as much contextual input. However, the average performance on the semantic similarity task (as indicated by the Spearman correlation with the Simex999 test set) does not exhibit the same trend. eft windows are indeed worse than symmetric ones, but right windows are on par with the symmetric windows for OpenSubtitles and only one percent point behind them for Gigaword. It means that in many cases (at least with English texts) taking into account only n context words to the right of the focus word is sufficient to achieve the same performance with Simex999 as by using a model which additionally considers n words to the left, and thus requires significantly more training time. Cross-sentential contexts The utility of cross-sentential contexts depends on several covariates, most importantly the type of corpus and the nature of the evaluation task. For similarity tasks, cross-sentential contexts do not seem useful, and can even be detrimental for large s. However, for analogy tasks, crosssentential contexts lead to improved results thanks to the increased window it provides. This is especially pronounced for corpora with short sentences such as OpenSubtitles (see Table 3). Weighting scheme Our experimental results show that none of the two evaluated weighting schemes (with weights that decrease respectively linearly or with the squareroot of the distance) gives a consistent advantage averaged across all models. However, the squared weighting scheme is substantially slower (as it

Simex 0 corpus = Gigaword, unfiltered corpus = Gigaword, filtered corpus = OpenSubtitles, unfiltered corpus = OpenSubtitles, filtered window position left right symmetric Simex 0 distance measure sqrt linear Simex 0 5 cross-sentential False True corpus = Gigaword, unfiltered corpus = Gigaword, filtered corpus = OpenSubtitles, unfiltered corpus = OpenSubtitles, filtered window position left right symmetric distance measure sqrt linear cross-sentential False True Figure 1: Results for the SGNS word embeddings trained with various types of context windows. Cross-sentential Simex999 Analogies OS False 4 4 OS True 3 GW False 4 6 GW True 4 5 Table 3: Average performance across all models with and without cross-sentential contexts. Stop words removal Simex999 Analogies OS no removal 1 4 OS with removal 2 3 GW no removal 4 4 GW with removal 4 8 Table 4: Average performance across all models depending on the removal of stop words. increases the number of context words to consider for each focus word), decreasing the training speed about 25% with 5. Thus, the original linear weighting scheme proposed in (Mikolov et al., 2013b) should be preferred. Stop words removal As shown in Table 4, the removal of stop words does not really influence the average model performance for the semantic similarity task. The analogy task, however, benefits substantially from this filtering, for both corpora. Although not shown in the table, filtering stop words also significantly decreases the size of the corpus, thereby reducing the total time needed to train the word embeddings. 5 Conclusion Our experiments demonstrate the importance of choosing the right type of context window when learning word embedding models. The two most prominent findings are (1) the positive role of cross-sentential contexts and (2) the fact that, at least for English corpora, right-side contexts seem to be more important than left-side contexts for similarity tasks, and achieve a performance comparable to that of symmetric windows. In the future, we wish to extend this study to the CBOW algorithm, to other weighting schemes (such as the harmonic series employed by GloVe), and to non-english corpora.

References [Baroni et al.2014] Marco Baroni, Georgiana Dinu, and Germán Kruszewski. 2014. Don t count, predict! a systematic comparison of context-counting vs. context-predicting semantic vectors. In Proceedings of the 52nd Annual Meeting of the Association for Computational inguistics (Volume 1: ong Papers), pages 238 247. Association for Computational inguistics. [Bengio et al.2003] Yoshua Bengio, Rejean Ducharme, and Pascal Vincent. 2003. A neural probabilistic language model. Journal of Machine earning Research, 3:1137 1155. [Collobert et al.2011] Ronan Collobert, Jason Weston, éon Bottou, Michael Karlen, Koray Kavukcuoglu, and Pavel Kuksa. 2011. Natural language processing (almost) from scratch. Journal of Machine earning Research, 12(Aug):2493 2537. [Fernández2006] Raquel Fernández. 2006. Non- Sentential Utterances in Dialogue: Classification, Resolution and Use. Ph.D. thesis, King s College ondon. [Goldberg2016] Yoav Goldberg. 2016. A primer on neural network models for natural language processing. Journal of Artificial Intelligence Research, 57:345 420. [Hill et al.2015] Felix Hill, Roi Reichart, and Anna Korhonen. 2015. Simlex-999: Evaluating semantic models with (genuine) similarity estimation. Computational inguistics, 41(4):665 695. [ample et al.2016] Guillaume ample, Miguel Ballesteros, Sandeep Subramanian, Kazuya Kawakami, and Chris Dyer. 2016. Neural architectures for named entity recognition. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational inguistics: Human anguage Technologies, pages 260 270, San Diego, California, June. Association for Computational inguistics. [evy and Goldberg2014] Omer evy and Yoav Goldberg. 2014. Dependency-based word embeddings. In Proceedings of the 52nd Annual Meeting of the Association for Computational inguistics, AC 2014, pages 302 308. [evy et al.2015] Omer evy, Yoav Goldberg, and Ido Dagan. 2015. Improving distributional similarity with lessons learned from word embeddings. Transactions of the Association for Computational inguistics, 3:211 225. [in et al.2015] Chu-Cheng in, Waleed Ammar, Chris Dyer, and ori evin. 2015. Unsupervised pos induction with word embeddings. In Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational inguistics: Human anguage Technologies, pages 1311 1316, Denver, Colorado, May June. Association for Computational inguistics. [ison and Tiedemann2016] P. ison and J. Tiedemann. 2016. Opensubtitles2016: Extracting large parallel corpora from movie and TV subtitles. In Proceedings of the 10th International Conference on anguage Resources and Evaluation (REC 2016), pages 923 929. [Manning et al.2014] Christopher D. Manning, Mihai Surdeanu, John Bauer, Jenny Finkel, Steven J. Bethard, and David McClosky. 2014. The Stanford CoreNP natural language processing toolkit. In Association for Computational inguistics (AC) System Demonstrations, pages 55 60. [Mikolov et al.2013a] Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013a. Efficient estimation of word representations in vector space. arxiv preprint arxiv:1301.3781. [Mikolov et al.2013b] Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. 2013b. Distributed representations of words and phrases and their compositionality. In C. J. C. Burges,. Bottou, M. Welling, Z. Ghahramani, and K. Q. Weinberger, editors, Advances in Neural Information Processing Systems 26, pages 3111 3119. Curran Associates, Inc. [Parker et al.2011] Robert Parker, David Graff, Junbo Kong, Ke Chen, and Kazuaki Maeda. 2011. English gigaword fifth edition, June. DC2011T07. [Pennington et al.2014] Jeffrey Pennington, Richard Socher, and Christopher D. Manning. 2014. GloVe: Global vectors for word representation. In Empirical Methods in Natural anguage Processing (EMNP), pages 1532 1543. [Schütze and Pedersen1993] Hinrich Schütze and Jan Pedersen. 1993. A vector model for syntagmatic and paradigmatic relatedness. In Proceedings of the 9th Annual Conference of the UW Centre for the New OED and Text Research, pages 104 113. [Upadhyay et al.2016] Shyam Upadhyay, Manaal Faruqui, Chris Dyer, and Dan Roth. 2016. Crosslingual models of word embeddings: An empirical comparison. In Proc. of AC. [Zhou and Xu2015] Jie Zhou and Wei Xu. 2015. Endto-end learning of semantic role labeling using recurrent neural networks. In Proceedings of the 53rd Annual Meeting of the Association for Computational inguistics and the 7th International Joint Conference on Natural anguage Processing (Volume 1: ong Papers), pages 1127 1137, Beijing, China, July. Association for Computational inguistics.