Search for Approximate Matches in Large Databases *

Similar documents
Search for Approximate Matches in Large Databases*

Data Structures and Algorithms

B-Trees and External Memory

CS 350 : Data Structures B-Trees

B-Trees and External Memory

CS350: Data Structures B-Trees

CSE 530A. B+ Trees. Washington University Fall 2013

CS F-11 B-Trees 1

Organizing Spatial Data

An AVL tree with N nodes is an excellent data. The Big-Oh analysis shows that most operations finish within O(log N) time

B-Trees. Introduction. Definitions

CS 310 B-trees, Page 1. Motives. Large-scale databases are stored in disks/hard drives.

CSIT5300: Advanced Database Systems

(2,4) Trees. 2/22/2006 (2,4) Trees 1

Trees. Courtesy to Goodrich, Tamassia and Olga Veksler

M-ary Search Tree. B-Trees. Solution: B-Trees. B-Tree: Example. B-Tree Properties. B-Trees (4.7 in Weiss)

EE 368. Weeks 5 (Notes)

Note that this is a rep invariant! The type system doesn t enforce this but you need it to be true. Should use repok to check in debug version.

MySQL B+ tree. A typical B+tree. Why use B+tree?

C SCI 335 Software Analysis & Design III Lecture Notes Prof. Stewart Weiss Chapter 4: B Trees

Background: disk access vs. main memory access (1/2)

Design and Analysis of Algorithms Lecture- 9: B- Trees

Trees. Eric McCreath

Searching: Where it all begins...

Binary Trees

A Secondary storage Algorithms and Data Structures Supplementary Questions and Exercises

Find the block in which the tuple should be! If there is free space, insert it! Otherwise, must create overflow pages!

An undirected graph is a tree if and only of there is a unique simple path between any 2 of its vertices.

Binary Search Trees. Analysis of Algorithms

Balanced Search Trees

Lecture 11: Multiway and (2,4) Trees. Courtesy to Goodrich, Tamassia and Olga Veksler

2-3 Tree. Outline B-TREE. catch(...){ printf( "Assignment::SolveProblem() AAAA!"); } ADD SLIDES ON DISJOINT SETS

M-ary Search Tree. B-Trees. B-Trees. Solution: B-Trees. B-Tree: Example. B-Tree Properties. Maximum branching factor of M Complete tree has height =

Search trees, binary trie, patricia trie Marko Berezovský Radek Mařík PAL 2012

CSCI-401 Examlet #5. Name: Class: Date: True/False Indicate whether the sentence or statement is true or false.

B-Trees. Version of October 2, B-Trees Version of October 2, / 22

Unit 8: Analysis of Algorithms 1: Searching

Module 4: Index Structures Lecture 13: Index structure. The Lecture Contains: Index structure. Binary search tree (BST) B-tree. B+-tree.

Chapter 12: Indexing and Hashing. Basic Concepts

CMSC 754 Computational Geometry 1

Chapter 12: Indexing and Hashing

Tree-Structured Indexes

Indexing: B + -Tree. CS 377: Database Systems

Trees : Part 1. Section 4.1. Theory and Terminology. A Tree? A Tree? Theory and Terminology. Theory and Terminology

Advances in Data Management Principles of Database Systems - 2 A.Poulovassilis

(2,4) Trees Goodrich, Tamassia (2,4) Trees 1

Multiway Search Trees. Multiway-Search Trees (cont d)

Computational Optimization ISE 407. Lecture 16. Dr. Ted Ralphs

Recall: Properties of B-Trees

Laboratory Module X B TREES

Quiz 1 Solutions. (a) f(n) = n g(n) = log n Circle all that apply: f = O(g) f = Θ(g) f = Ω(g)

X-tree. Daniel Keim a, Benjamin Bustos b, Stefan Berchtold c, and Hans-Peter Kriegel d. SYNONYMS Extended node tree

