Comparing the Quality and Speed of Sentence Classification with Modern Language Models

Total Page:16

File Type:pdf, Size:1020Kb

Comparing the Quality and Speed of Sentence Classification with Modern Language Models applied sciences Article Comparing the Quality and Speed of Sentence Classification with Modern Language Models Krzysztof Fiok 1 , Waldemar Karwowski 1 , Edgar Gutierrez 1,2,* and Mohammad Reza-Davahli 1 1 Department of Industrial Engineering and Management Systems, University of Central Florida, Orlando, FL 32816, USA; fi[email protected] (K.F.); [email protected] (W.K.); [email protected] (M.R.-D.) 2 Center for Latin-American Logistics Innovation, LOGyCA, 110111 Bogota, Colombia * Correspondence: [email protected]; Tel.: +1-515-441-5519 Received: 3 April 2020; Accepted: 11 May 2020; Published: 14 May 2020 Abstract: After the advent of Glove and Word2vec, the dynamic development of language models (LMs) used to generate word embeddings has enabled the creation of better text classifier frameworks. With the vector representations of words generated by newer LMs, embeddings are no longer static but are context-aware. However, the quality of results provided by state-of-the-art LMs comes at the price of speed. Our goal was to present a benchmark to provide insight into the speed–quality trade-off of a sentence classifier framework based on word embeddings provided by selected LMs. We used a recurrent neural network with gated recurrent units to create sentence-level vector representations from word embeddings provided by an LM and a single fully connected layer for classification. Benchmarking was performed on two sentence classification data sets: The Sixth Text REtrieval Conference (TREC6)set and a 1000-sentence data set of our design. Our Monte Carlo cross-validated results based on these two data sources demonstrated that the newest deep learning LMs provided improvements over Glove and FastText in terms of weighted Matthews correlation coefficient (MCC) scores. We postulate that progress in LMs is more apparent when more difficult classification tasks are addressed. Keywords: natural language processing; text classification; language model; deep learning; classification data set 1. Introduction Recent years have seen substantial development in natural language processing (NLP), owing to the creation of vector representations of text called embeddings. The breakthrough language models (LMs) Glove [1] and Word2 Vec [2] enabled the creation of static word-level embeddings, which have the same form regardless of the context in which the word is found. Over time, researchers developed LMs capable of creating vector representations of text entities of different lengths, e.g., by analyzing text at the character [3–5] or sub-word level [6]. Recent progress in this field is exemplified by the development of many LMs that create contextualized word embeddings, i.e., their form depends on the context in which the token is found, as in Embeddings from Language Models (ELMo) [7], Bidirectional Encoder Representations from Transformers (BERT) [8], or Generalized Autoregressive Pretraining for Language Understanding (XLNet) [9]. The modern sentence classification approach relies on token level vector representations provided by a chosen LM from which sentence level embeddings are created. LMs providing more sophisticated contextualized embeddings should increase the quality of sentence classification but at the expense of speed. Maintaining a balance between quality and speed is considered important by many researchers, as evidenced by the struggles in developing efficient NLP frameworks [10–12]. However, the time cost Appl. Sci. 2020, 10, 3386; doi:10.3390/app10103386 www.mdpi.com/journal/applsci Appl.Appl. Sci.Sci. 20202020,, 1010,, 3386x FOR PEER REVIEW 22 ofof 1213 results in downstream tasks remain unclear. Determining this information is not trivial because when anda new the LM extent is topublished, which newer authors LMs (ratherusually thanprovide static comparisons embeddings) of improve quality results but not in downstreaminformation tasksregarding remain the unclear. training Determining time (TT) and this inference information time is(IT). not Comparing trivial because results when from a new various LM isframeworks published, authorscan also usuallybe difficult provide because comparisons of the use of of quality different but methods not information for creating regarding sentence the trainingembeddings time from (TT) andlower inference-level embeddings, time (IT). Comparing e.g., by naïvely results comp fromuting various averages frameworks of word can embeddings also be di ffiorcult by becausecomputing of thethe useelement of di-wisefferent sum methods of the forrepresentations creating sentence at each embeddings word position from [13] lower-level, or by using embeddings, a deep neural e.g., bynetwork naïvely [13], computing recurrent averages neural ofnetwork word embeddings(RNN) [14], orbidirectional by computing long the short element-wise-term memory sum ofRNN the representations(BiLSTM) [15], o atr hierarchy each word by position max pooling [13], or (HBMP) by using [16] a deepmodel. neural Therefore, network two [13 factors], recurrent often change neural networkat one time (RNN) and [influence14], bidirectional the quality long of short-term sentence-level memory embeddings, RNN (BiLSTM) namely [ 15the], LM or hierarchy providing by token max poolingembeddings (HBMP) and [ 16the] model.method Therefore, of creating two sentence factors-level often embeddings. change at one time and influence the quality of sentence-levelAnother hin embeddings,drance when namely comparing the LM the providing quality of token LMs embeddingsis that authors and often the method choose ofto creatingpublish sentence-levelevaluations carried embeddings. out on a variety of data sets yet provide results for only the best model obtained afterAnother many training hindrance runs when without comparing reporting the relevant quality ofstatistical LMs is that informat authorsion often regarding choose the to publishaverage evaluationsmodels trained carried in their out onapplied a variety frameworks. of data sets yet provide results for only the best model obtained afterIn many the present training study, runs withoutwe compared reporting the embeddings relevant statistical created informationby various LMs regarding in a single the sentence average modelsclassification trained framework in their applied that used frameworks. the same RNN to create sentence-level embeddings to ensure that the overallIn the presentperformance study, was we comparedunbiased by the the embeddings choice of createdalgorithm by for various the creation LMs in aof single sentence sentence-level classificationembeddings. frameworkAdditionally that, to used improve the same the RNN comparability to create sentence-level of the selected embeddings LMs, we to ensureperformed that thebenchmarking overall performance analysis on was the unbiased same data by sets, the choicenamely of The algorithm Sixth Text for REtrieval the creation Conference of sentence-level (TREC6) embeddings.set [17] and our Additionally, preliminary tomeetings improve preliminary the comparability data set (MPD) of the [18] selected consisting LMs, of we 1000 performed labeled benchmarkingsentences, which analysis are published on the samealong data with sets, this namelypaper. Furthermore, The Sixth Text we REtrieval performed Conference Monte Carlo (TREC6) cross- setvalidation [17] and (MCCV) our preliminary [19] to assess meetings the quality preliminary of predictions data set (MPD)and the [18 TT] consistingand IT achieved of 1000 with labeled the sentences,selected LMs. which All are tests published were conducted along with on this the paper. same Furthermore,computing machine. we performed To further Monte improve Carlo cross-validationcomparability, for (MCCV) all compared [19] to assessLMs, we the used quality the of same predictions fine-tuning and theregimen TT and developed IT achieved during with a thepreli selectedminary LMs.study. All tests were conducted on the same computing machine. To further improve comparability, for all compared LMs, we used the same fine-tuning regimen developed during a preliminary2. General Framework study. 2.2.1. General Text Classification Framework 2.1. TextIn this Classification research, we used Flair v. 0.4.4 [11], an NLP framework written in PyTorch and published by the authors of the Flair LM [20]; this program enables the creation of text classification models basedIn on this various research, state we-of used-the-art Flair LMs. v. 0.4.4 With [11 this], an framework, NLP framework we instantiated written in sentence PyTorch-level and publishedclassifiers byby theusing authors a unidirectional of the Flair LMRNN [20 with]; this gated program recurrent enables units the (GRU creation RNN) of text with classification a single fully models connected based onlayer various for final state-of-the-art sentence classification. LMs. With The this GRU framework, RNN task we was instantiated to create sentence-levela constant-length classifiers, sentence by- usinglevel vector a unidirectional representation RNN withfrom gatedtoken recurrentlevel embeddings units (GRU provided RNN) with by the a single selected fully LMs. connected An overall layer forscheme final presenting sentence classification. this workflow The is presented GRU RNN in taskFigure was 1. toIn createthe Flair a constant-length, framework, if we sentence-level chose an LM vectorenabling representation fine-tuning fromon the token downstream level embeddings task, e.g., BERT, provided the byprocess the selected of training LMs. the An GRU overall RNN scheme along presentingwith the classification
Recommended publications
  • Automatic Correction of Real-Word Errors in Spanish Clinical Texts
    sensors Article Automatic Correction of Real-Word Errors in Spanish Clinical Texts Daniel Bravo-Candel 1,Jésica López-Hernández 1, José Antonio García-Díaz 1 , Fernando Molina-Molina 2 and Francisco García-Sánchez 1,* 1 Department of Informatics and Systems, Faculty of Computer Science, Campus de Espinardo, University of Murcia, 30100 Murcia, Spain; [email protected] (D.B.-C.); [email protected] (J.L.-H.); [email protected] (J.A.G.-D.) 2 VÓCALI Sistemas Inteligentes S.L., 30100 Murcia, Spain; [email protected] * Correspondence: [email protected]; Tel.: +34-86888-8107 Abstract: Real-word errors are characterized by being actual terms in the dictionary. By providing context, real-word errors are detected. Traditional methods to detect and correct such errors are mostly based on counting the frequency of short word sequences in a corpus. Then, the probability of a word being a real-word error is computed. On the other hand, state-of-the-art approaches make use of deep learning models to learn context by extracting semantic features from text. In this work, a deep learning model were implemented for correcting real-word errors in clinical text. Specifically, a Seq2seq Neural Machine Translation Model mapped erroneous sentences to correct them. For that, different types of error were generated in correct sentences by using rules. Different Seq2seq models were trained and evaluated on two corpora: the Wikicorpus and a collection of three clinical datasets. The medicine corpus was much smaller than the Wikicorpus due to privacy issues when dealing Citation: Bravo-Candel, D.; López-Hernández, J.; García-Díaz, with patient information.
    [Show full text]
  • ACL 2019 Social Media Mining for Health Applications (#SMM4H)
    ACL 2019 Social Media Mining for Health Applications (#SMM4H) Workshop & Shared Task Proceedings of the Fourth Workshop August 2, 2019 Florence, Italy c 2019 The Association for Computational Linguistics Order copies of this and other ACL proceedings from: Association for Computational Linguistics (ACL) 209 N. Eighth Street Stroudsburg, PA 18360 USA Tel: +1-570-476-8006 Fax: +1-570-476-0860 [email protected] ISBN 978-1-950737-46-8 ii Preface Welcome to the 4th Social Media Mining for Health Applications Workshop and Shared Task - #SMM4H 2019. The total number of users of social media continues to grow worldwide, resulting in the generation of vast amounts of data. Popular social networking sites such as Facebook, Twitter and Instagram dominate this sphere. According to estimates, 500 million tweets and 4.3 billion Facebook messages are posted every day 1. The latest Pew Research Report 2, nearly half of adults worldwide and two- thirds of all American adults (65%) use social networking. The report states that of the total users, 26% have discussed health information, and, of those, 30% changed behavior based on this information and 42% discussed current medical conditions. Advances in automated data processing, machine learning and NLP present the possibility of utilizing this massive data source for biomedical and public health applications, if researchers address the methodological challenges unique to this media. In its fourth iteration, the #SMM4H workshop takes place in Florence, Italy, on August 2, 2019, and is co-located with the
    [Show full text]
  • Mapping the Hyponymy Relation of Wordnet Onto
    Under review as a conference paper at ICLR 2019 MAPPING THE HYPONYMY RELATION OF WORDNET ONTO VECTOR SPACES Anonymous authors Paper under double-blind review ABSTRACT In this paper, we investigate mapping the hyponymy relation of WORDNET to feature vectors. We aim to model lexical knowledge in such a way that it can be used as input in generic machine-learning models, such as phrase entailment predictors. We propose two models. The first one leverages an existing mapping of words to feature vectors (fastText), and attempts to classify such vectors as within or outside of each class. The second model is fully supervised, using solely WORDNET as a ground truth. It maps each concept to an interval or a disjunction thereof. On the first model, we approach, but not quite attain state of the art performance. The second model can achieve near-perfect accuracy. 1 INTRODUCTION Distributional encoding of word meanings from the large corpora (Mikolov et al., 2013; 2018; Pen- nington et al., 2014) have been found to be useful for a number of NLP tasks. These approaches are based on a probabilistic language model by Bengio et al. (2003) of word sequences, where each word w is represented as a feature vector f(w) (a compact representation of a word, as a vector of floating point values). This means that one learns word representations (vectors) and probabilities of word sequences at the same time. While the major goal of distributional approaches is to identify distributional patterns of words and word sequences, they have even found use in tasks that require modeling more fine-grained relations between words than co-occurrence in word sequences.
    [Show full text]
  • Pairwise Fasttext Classifier for Entity Disambiguation
    Pairwise FastText Classifier for Entity Disambiguation a,b b b Cheng Yu , Bing Chu , Rohit Ram , James Aichingerb, Lizhen Qub,c, Hanna Suominenb,c a Project Cleopatra, Canberra, Australia b The Australian National University c DATA 61, Australia [email protected] {u5470909,u5568718,u5016706, Hanna.Suominen}@anu.edu.au [email protected] deterministically. Then we will evaluate PFC’s Abstract performance against a few baseline methods, in- cluding SVC3 with hand-crafted text features. Fi- For the Australasian Language Technology nally, we will discuss ways to improve disambig- Association (ALTA) 2016 Shared Task, we uation performance using PFC. devised Pairwise FastText Classifier (PFC), an efficient embedding-based text classifier, 2 Pairwise Fast-Text Classifier (PFC) and used it for entity disambiguation. Com- pared with a few baseline algorithms, PFC Our Pairwise FastText Classifier is inspired by achieved a higher F1 score at 0.72 (under the the FastText. Thus this section starts with a brief team name BCJR). To generalise the model, description of FastText, and proceeds to demon- we also created a method to bootstrap the strate PFC. training set deterministically without human labelling and at no financial cost. By releasing 2.1 FastText PFC and the dataset augmentation software to the public1, we hope to invite more collabora- FastText maps each vocabulary to a real-valued tion. vector, with unknown words having a special vo- cabulary ID. A document can be represented as 1 Introduction the average of all these vectors. Then FastText will train a maximum entropy multi-class classi- The goal of the ALTA 2016 Shared Task was to fier on the vectors and the output labels.
    [Show full text]
  • Fasttext.Zip: Compressing Text Classification Models
    Under review as a conference paper at ICLR 2017 FASTTEXT.ZIP: COMPRESSING TEXT CLASSIFICATION MODELS Armand Joulin, Edouard Grave, Piotr Bojanowski, Matthijs Douze, Herve´ Jegou´ & Tomas Mikolov Facebook AI Research fajoulin,egrave,bojanowski,matthijs,rvj,[email protected] ABSTRACT We consider the problem of producing compact architectures for text classifica- tion, such that the full model fits in a limited amount of memory. After consid- ering different solutions inspired by the hashing literature, we propose a method built upon product quantization to store word embeddings. While the original technique leads to a loss in accuracy, we adapt this method to circumvent quan- tization artefacts. Combined with simple approaches specifically adapted to text classification, our approach derived from fastText requires, at test time, only a fraction of the memory compared to the original FastText, without noticeably sacrificing quality in terms of classification accuracy. Our experiments carried out on several benchmarks show that our approach typically requires two orders of magnitude less memory than fastText while being only slightly inferior with respect to accuracy. As a result, it outperforms the state of the art by a good margin in terms of the compromise between memory usage and accuracy. 1 INTRODUCTION Text classification is an important problem in Natural Language Processing (NLP). Real world use- cases include spam filtering or e-mail categorization. It is a core component in more complex sys- tems such as search and ranking. Recently, deep learning techniques based on neural networks have achieved state of the art results in various NLP applications. One of the main successes of deep learning is due to the effectiveness of recurrent networks for language modeling and their application to speech recognition and machine translation (Mikolov, 2012).
    [Show full text]
  • Question Embeddings for Semantic Answer Type Prediction
    Question Embeddings for Semantic Answer Type Prediction Eleanor Bill1 and Ernesto Jiménez-Ruiz2 1, 2 City, University of London, London, EC1V 0HB Abstract. This paper considers an answer type and category prediction challenge for a set of natural language questions, and proposes a question answering clas- sification system based on word and DBpedia knowledge graph embeddings. The questions are parsed for keywords, nouns and noun phrases before word and knowledge graph embeddings are applied to the parts of the question. The vectors produced are used to train multiple multi-layer perceptron models, one for each answer type in a multiclass one-vs-all classification system for both answer cat- egory prediction and answer type prediction. Different combinations of vectors and the effect of creating additional positive and negative training samples are evaluated in order to find the best classification system. The classification system that predict the answer category with highest accuracy are the classifiers trained on knowledge graph embedded noun phrases vectors from the original training data, with an accuracy of 0.793. The vector combination that produces the highest NDCG values for answer category accuracy is the word embeddings from the parsed question keyword and nouns parsed from the original training data, with NDCG@5 and NDCG@10 values of 0.471 and 0.440 respectively for the top five and ten predicted answer types. Keywords: Semantic Web, knowledge graph embedding, answer type predic- tion, question answering. 1 Introduction 1.1 The SMART challenge The challenge [1] provided a training set of natural language questions alongside a sin- gle given answer category (Boolean, literal or resource) and 1-6 given answer types.
    [Show full text]
  • Data Driven Value Creation
    DATA DRIVEN VALUE CREATION DATA SCIENCE & ANALYTICS | DATA MANAGEMENT | VISUALIZATION & DATA EXPERIENCE D ONE, Sihlfeldstrasse 58, 8003 Zürich, d-one.ai Agenda Time Content Who 9.00 Introduction Philipp 9.30 Hands-On 1: How to kick-start NLP Jacqueline 10.15 Break / Letting People Catch up All ;-) 10.45 About ELK Philipp 11.00 Hands-On 2: Deep Dive Jacqueline 12.15 Wrap up / Discussion All 2 Today’s hosts Philipp Thomann Jacqueline Stählin Here today & tomorrow morning Here today & Monday till Wednesday 3 Setup Course Git - https://github.com/d-one/NLPeasy-workshop For infos during Workshop - https://tlk.io/amld2020-nlpeasy 4 «Making sense of data is the winning competence in all industries.» 5 Data drives Transformation 6 About ■ Zurich-based, established in 2005 with focus: data-driven value creation ■ 50 data professionals with excellent business and technical understanding & network ■ International & Swiss clients ■ In selected cases: investor for data-driven start-ups 7 Capabilities Business Consulting - Guide on data journey - Use cases, roadmap - Transformation and change - Building capabilities Machine Learning / AI Data Architecture - Ideation, implementation, - Data strategy operationalization Passionate - Enterprise requirements - Algorithms, modelling, NLP & - Information factory - Image recognition, visual analytics Down to - BI and analytics - Text analytics - Data science laboratory earth Data Management Data Experience - Data supply chain - From data to Insights to action - Data integration and modelling - Business report
    [Show full text]
  • Two Models for Named Entity Recognition in Spanish
    Two Models for Named Entity Recognition in Spanish. Submission to the CAPITEL Shared Task at IberLEF 2020 Elena Álvarez-Melladoa aInformation Sciences Institute, University of Southern California Abstract This paper documents two sequence-labeling models for NER in Spanish: a conditional random field model with handcrafted features and a BiLSTM-CRF model with word and character embeddings. Both models were trained and tested using CAPITEL (an annotated corpus of newswire written in European Spanish) and were submitted to the shared task on Spanish NER at IberLEF 2020. The best result was obtained by the CRF model, which produced an F1 score of 84.39 on the test set and was ranked #6 on the shared task. Keywords Spanish NER, CRF, BiLSTM-CRF 1. Introduction and Previous Work Named entity recognition (NER) is the task of extracting relevant spans of text (such as person names, location names, organization names) from a given document. NER has usually been framed as a sequence labeling problem [1]. Consequently, different sequence labeling approaches have been applied to NER, such as hidden Markov models [2], maxent Markov models [3] or conditional random field [4, 5]. More recently, different neural architectures have also been applied to NER [6, 7]. In this paper, we explore two sequence-labeling models to perform NER on CAPITEL, an annotated corpus of journalistic texts written in European Spanish. The explored models are a CRF model with handcrafted features and a BiLSTM-CRF model with word and character embeddings. Both models were submitted to the CAPITEL shared task on Spanish NER at IberLEF 2020 [8].
    [Show full text]
  • Learning Word Vectors for 157 Languages
    Learning Word Vectors for 157 Languages Edouard Grave1;∗ Piotr Bojanowski1;∗ Prakhar Gupta1;2 Armand Joulin1 Tomas Mikolov1 1Facebook AI Research 2EPFL fegrave,bojanowski,ajoulin,[email protected], [email protected] Abstract Distributed word representations, or word vectors, have recently been applied to many tasks in natural language processing, leading to state-of-the-art performance. A key ingredient to the successful application of these representations is to train them on very large corpora, and use these pre-trained models in downstream tasks. In this paper, we describe how we trained such high quality word representations for 157 languages. We used two sources of data to train these models: the free online encyclopedia Wikipedia and data from the common crawl project. We also introduce three new word analogy datasets to evaluate these word vectors, for French, Hindi and Polish. Finally, we evaluate our pre-trained word vectors on 10 languages for which evaluation datasets exists, showing very strong performance compared to previous models. Keywords: word vectors, word analogies, fasttext 1. Introduction are available at https://fasttext.cc. Distributed word representations, also known as word vec- Related work. In previous work, word vectors pre- tors, have been widely used in natural language processing, trained on large text corpora have been released along- leading to state of the art results for many tasks. Publicly side open source implementation of word embedding mod- available models, which are pre-trained on large amounts els. English word vectors trained on a part of the of data, have become a standard tool for many NLP appli- Google News dataset (100B tokens) were published with cations, but are mostly available for English.
    [Show full text]
  • Developing Amaia: a Conversational Agent for Helping Portuguese Entrepreneurs—An Extensive Exploration of Question-Matching Approaches for Portuguese
    information Article Developing Amaia: A Conversational Agent for Helping Portuguese Entrepreneurs—An Extensive Exploration of Question-Matching Approaches for Portuguese José Santos 1 , Luís Duarte 1 , João Ferreira 1 , Ana Alves 1,2 and Hugo Gonçalo Oliveira 1,* 1 CISUC, DEI, University of Coimbra, 3030-290 Coimbra, Portugal; [email protected] (J.S.); [email protected] (L.D.); [email protected] (J.F.); [email protected] (A.A.) 2 Instituto Superior de Engenharia de Coimbra (ISEC), Instituto Politécnico de Coimbra, 3030-199 Coimbra, Portugal * Correspondence: [email protected] Received: 31 July 2020; Accepted: 28 August 2020; Published: 1 September 2020 Abstract: This paper describes how we tackled the development of Amaia, a conversational agent for Portuguese entrepreneurs. After introducing the domain corpus used as Amaia’s Knowledge Base (KB), we make an extensive comparison of approaches for automatically matching user requests with Frequently Asked Questions (FAQs) in the KB, covering Information Retrieval (IR), approaches based on static and contextual word embeddings, and a model of Semantic Textual Similarity (STS) trained for Portuguese, which achieved the best performance. We further describe how we decreased the model’s complexity and improved scalability, with minimal impact on performance. In the end, Amaia combines an IR library and an STS model with reduced features. Towards a more human-like behavior, Amaia can also answer out-of-domain questions, based on a second corpus integrated in the KB. Such interactions are identified with a text classifier, also described in the paper. Keywords: semantic textual similarity; question answering; conversational agents; machine learning; information retrieval; text classification 1.
    [Show full text]
  • Deep Learning for Natural Language Processing Creating Neural Networks with Python
    Deep Learning for Natural Language Processing Creating Neural Networks with Python Palash Goyal Sumit Pandey Karan Jain Deep Learning for Natural Language Processing: Creating Neural Networks with Python Palash Goyal Sumit Pandey Bangalore, Karnataka, India Bangalore, Karnataka, India Karan Jain Bangalore, Karnataka, India ISBN-13 (pbk): 978-1-4842-3684-0 ISBN-13 (electronic): 978-1-4842-3685-7 https://doi.org/10.1007/978-1-4842-3685-7 Library of Congress Control Number: 2018947502 Copyright © 2018 by Palash Goyal, Sumit Pandey, Karan Jain Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the book’s product page, located at www.apress.com/978-1-4842-3684-0. For more detailed information, please visit www.apress.com/source-code. Contents Introduction�������������������������������������������������������������������������������������� xvii Chapter 1: Introduction to Natural Language Processing and Deep Learning ���������������������������������������������������������������������1 Python Packages ���������������������������������������������������������������������������������������������������3 NumPy �������������������������������������������������������������������������������������������������������������3 Pandas �������������������������������������������������������������������������������������������������������������8 SciPy ��������������������������������������������������������������������������������������������������������������13 Introduction to Natural
    [Show full text]
  • Text Feature Mining Using Pre-Trained Word Embeddings
    DEGREE PROJECT IN MATHEMATICS, SECOND CYCLE, 30 CREDITS STOCKHOLM, SWEDEN 2018 Text Feature Mining Using Pre-trained Word Embeddings HENRIK SJÖKVIST KTH ROYAL INSTITUTE OF TECHNOLOGY SCHOOL OF ENGINEERING SCIENCES Text Feature Mining Using Pre- trained Word Embeddings HENRIK SJÖKVIST Degree Projects in Financial Mathematics (30 ECTS credits) Degree Programme in Industrial Engineering and Management KTH Royal Institute of Technology year 2018 Supervisor at Handelsbanken: Richard Henricsson Supervisor at KTH: Henrik Hult Examiner at KTH: Henrik Hult TRITA-SCI-GRU 2018:167 MAT-E 2018:28 Royal Institute of Technology School of Engineering Sciences KTH SCI SE-100 44 Stockholm, Sweden URL: www.kth.se/sci Abstract This thesis explores a machine learning task where the data contains not only numer- ical features but also free-text features. In order to employ a supervised classifier and make predictions, the free-text features must be converted into numerical features. In this thesis, an algorithm is developed to perform that conversion. The algorithm uses a pre-trained word embedding model which maps each word to a vector. The vectors for multiple word embeddings belonging to the same sentence are then combined to form a single sentence embedding. The sentence embeddings for the whole dataset are clustered to identify distinct groups of free-text strings. The cluster labels are output as the numerical features. The algorithm is applied on a specific case concerning operational risk control in banking. The data consists of modifications made to trades in financial instruments. Each such modification comes with a short text string which documents the modi- fication, a trader comment.
    [Show full text]