• No results found

GPText: Greenplum Parallel Statistical Text Analysis Framework

N/A
N/A
Protected

Academic year: 2021

Share "GPText: Greenplum Parallel Statistical Text Analysis Framework"

Copied!
5
0
0

Loading.... (view fulltext now)

Full text

(1)

GPText: Greenplum Parallel Statistical Text Analysis

Framework

Kun Li

University of Florida

E403 CSE Building Gainesville, FL 32611 USA

[email protected]

Christan Grant

University of Florida

E457 CSE Building Gainesville, FL 32611 USA

[email protected]

Daisy Zhe Wang

University of Florida E456 CSE Building Gainesville, FL 32611 USA

[email protected]

Sunny Khatri

Greenplum 1900 S Norfolk St #125 San Mateo, CA 94403 USA

[email protected]

George Chitouras

Greenplum 1900 S Norfolk St #125 San Mateo, CA 94403 USA

[email protected]

ABSTRACT

Many companies keep large amounts of text data inside of rela-tional databases. Several challenges exist in using state-of-the-art systems to perform analysis on such datasets. First, expensive big data transfer cost must be paid up front to move data between databases and analytics systems. Second, many popular text an-alytics packages do not scale up to production sized datasets. In this paper, we introduce GPText, Greenplum parallel statistical text analysis framework that addresses the above problems by support-ing statistical inference and learnsupport-ing algorithms natively in a mas-sively parallel processing database system. GPText seamlessly in-tegrates the Solr search engine and applies statistical algorithms such as k-means and LDA using MADLib, an open source library for scalable in-database analytics which can be installed on Post-greSQL and Greenplum. In addition, GPText also developed and contributed a linear-chain conditional random field(CRF) module to MADLib to enable information extraction tasks such as part-of-speech tagging and named entity recognition. We show the perfor-mance and scalability of the parallel CRF implementation. Finally, we describe an eDiscovery application built on the GPText frame-work.

Categories and Subject Descriptors

H.2.4 [Database Management]: [Systems, parallel databases]; I.2.7 [Artificial Intelligence]: [Natural Language Processing, text anal-ysis]

General Terms

Design, Performance, Management

Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee.

DanaC’13,June 23, 2013, New York, NY, USA Copyright 2013 ACM 978-1-4503-2202-7/13/6 ...$15.00.

Keywords

RDBMS, Massive parallel processing, Text analytics

1.

INTRODUCTION

Text analytics has gained much attention in the big data research community due to the large amounts of text data generated in orga-nizations such as companies, government and hospitals everyday in the form of emails, electronic notes and internal documents. Many companies store this text data in relational databases because they relay on databases for their daily business needs. A good under-standing of this unstructured text data is crucial for companies to make business decision, for doctors to assess their patients, and for lawyers to accelerate document review processes.

Traditional business intelligence pulls content from databases into other massive data warehouses to analyze the data. The typ-ical “data movement process” involves moving information from the database for analysis using external tools and storing the final product back into the database. This movement process is time consuming and prohibitive for interactive analytics. Minimizing the movement of data is a huge incentive for businesses and re-searchers. One way to achieve this is for the datastore to be in the same location as the analytic engine.

While Hadoop has become a popular platform to perform large-scale data analytics, newer parallel processing relational databases can also leverage more nodes and cores to handle large-scale datasets. Greenplum database, built upon the open source database Post-greSQL, is a parallel database that adopt a shared nothing mas-sive parallel processing (MPP) architecture. Database researchers and vendors are capitalizing on the increase in database cores and nodes and investing in open source data analytics ventures such as the MADLib project [3, 7]. MADLib is an open source library for scalable in-database analytics on Greenplum and PostgreSQL. It provides parallel implementation of many machine learning algo-rithms.

In this paper, we motivate in-database text analytics by show-ing the GPText, a powerful and scalable text analysis framework developed on Greenplum MPP database. The GPText inherits scal-able indexing, keyword search, and faceted search functionalities from an effective integration of the Solr [6] search engine. The GP-Text uses the CRF package, which was contributed to the MADLib open-source library. We show that we can use SQL and user defined aggregates to implement conditional random fields (CRFs)

(2)

meth-ods for information extraction in parallel. The experiment shows sublinear improvement in runtime for both CRF learning and in-ference with linear increase in the number of cores. As far as we know, GPText is the first toolkit for statistical text analysis in rela-tional database management systems. Finally, we describe the need and requirement for eDiscovery applications and show that GPText is an effective platform to develop such sophisticated text analysis applications.