Chapter 12: Indexing and Hashing (Cnt(

(2,4) Trees Goodrich, Tamassia. (2,4) Trees 1

Introduction to Indexing 2. Acknowledgements: Eamonn Keogh and Chotirat Ann Ratanamahatana

CSCE 411 Design and Analysis of Algorithms

CS 231 Data Structures and Algorithms Fall Recursion and Binary Trees Lecture 21 October 24, Prof. Zadia Codabux

Scalable Data Exploration and Novelty Detection

Physical Level of Databases: B+-Trees

10/23/12. Outline. Part 6. Trees (3) Example: A B-tree of degree 5. B-tree of degree m. Inserting 55. Inserting 55. B-Trees External Methods

CS127: B-Trees. B-Trees

CS2223: Algorithms Sorting Algorithms, Heap Sort, Linear-time sort, Median and Order Statistics

Multidimensional Indexes [14]

Optimum Alphabetic Binary Trees T. C. Hu and J. D. Morgenthaler Department of Computer Science and Engineering, School of Engineering, University of C

Chapter 11: Indexing and Hashing

Bioinformatics Programming. EE, NCKU Tien-Hao Chang (Darby Chang)

arxiv: v3 [cs.ds] 18 Apr 2011

Introduction to Indexing R-trees. Hong Kong University of Science and Technology

We will show that the height of a RB tree on n vertices is approximately 2*log n. In class I presented a simple structural proof of this claim:

CSE2331/5331. Topic 6: Binary Search Tree. Data structure Operations CSE 2331/5331

2-3 and Trees. COL 106 Shweta Agrawal, Amit Kumar, Dr. Ilyas Cicekli

Motivation for B-Trees

THE B+ TREE INDEX. CS 564- Spring ACKs: Jignesh Patel, AnHai Doan

CIS265/ Trees Red-Black Trees. Some of the following material is from:

Garbage Collection: recycling unused memory

HEAPS ON HEAPS* Downloaded 02/04/13 to Redistribution subject to SIAM license or copyright; see

6. Finding Efficient Compressions; Huffman and Hu-Tucker

COMP : Trees. COMP20012 Trees 219

Uses for Trees About Trees Binary Trees. Trees. Seth Long. January 31, 2010

Geometric Data Structures

Linked Structures Songs, Games, Movies Part III. Fall 2013 Carola Wenk

Information Retrieval. Wesley Mathew

Huffman Coding. Version of October 13, Version of October 13, 2014 Huffman Coding 1 / 27

Analysis of Algorithms

Topic: Heaps and priority queues

Trees. A tree is a directed graph with the property

Lecture 13. Lecture 13: B+ Tree

Intro to DB CHAPTER 12 INDEXING & HASHING

Dictionaries. Priority Queues

Data Structures and Algorithms


The Adaptive Radix Tree

Efficient Multiway Radix Search Trees

TREES cs2420 Introduction to Algorithms and Data Structures Spring 2015

CSE 214 Computer Science II Introduction to Tree

Tree-Structured Indexes

Chapter 12: Indexing and Hashing

Balanced Search Trees. CS 3110 Fall 2010

R16 SET - 1 '' ''' '' ''' Code No: R

CS251-SE1. Midterm 2. Tuesday 11/1 8:00pm 9:00pm. There are 16 multiple-choice questions and 6 essay questions.

Transcription:

Search for Approximate Matches in Large Databases * Eugene Fink Language Technologies Carnegie Mellon University Pittsburgh, PA 15213 e.fink@cs.cmu.edu Philip Hayes DYNAMiX Technologies 12330 Perry Highway Wexford, PA 15090 phayes@dynamixtechnologies.com Aaron Goldstein DYNAMiX Technologies 12330 Perry Highway Wexford, PA 15090 agoldstein@dynamixtechnologies.com Jaime G. Carbonell Language Technologies Carnegie Mellon University Pittsburgh, PA 15213 jgc@cs.cmu.edu Abstract We present a system for indexing large sets of records, and retrieving exact and approximate matches for a given query. We define records, queries, and matches between them, describe an indexing structure for fast identification of exact and approximate matches, and give results of testing the system on a database of hospital patients. Keywords: Massive data, indexing and, approximate matches. 1 Introduction We have developed a data structure and search algorithms for identifying exact and approximate matches in a large set of records, and tested them on a database of patients admitted to the Massachusetts hospitals in the 2001 and 2002 fiscal years. We explain the related representation of records and queries (Section 2), describe the developed technique for of records that match a given query (Sections 3 and 4), and show how its performance depends on the, query type, and size of the available memory (Section 5). 2 Records and queries We first define records and queries, and illustrate them with an example of patient data. We specify a table of records by a list of attributes; as a simplified example, we can describe patients by their sex, age, and diagnosis. A record includes a specific value for each attribute; for example, it may indicate that a patient is female, her age is 30, and her diagnosis is. On the other hand, a query may include multiple values for each attribute; that is, it may include some set I 1 of values for the first attribute, some set I 2 for the second attribute, and so on. For example, if we need to retrieve all patients between 20 and 40 years old, who have either or, we can use the query ({male, female}, [20..40], {, }). We may specify a query attribute by a single value, a numeric range, or a set of several values or ranges. An n-attribute record (i 1, i 2,..., i n ) is an exact match for a query (I 1, I 2,..., I n ) if i 1 I 1, i 2 I 2, and so on; that is, every value in the record belongs to the respective set in the query. If a query specifies one value for each attribute, it is called a point query; if it includes ranges or sets, it is a region query. The notion of approximate matches is based on distances between records. We specify a distance function for each attribute, along with an n-argument function that combines attribute distances into an overall distance. An attribute distance is a two-argument function, with nonnegative values, which must give zero for identical arguments. The n-argument combination function must give zero when all arguments are zeros, and it must be monotonically increasing on each argument. The distance from a record to a region query is defined as the smallest distance between the record and the region specified by the query. In particular, if the record exactly matches the query, the distance is zero. When looking for approximate matches, we specify not only query attributes, but also a distance function, number of matches, and distance limit; note that we may use different distance functions with different queries. If the database includes more than the given number of matches within the specified distance limit, the system retrieves the given number of the closest matches; else, it returns all matches within the distance limit. * 0-7803-8566-7/04/$20.00 2004 IEEE.

3 Indexing structure The system arranges all records into a tree, with height equal to the number of attributes, as shown in Figure 1. The root node encodes the first attribute, and its children represent different values of this attribute. The nodes at the second level divide the orders by the second attribute, and each node at the third level corresponds to specific values of the first two attributes. In general, a node at level i divides records by the values of the ith attribute, and each node at level (i + 1) corresponds to all records with specific values of the first i attributes. Every node includes a red-black tree, which indexes its children by the corresponding attribute; for example, each age node in Figure 1 includes a red-black tree that arranges its children by age values. This tree supports fast addition and deletion of children, as well as fast of all children in a given range. The nodes also include summary data that help to identify approximate matches; specifically, every node stores the minimal and maximal value of each numeric attribute in the corresponding subtree. When the system adds a new record, it creates the appropriate new branch in the indexing tree, and updates the summary data of the ancestors of this branch. When removing a record, it deletes the corresponding leaf node, and updates the summary values of the ancestor nodes. If the deleted leaf is the only leaf in some subtree, the system removes this subtree; for example, the deletion of the leftmost leaf in Figure 1 leads to the removal of its parent. If the tree size is smaller than the size of the available memory, the system keeps the entire tree in memory; otherwise, it divides the tree into fixed-size blocks and stores them on disk. We usually use 1-Kbyte blocks, which means that the total size of nodes in a block must be at most 1 Kbyte. In Figure 1, we show blocks by dashed boxes; a block may include a single node, several adjacent nodes, or part of a large node that does not fit into a block. If a block includes multiple nodes, they form a tree, which is part of the indexing tree. The overall block structure is also a tree, where the edges between blocks correspond to the cross-block edges of the indexing tree. This structure supports addition and deletion of records, which involves dynamic splitting of overfull blocks and dynamic merging of adjacent underfull blocks. 4 Search for matches We use two algorithms that retrieve matches for a given query; the first is depth-first search, which identifies exact matches, and the second is best-first search, which finds approximate matches. The depth-first algorithm begins by identifying all children of the root that match the first attribute of the query, and then recursively processes the respective subtrees. For example, suppose that we are looking for 30-year old patients of both sexes with or ulcer, and the indexing tree is as shown in Figure 1. The algorithm determines that both children of the root match the first attribute of the query, and then processes the respective subtrees. It identifies two matching nodes for the second attribute, and three matching leaves for the third attribute; we show these nodes by thick boxes. The best-first algorithm uses a node s summary data to estimate the distance to the closest possible match in the node s subtree. It arranges nodes into a priority queue by their distance estimates; at each step, it processes the smallest-estimate node. If this node is a leaf, it returns the respective record; else, it adds the node s children that match the next attribute of the query to the priority queue. 5 Experiments We have experimented with a medical database, obtained from the Massachusetts Health Data Consortium, which contains a list of all patients admitted to the Massachusetts hospitals in the 2001 and 2002 fiscal years, that is, from October 2000 to September 2002. These data are anonymous, which means that the database does not contain enough personal information to identify individual patients. The database includes 1.6 million patient records, described by seventy attributes; we have used twenty-one of these attributes to build an indexing tree. The size of the tree that includes all 1.6 million records is 890 MBytes. We have used a 2.4-GHz Xeon computer with 400-MHz bus, and we have run the system with five different sizes of the main memory: 64 MBytes, 128 MBytes, 256 MBytes, 512 MBytes, and 1,024 MBytes. In Figure 2, we show the dependency of the on the, using logarithmic scale. We have measured the speed of retrieving exact matches for point queries (dotted lines), exact matches for region queries (dashed lines), and approximate matches (solid lines). If the memory size is 1,024 Mbytes, the system stores all 1.6 million records in memory; if the memory is smaller, the system stores part of the indexing tree on disk. The graphs show that, when the tree grows beyond the memory size, the increases sharply. In Figure 3, we give a different view of the same results; specifically, we plot the dependency of the on the memory size for three fixed sizes of the indexing tree. The results show that the disk indexing is 10 to 50 s slower than the memory indexing. When the system keeps the tree in memory, the of matches for exact point queries is 2 to 5 s faster than that for region and approximate queries. When the system uses the disk indexing, exact point queries are 50 to 200 s faster than region and approximate queries. The for exact point queries is proportional to the logarithm of the ; that is, its complexity is O(lg N), where N is the number of records. On the other hand, the of region and ap-

proximate queries is proportional to a low power of the ; specifically, it is approximately O(N 0.2 ) for the memory indexing, and O(N 0.5 ) for the disk indexing. We have also measured the disk utilization, that is, the ratio of the actual tree size to the total size of disk blocks; it varies from 54% to 58%, with mean at 55%. 6 Conclusions The reported work is a step toward the development of tools for fast identification of patterns in large databases. It is part of a joint project involving Carnegie Mellon University and DYNAMiX Technologies, aimed at finding both known and surprising patterns in massive data streams [3]. The described system supports fast access to available data, and serves as a tool for the development of data-mining algorithms. The experiments have confirmed that the system scales to large databases, which do not fit into the main memory; however, the observed complexity of for such databases is O(N 0.5 ), which means that the grows fairly quickly with the database size, hence restricting the system s scalability. To improve the speed, we are working on the integration of the current indexing tree with k-d trees [1, 5] and PATRICIA trees [4], and on techniques for determining the most effective ordering of attributes in the tree. We also plan to enhance scalability by improving the disk utilization and developing a distributed version of the system. The long-term goal is to scale the system to databases with tens or hundreds of billions of records. Acknowledgements We are grateful to Johny Mathew for his extensive help with experiments. We thank Dwight Dietrich and Ganesh Mani for their valuable comments and suggestions. This work has been partially supported by the Advanced Research and Development Activity (ARDA), Novel Intelligence from Massive Data Program. References [1] Jon Louis Bentley. Multidimensional binary search trees used for associative searching. Communications of the ACM, 18(9), pages 509 517, 1975. [2] Dan Gusfield. Algorithms on Strings, Trees, and Sequences: Computer Science and Computational Biology. Cambridge University Press, Cambridge, United Kingdom, 1997. [3] Chun Jin and Jaime G. Carbonell. ARGUS: Rete + DBMS = efficient continuous profile matching on largevolume data streams. Language Technologies Institute, Carnegie Mellon University, 2004. Technical Report CMU-CS-04-181. [4] Donald R. Morrison. PATRICIA practical algorithm to retrieve information coded in alphanumeric. Journal of the ACM, 15(4), pages 514 534, 1968. [5] Jack A. Orenstein. Multidimensional tries used for associative searching. Information Processing Letters, 14(4), pages 150 157, 1982. [6] Stuart J. Russell and Peter Norvig. Artificial Intelligence: A Modern Approach. Prentice Hall, Upper Saddle River, NJ, second edition, 2003. [7] Hanan Samet. Applications of Spatial Data Structures: Computer Graphics, Image Processing, and GIS. Addison-Wesley, Reading, MA, 1990. [8] Hanan Samet. The Design and Analysis of Spatial Data Structures. Addison-Wesley, Reading, MA, 1990.

10 0 10 5 10 6 10 0 10 5 10 6 10 0 10 5 10 6 male sex female 30 age age 40 30 50 diagnosis diagnosis diagnosis fracture ulcer diagnosis male, 30, male, 40, fracture ulcer female, 50, Figure 1: Indexing tree with patient records. The solid boxes are nodes of the tree, and the large dashed boxes are blocks used in the disk indexing. We use thick boxes to show the of 30-year old and ulcer patients of both sexes. 64-MByte memory 128-MByte memory 256-MByte memory 512-MByte memory 10 0 10 5 10 6 10 0 10 5 10 6 1,024-MByte memory Figure 2: Dependency of the on the ; the scale of both horizontal and vertical axes is logarithmic. We give the results of experiments with five sizes of the main memory: 64 MBytes, 128 MBytes, 256 MBytes, 512 MBytes, and 1,024 MBytes. For every memory size, we show the of retrieving exact matches for point queries (dotted lines), exact matches for region queries (dashed lines), and approximate matches (solid lines).

10 0 64 128 256 512 1,024 10 0 64 128 256 512 1,024 10 0 64 128 256 512 1,024 100,000 records 400,000 records 1,600,000 records Figure 3: Dependency of the on the size of the main memory; the scale of both horizontal and vertical axes is logarithmic. We show the dependency for three sizes of the indexing tree: 100,000 records, 400,000 records, and 1,600,000 records. For every size, we plot the for exact point queries (dotted lines), exact region queries (dashed lines), and approximate queries (solid lines).