Adapting Adtrees for High Arity Features

Adapting Adtrees for High Arity Features

Proceedings of the Twenty-Third AAAI Conference on Artificial Intelligence (2008) Adapting ADtrees for High Arity Features Robert Van Dam, Irene Langkilde-Geary and Dan Ventura Computer Science Department Brigham Young University [email protected], [email protected], [email protected] Root Abstract c =# ADtrees, a data structure useful for caching sufficient statistics, have been successfully adapted to grow lazily ... Vary a1 Vary a2 Vary aM when memory is limited and to update sequentially with an incrementally updated dataset. For low arity sym- bolic features, ADtrees trade a slight increase in query a1 = 1 a1 = n1 a2 = 1 a2 = n2 aM = 1 aM = nM time for a reduction in overall tree size. Unfortunately, c =# c =# c =# c =# c =# c =# for high arity features, the same technique can often re- ... ... sult in a very large increase in query time and a nearly Vary a Vary a Vary a Vary a negligible tree size reduction. In the dynamic (lazy) 2 M 2 M version of the tree, both query time and tree size can increase for some applications. Here we present two Figure 1: Top levels of a generic ADtree modifications to the ADtree which can be used sepa- rately or in combination to achieve the originally in- tended space-time tradeoff in the ADtree when applied to datasets containing very high arity features. (squares) store the count of one conjunctive query. The chil- dren of ADnodes are known as Vary nodes (circles). Vary nodes do not store counts but instead group ADnodes ac- Introduction cording to a single feature. The Vary node child of an The All-Dimensions tree (ADtree) was introduced as a gen- ADnode for feature ai has one child for each value vj. These eralization of the kd-tree designed to store sufficient statis- grandchildren ADnodes specialize the grandparent’s query tics for symbolic datasets (Moore & Lee 1998). It was later Q by storing the counts of Q ∧ ai = vj. adapted to grow lazily to meet the needs of a client’s queries This full ADtree contains every combination of feature- (Komarek & Moore 2000). More recently, the ADtree was value pairs and is not yet efficient in its memory usage. modified to sequentially update for incremental environ- The original ADtree included three approaches which can ments (Roure & Moore 2006). This paper will focus on be combined to reduce its overall size. The tree can be improving the static and dynamic versions of the tree but made sparse by removing all zero counts. Additionally, the the results presented should be applicable to a sequentially ADnodes near the bottom of the tree are not expanded. In- updated tree as well. stead they are replaced with “leaf lists” of indices into the The design of the ADtree permits it to scale efficiently dataset whenever the number of relevant rows (the count) to very large datasets (in terms of number of rows in the drops below a pre-determined threshold. dataset). Previous results have been reported for datasets These two modifications only afford minimal (if any) with as many as 3 million rows (Moore & Lee 1998; space savings. The last space-saving technique originally Komarek & Moore 2000). However, the size of the ADtree introduced reduces the tree size dramatically by removing is determined by the number of feature-value combinations counts which can be recovered from other counts already (and therefore the number of features and their arity). The stored in the tree. Since the ADnode grandchildren of an number of rows in the dataset only influences the tree by ADnode for query Q represent all non-zero specializations limiting the number of possible combinations (most real of Q, the count of Q is equal to the sum of their counts. world datasets have far fewer rows than possible feature- Therefore, the count of one of these ADnodes can be recov- value combinations). ered by subtracting the sum of its siblings from the count of The full ADtree (see Figure 1) contains two types of the grandparent (Moore & Lee 1998). nodes which alternate along every path in the tree. ADnodes If k is chosen such that vk is the Most Common Value (MCV) or the largest among its siblings, then its removal Copyright c 2008, Association for the Advancement of Artificial provides the largest expected space-savings without sacri- Intelligence (www.aaai.org). All rights reserved. ficing the ability to recover any counts. For a tree built for 708 a1a2a3 Count 0 0 0 1 0 0 1 2 MCV n1 n2 n3 n4 n5 n6 n7 n8 n9 . .. n999 0 2 1 4 1 0 1 8 Figure 3: Vary node for a high arity feature 1 1 1 16 1 2 0 32 the worst-case query time when using high arity features Table 1: Sample dataset for the ADtree in Figure 2 while still maintaining reasonable space bounds. The key problem is that removing the MCV ADnode for 63 high arity features can dramatically increase query time and a1 a2 a3 only slightly decreases space usage. If a query involves the 7 56 11 16 36 33 30 MCV of feature ai, it is necessary to sum at least ni − 1 values (where ni is the arity of ai). Given a query Q of a2 a3 a2 a3 a3 a3 a3 size q, the worst case scenario could require summing over Qq 3 4 1 6 8 16 32 32 24 1 10 16 32 4 i=1 ni values due to recursive MCV “collisions”. Al- though this worst case is rare (since data sparsity and/or cor- a3 a3 a3 a3 a3 relation tend to cause Vary nodes lower in the tree to have 1 2 4 8 16 32 fewer ADnodes), it helps to illustrate the potential for longer query times when the ni are large. For instance, a query in- Figure 2: An example of a simple ADtree volving 3 features with 10 values each has a worst case of summing over 93 values. If the 3 features had 1, 000 values, this becomes 9993. M binary features, the worst case size of the tree is reduced Figure 3 illustrates the “best” case for a feature of 1, 000 from 3M to 2M upon removal of the MCV ADnodes. This values in which every sibling node is a leaf node (or at least technique assumes that the trade-off of increasing average a leaf list). If a query that encounters that MCV ADnode query time is reasonable in comparison to the expected space involves further features in the missing subtree then it will savings. need to traverse the subtrees (if they exist) of all 999 sib- The tree shown in Figure 2 illustrates what an ADtree gen- lings. This increases the potential for further MCV “colli- erated according to the dataset in Table 1 would look like. sions”, eventually leading to the worst case scenario where The nodes shown in gray are those nodes which would have every path involves one MCV ADnode for every feature in existed in a full tree but are left out according to the MCV the query. based space savings rule. As can be seen in this tree, leav- Although there are many more queries that don’t require ing out an MCV node can reduce the overall size of the tree summing, higher arity increases the possibility for very slow by much more than just a single node. At the same time, queries. Additionally, since the more common values have the count corresponding to every one of the “missing” nodes a higher prior probability of being queried (at least for some can still be reconstructed from the remaining nodes. client algorithms), the most expensive queries are the most The dynamic tree follows the same basic structure as de- likely to occur (or more likely to occur often). scribed above. However, since it is built lazily, at any given The original justification for excluding MCV ADnodes point only a portion of the tree will have been expanded. was that it provided significant space savings in exchange The dynamic tree also contains some additional support info for a minor increase in query time. For binary features, there used to temporarily cache information needed for later ex- is no significant increase in query time and each Vary node’s pansion. Fully expanded portions of the tree no longer re- subtree is cut at least in half. For a feature with 10 values, the quire these extra support nodes. Vary node’s subtree is reduced by at least 10% in exchange for summing over at least 9 values. With 10, 000 values, the Modifications subtree is reduced by at least 0.01% in exchange for sum- It is noteworthy that the majority of previously published re- ming over at least 9999 values. The space savings becomes sults have used datasets with relatively low arity features. insignificant and the increased query time becomes signifi- Although there is no technical limit to the arity of features cant with higher arity features. used in an ADtree, there are practical limitations. In par- There is a further complication when using a dynamic ticular, the space-saving technique of removing all MCV tree. If a query is made that involves at least one MCV then ADnodes makes the assumption of a reasonable space-time all ni −1 of its siblings must be expanded. If those nodes are trade-off that is more easily violated with high arity features. never directly queried then they are simply wasted space. In Dynamic trees can suffer additional problems when remov- the previous example of 3 features with 10, 000 values there 3 12 1 ing MCV nodes even for low arity features.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    6 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us