2.

RELATED WORK

Researchers have created systems for large scale text analytics including GATE, PurpleSox and SystemT [4, 2, 8]. While both GATE and SystemT uses rule-based approach for information ex-traction (IE), PurpleSox uses statistical IE models. However, none of the above system are native built for a MPP framework.

The parallel CRF in-database implementation follows the MAD methodology [7]. In a similar vein, researchers show that most of the machine learning algorithms can be expressed through a unified RDBMS architectures [5].

There are several implementations conditional random fields and but only a few large scale implementations for NLP tasks. One example is the PCRFs [11] that are implemented over massively parallel processing systems supporting Message Passing Interface (MPI) such as Cray XT3, SGI Altix, and IBM SP. However, this is not implemented over RDBMs.

3.

GREENPLUM TEXT ANALYTICS

GPText runs on Greenplum database(GP), which is a shared noth-ing massive parallel processnoth-ing(MPP) database . The Greenplum database adopts the most widely used master-slave parallel com-puting model where one master node orchestrates multiple slaves to work until the task is completed and there is no direct communica-tion between slaves. As shown in Figure 1, it is a colleccommunica-tion of Post-greSQL instances including one master instance and multiple slave instances(segments). The master node accepts SQL queries from clients, then divide the workloads and send sub-tasks to the seg-ments. Besides harnessing the power of a collection of computer nodes, each node can also be configured with multiple segments to fully utilize the muticore processor. To provide high availability, GP provides the options to deploy redundant standby master and mirroring segments in case of master segments and primary seg-ments failure.

The embarrassing processing capability powered by the Green-plum MPP framework lays the cornerstone to enable GPText to process the production sized text data. Besides the underling MPP framework, GPText also inherited the features that a traditional database system brings to GPText for example, online expansion, data recovery and performance monitoring to name a few. On top of the underling MPP framework, there are two building blocks, MADLib and Solr as illustrated in Figure 1 which distinguish GP-Text from many of the existing text analysis tools. MADLib makes GPText capable of doing sophisticated text data analysis tasks, such as part-of-speech tagging, named entity recognition, document clas-sification and topic modeling with a vast amount of parallelism. Solr is reliable and scalable text search platform from Apache Lucene project and it has been widely deployed in web servers. The major features includes powerful full-text search, faceted search, near real time indexing. As shown in Figure 1, GPText uses Solr to create distributed indexing . Each primary segment is associated with one and only Solr instance where the index of the data in the primary segment is stored for the purpose of load balancing. GPText has all the features that Solr has since Solr is integrated into GPText

Figure 1: The GPText architecture over Greenplum database.

seamlessly. The authors submitted the CRF statistical package for text analysis to MADLib (more details on section 4).

3.1

In-database document representation

In GPText, a document can represented as a vector of counts against a token dictionary, which is a vector of unique tokens in the dataset. For efficient storage and memory, GPText uses a sparse vector representation for each document instead of a naive vector representation. The following are an example with two different vector representations of a document. The dictionary contains all the unique terms (i.e., 1-grams) exist in the corpus.

Dictionary:

{am, before, being, bothered, corpus, document, in, is, me, never, now, one, really, second, the, third, this, until}.

Document:

{i, am, second, document, in, the, corpus}.

Naive vector representation:

{1,0,0,0,1,1,1,1,0,0,0,0,0,0,1,1}.

Sparse vector representation:

{(1,3,1,1,1,1,6,1,1):(1,0,1,1,1,1,0,1,1)}.

GPText adopts therun-length encodingto compress the naive vector representation using pairs of count-value vectors. The first array in the vector representation contains count values for the cor-responding values in the second array. Although not apparent in this example, the advantage of the sparse vector representation is dramatic in real world documents, where most of the elements in the vector are 0.

3.2

ML-based Advanced Text Analysis

GPText relies on multiple machine learning modules in MADLib to perform statistical text analysis. Three of the commonly used modules are k-means for document clustering, multinomial naive bayes (multinomialNB) for document classification, and latent dirich-let allocation(LDA) for topic modeling for dimensionality

(3)

reduc-Figure 2: The MADLib CRF overall system architecture.

tion and feature extraction. Performing k-means, multinomialNB, LDA in GPText follows the same pipeline as follows:

1. Create Solr index for documents. 2. Configure and populate Solr index. 3. Create terms table for each document.

