Abstract:
A method is disclosed for computing an association rule in a database having numerical attributes and 0-1 attributes. First, a numerical attribute is divided into a plurality of intervals (or buckets), and each data set is placed into a single bucket according to the value of the numerical attribute. The number of data sets in each bucket and the number of data sets with a 0-1 attribute being 1 are counted. Second, the starting bucket of an interval to be detected is to be detected. Third, the terminating bucket corresponding to the starting bucket is detected. That is, the largest interval with a confidence equal to or larger than a predetermined value. Fourth, one of the detected pairs of starting and terminating buckets which includes the largest number of customers is the answer to this question. Finally, the required data attributes of data included in this interval is subsequently retrieved.

Description:
FIELD OF THE INVENTION 
     The present invention relates to an analysis of the correlation among data sets in a database, particularly to a means for determining the correlation among data sets having a numerical attribute and a 0-1 attribute. 
     BACKGROUND OF THE INVENTION 
     Analyzing the correlation among data sets in a database to discover a significant association rule among attributes is called &#34;data mining&#34;. 
     The fact that a customer has purchased a commodity A or has a credit card can be considered as data with a 0-1 attribute. This attribute can be indicated by 0 or 1 to represent, respectively, whether or not the customer has purchased a commodity A or has a credit card. Attempts have been made to determine a rule from the correlation based on an 0-1 attribute. For example, R. Agrawal, T. Imielinski and A. Swami, &#34;Mining association rules between sets of items in large databases&#34;, Proceedings of the ACM SIGMOD Conference on Management of data, May 1993, and R. Agrawal and R. Srikant, &#34;Fast algorithms for mining association rules&#34;, Proceedings of the 20th VLDB Conference, 1994 describe methods for determinating an association rule representing that &#34;a ratio r of the customers who have purchased a commodity A have also purchased a commodity B.&#34; 
     In conventional relational databases, their query languages can be used to provide a numerical attribute A and an interval I in order to easily solve the question, for example, that &#34;X % of the data with A the value of which is included in I has a 0-1 attribute B&#34;. In this case, however, the interval I must be input. Current databases do not have a function for outputting the interval I. This is because the association rule between the numerical value and a set of intervals based thereon has a very large searching space. 
     For example, given a database for data on bank customers, it is very useful to be able to determine an interval I that meets an association rule for a combination of a numerical attribute (an increase in the amount of a fixed deposit) and a 0-1 attribute (whether or not a credit card is used). The association rule may then be used for determining the percentage of customers whose increase in the balance of a fixed deposit is included in the interval I also use a credit card. Although there are many intervals I, generally, the interval I with the largest number of customers can be uniquely determined. The determination of the interval I also allows information useful to other operations to be acquired. 
     Such questions, however, are applied to databases with a large number of data sets, so it is essential to be able to process such a large number of data sets in practical time. 
     It is thus an objective of this invention to provide a method for determining the correlation among data sets with a numerical attribute and a 0-1 attribute. 
     It is another objective of this invention to execute the above processing at a high speed. 
     It is yet another objective of this invention that if the rate of data sets with their numerical attribute z included in the interval I=[r1, r2] is defined as a support for the interval I, and the rate of those data sets with their numerical value included in the interval I whose 0-1 attributes (a) are 1 is defined as a confidence, the interval I with both a confidence of α % or more and the maximum support (which is referred to as a &#34;dual association rule&#34;) can be determined. 
     SUMMARY OF THE INVENTION 
     This invention can be mainly divided into the following four sections. 
     (1) A numerical attribute is divided into a plurality of intervals (buckets), and each data set is placed into a single bucket according to the value of the numerical attribute. The number of data sets in each bucket and the number of data sets with a 0-1 attribute being 1 are counted. 
     (2) The starting bucket of an interval is detected. That is, s that meets the following condition is found. ##EQU1## where u i  is the number of data sets included in a certain bucket, and v i  is the number of those data sets in a certain bucket with the 0-1 attribute being 1. 
     (3) The terminating bucket corresponding to the starting bucket is detected. That is, the largest interval with a confidence equal to or larger than the predetermined value of α. 
     (4) One of the detected pairs of starting and terminating buckets which includes the largest number of customers is the answer to this question. The required data attributes of data included in this interval is subsequently retrieved. 
     In short, in a database having a plurality of data sets, each including a numerical attribute and a 0-1 attribute, a database retrieval method is described for retrieving data by computing an interval of the numerical attribute in which the probability of the 0-1 attribute being 1 is α or higher and a maximum number of data sets exist. This database retrieval method comprises the steps of: (a) counting the number of data sets included in each bucket which is arranged along an axis corresponding to the numerical attribute, and counting the number of data sets in each bucket, whose 0-1 attributes are 1; (b) determining a starting index s so that Equation (2) is satisfied: ##EQU2## where u i  is the number of data sets included in a bucket, and v i  is the number of data sets in a bucket with the 0-1 attribute being 1; (c) determining a maximum terminating index t that is equal to or larger than the determined starting index s, wherein the probability of the 0-1 attribute being 1 is α or higher between s and t; (d) selecting an interval [s, t] with the largest number of data sets; and (e) retrieving data from the database included in the interval [s, t]. This process enables a dual association rule to be computed. 
     It is conceivable that each bucket is set so as to include a substantially identical number of data sets as in other buckets. 
     In the case where each bucket has a substantially identical number of data sets, the following additional steps may be performed to speed up the counting process: randomly sampling X of the N data sets; sorting the X data sets according to the value of the numerical attribute; storing the value of the numerical attribute of the i×X/M-th of the sorted data sets, where i=1, 2, . . . , M-1, and M is the number of buckets; and counting the number of data sets included in each bucket, based on the stored value. 
     It is preferred that the step of determining the starting index includes the steps of judging whether or not w&lt;0 and v s-1  -αu s-1  ≧0; if the result of the judging step is positive, then setting w=v s-1  -αu s-1  and determining whether or not w&lt;0. If the result of the judging step is negative, then setting w=w+v s-1  -αu s-1  and determining whether or not w&lt;0. These steps allow the starting index s to be found efficiently. 
     It is also preferred that step for determining the terminating index t starts with the determination of a terminating index t corresponding to the largest starting index s. This technique facilitates the finding of the terminating index t. 
     It is conceivable that a terminating index t, corresponding to one starting index s, is determined by processing a value equal to or less than a terminating index t&#39;, The terminating index t&#39; corresponds to a starting index s&#39; processed immediately before the starting index s. 
     Another form of this invention that is typically conceivable is the implementation of the above method using an apparatus specially constructed, computer programs, or a medium that stores such computer programs. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a flowchart showing the bucket processing steps; 
     FIG. 2 is a flowchart showing the use of a plurality of processor elements for the bucket processing; 
     FIG. 3 is a drawing showing the state of the buckets after the bucket processing has ended; 
     FIG. 4 is a flowchart showing the process for determining an effective value of s; 
     FIG. 5 is a flowchart showing the process for determining top(s); 
     FIG. 6 is a flowchart showing the overall method of the invention; 
     FIG. 7 shows the configuration of a typical general-purpose computer in which the method of the present invention is implemented; and 
     FIG. 8 is a block diagram showing a special apparatus in which the method of the invention is implemented. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENT 
     The method steps are now described in detail. 
     (1) Bucket processing 
     A particular range of the value of a numerical attribute of data is partitioned into buckets, and can be expressed as B 1 , B 2 , B 3 , . . . B M , where B i  =[x i , y i  ], x i  ≦y i  &lt;x i  +1). The value of the numerical attribute of data is included in one of the buckets. B i  =(x, x) may be used if high resolution is required. 
     It is conceivable that all the data sets are sorted according to their numerical attributes in order to examine which bucket should contain each data set. If, however, such processing is to be executed and the database contains a very large number of data sets, they cannot be processed within a main memory, resulting in a failure to finish the process in practical time. The following process is thus performed. 
     It is assumed that there are N data sets and that they are to be put into M buckets. It is also assumed that the i-th bucket cannot be put into the (i+1)-th bucket. 
     (a) (M×N) 0 .5 data sets are randomly sampled from the entire data (step 110 in FIG. 1). For example, if M is about 1,000 and N is about one billion, then (M×N) 0 .5 is about one million. This process can be performed in the main memory of a computer. 
     (b) The randomly sampled data is sorted (step 120). Calculations can be carried out in the order of O((M×N) 0 .5 ×log(M×N)). 
     (c) The i(N/M) 0 .5 -th value is stored as p i  (step 130). In this case, p 0  =-∞ and P M  =∞. 
     (d) The data sets are put into different buckets (step 140). A bucket B i  contains a data set with (x) corresponding to p i  &lt;x≦p i  +1. This step can be executed in the order of O(NlogM) using binary search. At the same time, the number of data sets in each bucket and the number of data sets with a 0-1 attribute being 1 are counted. 
     With the above method, the data can be generally processed in the order of O(NlogM). In addition, if the number of data sets to be sampled is (M×N) 0 .5, it is very likely that the number of errors can be reduced from M/2N to 2M/N. 
     Although step (d) takes the largest amount of time, parallel processing can be used to easily reduce the amount of time. That is, the database is divided into processor elements (step 210 of FIG. 2). A main processor element carries out steps (a) to (c) (step 220). Each of the other processor elements executes step (d) (step 230). The main processor element collects and aggregates the results from each of the other processor elements (step 240). This method reduces the amount of data communication among the processor elements and also reduces the amount of processing time due to the parallel processing of step (d) that is subjected to substantial loads. 
     In this manner, the first processing of the bucket is completed. 
     (2) Starting index determination process 
     Once the buckets have been prepared as described above, a group of the consecutive bucket with a confidence of α or higher and with the maximum support are retrieved. The buckets are referred to as B 1 , B 2 , B 3 , . . . , B M , the number of data sets in each bucket is u i  (i=1, 2, . . . , M), and the number of data sets required to meet a condition is v i  (i=1, 2, . . . , M)). The support (s, t) is a support for xs≦A≦yt (A represents the attribute of data). It is actually the total number of data sets in a set of the consecutive bucket B s , B s+1 , B s+2 , . . . , B t  divided by the total number of data sets N, and can be expressed as follows: ##EQU3## 
     Conf(s, t) is a confidence for xs≦A≦yt which meets a condition C. It can be expressed as follows: ##EQU4## 
     The objective of this invention is to determine s and t which provide both a conf(s, t) of α or higher and the maximum support (s, t). This pair of s and t is called an &#34;optimal&#34; pair. For any j&lt;s, s that meets conf(j, s-1)&lt;α is &#34;effective&#34;. 
     If a pair s and t that meets s≦t is optimal, then s is effective. If j that meets conf(j, s-1)≧α exists, then conf(s, t)≧α and conf(j, t)≧α, which is inconsistent with the proposition that the pair of s and t is optimal. 
     All the values of s that will be effective are found, then the optimal pair is detected. Thus, finding the s that meets: ##EQU5## allows an effective s, that is, a starting index to be found. 
     To find an effective s, the steps shown in FIG. 4, which will be described next, are used. In this case, s=1 is defined as effective. First, to set initial values, s=2 and w=0 are set in step 110. To change s from 2 to M, it is determined in step 120 whether or not s=M+1. If s is equal to or smaller than M, it is determined in step 130 whether or not w&lt;0 and v s-1  -αu s-1  ≧0. 
     Since Equation (5) is met for any j&lt;s, Equation (4) is not met if v s-1  -αu s-1  ≧0. Thus, v s-1  -αu s-1  that maximizes the value within the parenthesis in Equation (5) is denoted by win step 140. If the condition in step 130 is not met, w=w+v s-1  -αn s-1  in step 150. For such w, it is checked in step 160 whether or not w&lt;0. 
     If w&lt;0, that s is effective in step 170. If it is determined in step 160 that w≧0 or after step 170, s is incremented by one in step 180. The process then returns to step 120. 
     This process allows effective s to be found. These are starting indices. This process can be carried out in the order of O(M). 
     A simple specific example is shown below. 
     
                       TABLE 1______________________________________s   1       2     3    4   5     6   7     8   9     10u.sub.s    10      10    10   10  10    10  10    10  10    10v.sub.s    5       3     2    1   7     2   8     3   4     5w   0       0     -2   -5  -9    2   -1    3   1     0    ↑       ↑                  ↑                      ↑   ↑______________________________________ 
    
     Table 1 shows u s  and v s  with s ranging from 1 to 10, and α used for calculating w is fixed at 0.5. As described above, for s=1, w is zero and effective, so it is marked by an arrow. For s=2, w is zero (w=0+(5-10×0.5)) and is not marked. For s=3, w is -2 (=0+(3-10×0.5)) and is marked. For s=4, since v s-1  -αu s-1  =-3, w is -5 (=-2+(-3)) and is marked. Similarly, for s=5, w is -9 and is marked. For s=6, since v s-1  -αu s-1  =2, w is 2 and is not marked. For s=7, w is -1 (i.e., w=2+(-3)) and is marked. For s=8, since v s-1  -αu s-1  =3, w is 3 and is not marked. Likewise, for s=9 or 10, w is not marked. As a result, effective s in this example are 1, 3, 4, 5, and 7. 
     (3) Terminating index determination process 
     A notation is first described. The largest t that meets s≦t and conf(s, t)≧α is denoted by top(s). Thus, the objective is to determine top(s) for each s. 
     Then, for effective s and s&#39;, if s≦s&#39;, then top(s)≦top(s&#39;). This is because conf(s, s&#39;-1)&lt;α, resulting in conf(s, top(s))≧α and conf(s&#39;, top(s))≧α. 
     With this characteristic, the effective values of s are processed in the descending order. The value smaller than top(s) is top(s&#39;) for s&#39; that meets s≧s&#39;, resulting in a reduced number of steps and an increased calculation speed. Specifically, the process represented by the flow chart of FIG. 5 enables top(s) to be determined. s(j) is in a sequence {s(1), s(2), . . . , s(q)} in which effective s are arranged in the ascending order, and indicates the j-th s. In addition, there are (q) effective s and M buckets, as described above. 
     The process starts with step 300, and initialization is carried out in step 310 to set j=q and i=M. In order to process all the effective values of s, the method determines in step 320 whether or not j is equal to 0. If all the effective values of s have not been processed, the method determines in step 330 whether or not the condition conf(s(j), i)&lt;α is met. If conf(s(j), i) is less than α, then i is decremented by one in step 340. After several decrementing operations, however, i may become s(j)-1. This condition is inconsistent with the definition of s being effective. Therefore, further calculation is not necessary. The process then proceeds to step 360 to begin processing the next effective s in step 345. If i is not equal to s(j)-1, the process returns to step 330. 
     If conf(s(j), i)&lt;α is not established in step 330, this means that top(s(j)) has been found, and top(s(j))=i is set in step 350. The value of j is then decremented by one to find top(s) for the next effective s in step 360. Such a process is repeated to find top(s) for the effective s. 
     The above-described step 330 may be further simplified by calculating Equation (6) and storing the results in the table beforehand. ##EQU6## If G(i)-G(s(j)-1)&lt;0, then conf(s(j), i)&lt;α, resulting in fast calculations. 
     Thus, top(s) (the terminating index t) has been determined. This process can be carried out in the order O(M). 
     The process for determining the terminating index is now described using the example shown in Table 1. 
     In this example, the effective values of s are {1, 3, 4, 5, 7}, so the process starts from s=7. First, i=10 is set, and conf(7, 10) is calculated to obtain 0.5. It is then found that i=10 results in top(7). Next, when s=5, conf(5, 10) and conf(5, 9) are smaller than 0.5 if i=10 or 9, whereas conf(5, 8)=0.5 if i=8. Consequently, top(5)=8. 
     For s=4, the process starts with i=8. When i=4, however, the confidence does not exceed 0.5, so there exists no terminating index corresponding to s=4. The process thus passes to the processing of s=3, but again the confidence does not exceed 0.5 if i=4 or 3. The last i=1 is then processed, but the confidence does not exceed 0.5 unless i=1. As a result, top(1)=1. 
     Top(7)=10, top(5)=8, and top(1)=1 have thus bee n obtained. 
     (4) Determination of the maximum support interval 
     If any pairs of starting and terminating indices have been determined as described above, one of the intervals I [s, t], which has the highest rate or largest number of customers, is selected. This can be carried out using the following equation. ##EQU7## 
     With this equation, however, a single calculation requires operations in the order of O(M). Thus, the following equation and Sum(t)-Sum(s-1) can be used. ##EQU8## 
     In the above example, since [7, 10] and [5, 8] have the same number of data sets, both are output. 
     By obtaining the interval I, the user can easily retrieve the required attributes of data included in the interval I. The attributes required by the user include, for example, customers&#39; names and addresses required for sending direct mails and customer IDs required for extracting customers who are likely to become bankrupt. In the case of relational databases, once the interval I has been determined, subsequent operations as those described in the Background of the Invention section may be easily performed based on the interval. FIG. 6 illustrates the overall process for determining the correlation between datasets, in accordance with the invention. 
     One embodiment of the invention has been described above. Alternatively, when execution speed is not an important factor, the starting and the terminating indices can be determined by calculating and searching required rows and columns. For example, after the calculations within the parenthesis of Equation (5) have been carried out to prepare a matrix F(j, s) according to the results, one of the rows whose elements for the upper triangle are all negative can be obtained as a starting index. In addition, after the items within the parenthesis of Equation (5) have been modified so as to sequentially add s to t together, the lower triangle of the matrix obtained can be searched for a column corresponding to the starting index s in order to determine the corresponding terminating index. 
     In another aspect of the invention, the method described above may be implemented and executed by computer programs. For example, such programs can be executed by a general purpose computer illustrated by the block diagram of FIG. 7. Processing programs are stored in a hard disk drive (HDD) 1050, and in operation, loaded in a main memory 1020 and processed by a CPU 1010. The HDD 1050 includes a database that is accessed by the processing programs. The user inputs a value of a confidence of T and data output instructions. A display device 1060 displays the determined interval I and the required attributes of data included in the interval I as required. Input devices include a keyboard, a mouse, a pointing device, and a digitizer. The results of output can be stored in a floppy diskette (FDD) 1030 that is a sub-storage device, and new data can be entered therefrom. A CD-ROM drive 1040 can be used to input data. 
     Computer programs for implementing the process according to this invention can be stored and carried in a storage medium such as a floppy disk or a CD-ROM. In this case, the data retrieval portion of normal database retrieval programs or programs that perform only display operations may be already stored in the HDD 1050. Thus, the other portions or programs are normally carried in such a storage medium. 
     A special apparatus for executing the method according to this invention may also be provided. For example, an apparatus such as shown in FIG. 8 is conceivable. A database 1500 is connected to a bucket processing section 1510 and an output section 1540, and the bucket processing section 1510 is connected to a starting index detecting section 1520. The output of the starting index detecting section 1520 is connected to a terminating index detecting section 1530 with its output connected to the output section 1540. An input section 1550 is connected to both the output section 1540 and the starting and the terminating index detecting sections 1520 and 1530. 
     The bucket processing section 1510 carries out the bucket processing described above, and counts both the number of data sets in each bucket and the number of data sets with a 0-1 attribute being 1. The starting index detecting section 1520 uses the results of the counting and a confidence of α input from the input means to detect effective values of s as described above. The terminating index detecting section 1530 also detects top(s) s according to the confidence of α input from the input section 1530. The output section 1540 selects an interval I from among the values of s and top(s) with the largest support, and extracts the appropriate attributes of data included in the interval I, in response to a signal from the input section 1550 that transmits the user&#39;s input. The attributes are displayed on a display device (not shown), printed on a printing device, or stored in a floppy or a hard disk. 
     The apparatus in FIG. 9 is only an example, and any apparatus that can execute the above processing can be used for this invention. For example, a control section for controlling the overall process is provided to determine both the overall flow of processing and the output form of a signal from the input section 1550. 
     Based on the foregoing description, a correlation among data sets with a numerical attribute and a 0-1 attribute can been successfully determined. The process for determining this correlation can also be done at a high speed. In addition, the method of the invention allows an interval I with both a confidence of α or higher and the maximum support to be determined.