4. Create dictionary of the unique terms across documents. 5. Construct term vector using the tf-idf for each document. 6. Run MADLib k-means/MultinomiaNB/LDA algorithm. The following section details the implementation of the CRF learning and inference modules that we developed for GPText ap-plications as part of MADLib.

4.

CRF FOR IE OVER MPP DATABASES

Conditional random field(CRF) is a type of discriminative undi-rected probabilistic graphical model. Linear-chain CRFs are spe-cial CRFs, which assume that the next state depends only on the current state. Linear-chain CRFs achieve start-of-the-art accuracy in many real world natural language processing (NLP) tasks such as part of speech tagging(POS) and named entity recognition(NER).

4.1

Implementation Overview

In Figure 2 illustrate the detailed implementation of the CRF module developed for IE tasks in GPText. The top box shows the pipeline of the training phase. The bottom box shows the pipeline for the inference phase. We use declarative SQL statements to ex-tract all features from text. Any features in the state of art packages can be extracted using one single SQL clause. All of the com-mon features described in literature can be extracted with one SQL statement. The extracted features are stored in a relation for ei-ther single or two-state features. For inference, we use user-defined functions to calculate the maximum-a-priori (MAP) configuration and probability for each document. Inference over all documents can be naively parallel since the inference over one document is in-dependent with other documents. For learning, the computation of gradient and log-likelihood over all training documents dominates the overall training time. Fortunately, it can run parallel since the overall gradient and log-likelihood is simply the summation of the gradient and log-likelihood for each document. This parallelization can be expressed with the parallel programming paradigm, user-defined aggregates which is supported in parallel databases.

4.2

Feature Extraction Using SQLs

SELECTdoc2.pos, doc2.doc_id, ’E.’, ARRAY[doc1.label, doc2.label]

FROM segmenttbl doc1, segmenttbl doc2

WHERE doc1.doc_id = doc2.doc_idAND

doc1.pos + 1 = doc2.pos

Figure 3: Query for extracting edge features

SELECTstart_pos, doc_id, ’R_’ || r.name, ARRAY[-1, label]

FROM regextbl r, segmenttbl s

WHEREs.seg_text∼r.pattern

Figure 4: Query for extracting regex features

Text feature extraction is a step in most statistical text analysis methods. We are able to implement all of the seven types of fea-tures used in POS and NER using exactly seven SQL statements. These features include:

Dictionary: does this token exist in a dictionary?

Regex: does this token match a regular expression?

Edge: is the label of a token correlated with the label of a previous token?

Word: does this token appear in the training data?

Unknown: does this token appeared in the training data below cer-tain threshold?

Start/End: is this token first/last in the token sequence?

There are many advantages for extracting features using SQLs. The SQL statements hide a lot of the complexity present in the ac-tual operation. It turns out that each type of feature can be extracted out using exactly one SQL statement, making the feature extraction code extremely succinct. Secondly, SQLs statements are naively parallel due to the set semantics supported by relational DBMS’s. For example, we compute features for each distinct token and avoid re-computing the features for repeated tokens.

In Figure 3 and Figure 4 we show how to extract edge and regex features, respectively. Figure 3 extracts adjacent labels from sen-tences and stores them in an array. Figure 4 shows a query that selects all the sentences that satisfies any of the regular expressions present in the table ‘regextable’.

4.3

Parallel Linear-chain CRF Training

Algorithm 1CRF training(z1:M)

Input: z1:M,.Document set

Convergence(), Initialization(), Transition(), Finalization() Output: Coefficientsw∈RN Initialization/Precondition: iteration = 0 1: Initialization(state) 2: repeat 3: state←LoadState() 4: for allm∈1..Mdo

5: state←Transition(state, zm)

6: state←F inalization(state)

7: WriteState(state)

8: untilConvergence(state, iteration)

(4)

Programming Model.

In Algorithm 1 we show the parallel CRF training strategy. The algorithm is expressed as an user-defined aggregate. User-defined aggregates are composed of three parts: a transition function (Al-gorithms 2), a merge function1, and a finalization function

(Algo-rithm 3). Following we describe these functions.

In line 1 of Algorithm 1 theInitialization function creates a ‘state’ object in the database. This object contains a coefficient (w), gradient (∇) and log-likelihood (L) variables. This state is loaded (line 3) and saved (line 7) between iterations. We compute the gra-dient and log-likelihood of each segment in parallel (line 4) much like a Map function. Then line 6 computes the new coefficients much like a reduce function.

Transition strategies.

Algorithm 2 contains the logic of computing the gradient and log-likelihood for each tuple using the forward-backward algorithm. The overall gradient and log-likelihood is simply the summation of gradient and log-likelihood of each tuple. This algorithm is invoked in parallel over many segments and the result of these functions are combined using the merge function.

Algorithm 2transition-lbfgs(state, zm) Input: state,.Transition state

zm, .A Document

Gradient() Output: state

1: {state.∇, state.L} ←Gradient(state, zm)

2: state.num_rows←state.num_rows+ 1

3: returnstate

Finalization strategy.

The finalization function invokes the L-BFGS convex solver to get a new coefficient vector. To avoid overfitting, we choose to

Algorithm 3finalization-lbfgs(state)

Input: state,

LBFGS().Convex optimization solver

Output: state

1: {state.∇, state.L} ←penalty(state.∇, state.L) 2: instance←LBFGS.init(state)

3: instance.lbfgs() .invoke the L-BFGS solver 4: returninstance.state

penalize the log-likelihood with a spherical Gaussian weight prior. Limited-memory BFGS (L-BFGS), a variation of the Broyden-Fletcher-Goldfarb-Shanno (BFGS) algorithm is a leading method for large scale non-constraint convex optimization method. We translate an in-memory Java implementation [10] to a C++ in-database implementation. Before each iteration of L-BFGS optimization, we need to initialize the L-BFGS with the current state object. At the end of each iteration, we need to dump the updated variables to the database state for next iteration.

4.4

Parallel Linear-chain CRF Inference

The Viterbi algorithm is applied to find the top-k most likely labellings of a document for CRF models. The CRF inference is

1The merge function takes two states and sums their gradient and

log-likelihood.

Figure 5: Linear-chain CRF training scalability

Figure 6: Linear-chain CRF inference scalability

naively parallel since the inference over one document is indepen-dent of other documents. We chose to implement a SQL clause to drive the Viterbi inference over all documents and each function call will finish labeling of one document. In parallel databases, e.g., Greenplum, Viterbi can be run in parallel over different subsets of the documents on a single-node or muti-node cluster and each node can have multiple cores.

5.

EXPERIMENTS AND RESULTS

In order to evaluate the performance and scalability of the linear-chain CRF learning and inference on Greenplum, we conduct ex-periments on various data sizes over on a 32-core machine with 2T hard drive and 64GB memory. We use CoNLL2000 dataset con-taining 8936 tagged sentences for learning. This dataset is labeled with 45 POS tags. To evaluate the inference performance, we ex-tracted 1.2 million sentences from the New York Times dataset. In Figure 5 and Figure 6 we show the algorithm is sublinear and improves with an increase in the number of segments. Our POS implementation achieves.9715accuracy, this is consistent with the state of the art [9].

6.

GPTEXT APPLICATION

With the support of Greenplum MPP data processing framework, efficient Solr indexing/search engine, and parallelized statistical text analysis modules, GPText positions itself to be a great plat-form for many applications that need to apply scalable text analyt-ics methods with varying sophistications over unstructured data in databases. One of such application is eDiscovery.

eDiscovery has become increasingly important in legal processes. Large enterprises keep terabytes of text data such as emails and internal documents in their databases. Traditional civil litigation often involves reviews of large amounts of documents both in the plaintiffs side and defendants side. eDiscovery provides tools to

(5)

Figure 7: GPText application

pre-filter documents for review to provide a more speedy, inexpen-sive and accurate solution. Traditionally, simple keyword search are used for such document retrieval tasks in eDiscovery. Recently, predictive coding based on more sophisticated statistical text anal-ysis methods are gaining more and more attention in civil litigation since it provides higher precision and recall in retrieval. In 2012, judges in several cases [1] approves the use of the predictive coding based on the indication of Rules of the Federal Rules of Civil Pro-cedure. GPText developed a prototype of eDiscovery tool using the Enron dataset. Figure 7 is a snapshot of the eDiscovery application. In the top pane, keyword ’illegal’ is specified and Solr is used to re-trieve all relevant emails that contains the keyword displayed in the bottom pane. As shown on the middle pane on the right, it also supports topic discovery in the email corpus using LDA and classi-fication using k-means. K-means use LDA and CRF to reduce the dimensionalities of features to speed up the k-means classification. CRF is also used to extracted named entities. As you can see the topics are displayed in the Results panel. The tool also provides visualization of aggregate information and faceted search over the email corpus.

7.

CONCLUSION

We introduce GPText, a parallel statistical text analysis frame-work over MPP database. With the seamless integration with Solr and MADLib, GPText is a framework with powerful search en-gine and advanced statistical text analysis capabilities. We imple-mented a parallel CRF inference and training module for IE. The functionalities and scalability provided by GPText positions itself to be a great tools for sophisticated text analytics applications such as eDiscovery. As future work, we plan to supportlearning to rank

andactive learningalgorithms in GPText.

Acknowledgments

Christan Grant is funded by NSF under Grant No. DGE-0802270. This work was supported by a gift from EMC Greenplum.

8.

REFERENCES

[1] L. Aguiar and J. A. Friedman.

Pre-dictive coding: What it is and what you need to know about it. http://newsandinsight.thomsonreuters.com/Legal/Insight/2013.

[2] P. Bohannon, S. Merugu, C. Yu, V. Agarwal, P. DeRose, A. Iyer, A. Jain, V. Kakade, M. Muralidharan,

R. Ramakrishnan, and W. Shen. Purple sox extraction management system.SIGMOD Rec., 37(4):21–27, Mar. 2009.

[3] J. Cohen, B. Dolan, M. Dunlap, J. M. Hellerstein, and C. Welton. Mad skills: new analysis practices for big data.

Proc. VLDB Endow., 2(2):1481–1492, Aug. 2009. [4] H. Cunningham, D. Maynard, K. Bontcheva, V. Tablan,

N. Aswani, I. Roberts, G. Gorrell, A. Funk, A. Roberts, D. Damljanovic, T. Heitz, M. A. Greenwood, H. Saggion, J. Petrak, Y. Li, and W. Peters.Text Processing with GATE (Version 6). 2011.

[5] X. Feng, A. Kumar, B. Recht, and C. Ré. Towards a unified architecture for in-rdbms analytics. InProceedings of the 2012 ACM SIGMOD International Conference on Management of Data, SIGMOD ’12, pages 325–336, New York, NY, USA, 2012. ACM.

[6] T. A. S. Foundation. Apache solr. http://lucene.apache.org/solr.

[7] J. M. Hellerstein, C. Ré, F. Schoppmann, D. Z. Wang, E. Fratkin, A. Gorajek, K. S. Ng, C. Welton, X. Feng, K. Li, and A. Kumar. The madlib analytics library: or mad skills, the sql.Proc. VLDB Endow., 5(12):1700–1711, Aug. 2012. [8] Y. Li, F. R. Reiss, and L. Chiticariu. Systemt: a declarative

information extraction system. InProceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies: Systems Demonstrations, HLT ’11, pages 109–114, Stroudsburg, PA, USA, 2011. Association for Computational Linguistics. [9] C. D. Manning. Part-of-speech tagging from 97% to 100%:

is it time for some linguistics? InProceedings of the 12th international conference on Computational linguistics and intelligent text processing - Volume Part I, CICLing’11, pages 171–189, Berlin, Heidelberg, 2011. Springer-Verlag. [10] J. Morales and J. Nocedal. Automatic preconditioning by

limited memory quasi-newton updating.SIAM Journal on Optimization, 10(4):1079–1096, 2000.

[11] H. Phan and M. Le Nguyen. Flexcrfs: Flexible conditional random fields, 2004.

Figure

Figure 1: The GPText architecture over Greenplum database.
Figure 3: Query for extracting edge features
Figure 5: Linear-chain CRF training scalability
Figure 7: GPText application

References

Related documents

In this work we present an autonomous fuzzy control of pan and tilt video platform on board a UAV and a UAV-heading controller using a Lucas-Kanade tracker for static and

RESULTS AND DISCUSSIONS Effect of different temperature storage on Indian mackerel 4.1 Proximate composition 4.2 Biochemical changes 4.2.1 pH 4.2.2 Total volatile basic nitrogen

sales force through a process that includes compensation plans and the role. compensation plans play

Using data from the 2017 Reuters Institute Digital News Report survey (Newman et al., 2017), which allow us to use detailed survey items on news consumption in a set of diverse

A Novel Approach for User Authentication for IoT Devices Using Human Pulse and IoT Cloud for OTP Generation.. Deepak G*, Harish Kumar N

There are several theories which explain different aspects of internationalization, such as enablers, drivers, process, location decisions of internationalization and

We will use six validated questionnaires to measure unmet need, quality of life, and general health and well-being of participants: the Cancer Survivors Unmet Needs instrument [ 55

2.1 Larger to smaller: a materials perspective 2.2 Simple to complex: a molecular perspective 2.3 Molecular nanotechnology: a long-term view 3 Current research 3.1 Nanomaterials