Article Discretization Based on Entropy and Multiple Scanning

In this paper we present entropy driven methodology for discretization. Recently, the original entropy based discretization was enhanced by including two options of selecting the best numerical attribute. In one option, Dominant Attribute, an attribute with the smallest conditional entropy of the concept given the attribute is selected for discretization and then the best cut point is determined. In the second option, Multiple Scanning, all attributes are scanned a number of times, and at the same time the best cut points are selected for all attributes. The results of experiments on 17 benchmark data sets, including large data sets, with 175 attributes or 25,931 cases, are presented. For comparison, the results of experiments on the same data sets using the global versions of well-known discretization methods of Equal Interval Width and Equal Frequency per Interval are also included. The entropy driven technique enhanced both of these methods by converting them into globalized methods. Results of our experiments show that the Multiple Scanning methodology is significantly better than both: Dominant Attribute and the better results of Globalized Equal Interval Width and Equal Frequency per Interval methods (using two-tailed test and 0.01 level of significance).


Introduction
Discretization of numerical attributes is one of the basic techniques of data mining.During this process, numerical values are transformed into intervals.Among the many discretization techniques, discretization based on the conditional entropy of the concept given an attribute is considered to be one of the most successful methods .
For a numerical attribute a with an interval [i, j] as a range, a partition of the range into k intervals where i 0 = i, i k = j, and i l < i l+1 for l = 0, 1, ..., k − 1, defines a discretization of a.The numbers i 1 , i 2 ,..., i k−1 are called cut points.Our discretization system denotes such intervals as i 0 ..i 1 , i 1 ..i 2 ,..., i k−1 ..i k .
Discretization methods that may be applied only to one variable at a time are called local.Methods with all attributes processed during discretization are called global.
We present an enhanced version of the original discretization based on entropy presented in [22].In this version there is a choice between two options.The first option is called Dominant Attribute.First the current best attribute is selected, then, for this attribute, the best cut point, using conditional entropy again, is selected.This process continues until a stopping criterion is satisfied.In the second option, called Multiple Scanning, the entire attribute set is scanned.For any attribute, the best cut point is selected, then sub-tables that still need discretization are created.The entire attribute set of any sub-table is scanned again, and the best corresponding cut points are selected.The process continues until the stopping condition is satisfied or the required number of scans is reached.If necessary, discretization is completed by the Dominant Attribute technique.The same stopping criterion, based on rough set theory, was used in all experiments.The quality of each discretization technique was evaluated by an error rate computed as a result of ten-fold cross validation (with the exception of the spectrometry data set where hold-out was used).Our experiments were conducted on 17 benchmark data sets.
For comparison, results of experiments on the same data sets using well-known discretization methods of Equal Interval Width and Equal Frequency per Interval are also included.These two methods are local, but we converted both methods to global using entropy as well.Results of our experiments show that the Multiple Scanning methodology is significantly better than both: Dominant Attribute and the better results of Globalized Equal Interval Width and Equal Frequency per Interval methods (using two-tailed test and 0.01 level of significance).
A preliminary version of this paper was presented at the ISMIS 2009, the 18th International Symposium on Methodologies for Intelligent Systems [11].

Entropy Based Discretization
We are assuming that the input data set is given in a form of the table exemplified by Table 1.In such a table all cases are described by variables called attributes and one variable is called a decision (or class) and is denoted by d.The set of all attributes will be denoted by A. The set of all cases will be denoted by U .In Table 1 the attributes are Weight, Length and Height while the decision is Price.Additionally, U = {1, 2, 3, 4, 5, 6, 7}.An entropy of a variable v (attribute or decision) with values v 1 , v 2 ,..., v n is defined by the following formula where U is the set of all cases in a data set and p(v i ) is a probability (relative frequency) of value v i in the set U , i = 0, 1, ..., n.All logarithms in this paper are binary.
where a 1 , a 2 , ..., a m are all values of a and d 1 , d 2 , ..., d n are all values of d.There are two fundamental criteria of quality based on entropy.The first is an information gain associated with an attribute a and defined by the second is information gain ratio, for simplicity called gain ratio, defined by Both criteria were introduced by J. R. Quinlan, see, e.g., [22] and used for decision tree generation.For a cut point q for an attribute a, the conditional entropy, defined by a cut point q that splits the set U of all cases into two sets S 1 and S 2 , is defined as follows where |X| denotes the cardinality of the set X.The cut point q for which the conditional entropy H a (q, U ) has the smallest value is selected as the best cut point.The corresponding information gain is the largest.

Stopping Criterion for Discretization
A stopping criterion of the process of discretization, described in this paper, is the level of consistency [3], based on rough set theory [23,24].For any subset B of the set A of all attributes, an indiscernibility relation IN D(B) is defined, for any x, y ∈ U , in the following way (x, y) ∈ IN D(B) if and only if a(x) = a(y) for any a ∈ B where a(x) denotes the value of the attribute a ∈ A for the case x ∈ U .For example, in Table 1, Weight(1) = 0.8.

Dominant Attribute Strategy
We will discuss two basic discretization techniques based on entropy.The first discretization technique is called Dominant Attribute (or Starting from One Attribute [11]).A similar idea for a decision tree generation is used in the C4.5 system [22].In addition, for numerical attributes, C4.5 uses discretization similar to the Dominant Attribute approach, yet C4.5 not only does not use the measure L(A) as stopping condition but also does not use merging of intervals created during such discretization either.
The Dominant Attribute algorithm is recursive: • for a given set of cases (initially it is U ), we identify the best attribute (i.e., the attribute with the largest information gain or the attribute with the largest gain ratio), • for the best attribute, we are looking for the best cut point, i.e., the cut point with the smallest conditional entropy, • the best cut point divides the data set into two smaller data sets, S 1 and S 2 .
• we apply the same strategy for both smaller data sets separately, • the algorithm stops when L(A D ) = 1, where A D is the discretized set of attributes, We need to take into account that the order in which we process smaller data sets may affect the discretization.We will illustrate this method by discretizing the data set from Table 1.We will use the information gain as the criterion to select the best attribute.
The conditional entropy H(P rice|W eight) is Similarly, the conditional entropies H(P rice|Length) = 1.250 and H(P rice|Height) = 0.749.The minimal conditional entropy is associated with attribute Height.What is the best cut point for attribute Height is the next question.This attribute has two potential cut points (averages between sorted values of the attribute Height): 8.7 and 12.7.The conditional entropy H Height (8.7, U ) is  2 and 3.
It is also obvious that for Table 2 the only attribute that may be discretized is Length, with the cut point is equal to 0.7.Table 4 presents the current situation: discretized are attributes Length and Height, with cut points 0.7 and 8.7, respectively.
For Table 4 and A D = {Length D , Height D }, where Length D and Height D denote currently discretized attributes, (A D ) * = {{1}, {2}, {3, 5, 6, 7}, {4}}, and L(A D ) = 0.429, so further discretization is necessary.However, by analysis of Table 4 we may easily discover that all what we need to do is to distinguish cases 3 and 5 from cases 6 and 7 and that cases 3 and 4 do not need to be distinguished.Thus, our next table to be discretized is presented as Table 5 (note that Table 5 is simpler than Table 3).We will continue discretization by recursion.Our final choice of cut points is 1.6 for Weight, 0.7 for Length, and 8.7 and 12.7 for Height.The final discretized table is presented as Table 6.

Multiple Scanning Strategy
The second discretization technique needs some parameter denoted by t and called the total number of scans.In Multiple Scanning Algorithm, • for the entire set A of attributes the best cut point is computed for each attribute a ∈ A based on minimum of conditional entropy H(d|a), a new discretized attribute set is A D , and the original data set is partitioned into a partition (A D ) * , • if the number of scans t is not reached, the next scan is conducted: we need to scan the entire set of partially discretized attributes again; for each attribute we need only one cut point, the best cut point for each block X ∈ (A D ) * is computed, the best cut point among all such blocks is selected, • if the requested number of scans t is reached and the data set needs more discretization, the Dominant Attribute technique is used for the remaining sub-tables, • the algorithm stops when L(A D ) = 1, where A D is the discretized set of attributes.
We will illustrate this technique by scanning all attributes, Weight, Length, and Height once.First we are searching for the best cut point for attributes Weight, Length, and Height.The best cut points are 1.6, 1.7, and 8.7, respectively.Table 1, partially discretized this way, is presented as Table 7.The level of consistency for Table 7 is 0.429 since A * = {{1, 2}, {3, 4}, {5}, {6, 7}}, we need to distinguish cases 1 and 2, and, separately, cases 6 and 7. Therefore we need to use the Dominant Attribute technique for two sub-tables, first with two cases, 1 and 2, and second with also two cases, 6 and 7.As a result, we will select cut points 0.7 and 12.7 for attributes Length and Height, respectively.

Globalized Versions of Equal Interval Width and Equal Frequency per Interval
Two discretization methods, called Equal Interval Width and Equal Frequency per Interval are frequently used in data mining.Both methods are local.In the Equal Interval Width method, the domain of a numerical attribute a is divided into k equal intervals, where k is a real number set up by the user.In the Equal Frequency per Interval method, attribute values are distributed in such a way that in all k intervals the number of attribute values is approximately equal to each other.This method is sometimes called a Maximum Entropy Discretization [21].
For our experiments, both methods were converted to global by using entropy.In this approach, the first step is to discretize all attributes, by computing a cut point for all attributes, assuming k = 2.If the level of consistency satisfies requirements, the process is completed.If not, we need to select an attribute a whose initial distribution is the worst.A measure of quality for such distribution is the average block entropy of an attribute defined by the following formula An attribute a for which M (a) is maximum is considered to be the worst and, as such, is selected for re-discretization with k incremented by one.As follows from [12], the Globalized Versions of Equal Interval Width and Equal Frequency per Interval methods are successful and competitive.

Interval Merging
In all our discretization techniques, the last step of discretization was the merging of intervals, to reduce their number and, at the same time, preserve consistency.The algorithm for merging intervals consists of two steps: • safe merging: for any attribute and for any two neighboring intervals i..j and j..k of the same discretized attribute, if both intervals are labeled by the same decision value, both intervals are merged, i.e., replaced by a new interval i..k, • proper merging: for any attribute and for any two neighboring intervals i..j, j..k of the same discretized attribute, if a result i..k of merging does not reduce the level of consistency L(A D ), where A D is the current set of discretized attributes, both intervals are merged (replaced by a new interval i..k).
If neighboring intervals i..j and j..k are merged, we say that the cut point j was eliminated.Obviously, the order in which pairs of neighboring intervals are selected for proper merging affects the final outcome.
In our experiments, we selected two neighboring intervals with the smallest conditional entropy, taking all attributes and all intervals into account.Using interval merging, we may eliminate the cut points 1.7 and 1.633 for attribute Length, in Tables 7 and 9, respectively.

LEM2 Algorithm for Rule Induction
The discretized data were fed into the data system LERS (Learning from Examples based on Rough Sets) [25] for rule induction.LERS uses rough set theory to compute lower and upper approximations for concepts involved in conflicts with other concepts [23].
Rules induced from the lower approximation of the concept certainly describe the concept, hence such rules are called certain.On the other hand, rules induced from the upper approximation of the concept describe the concept possibly, so these rules are called possible.
The LEM2 algorithm (Learning from Examples Module, version 2) of LERS is most frequently used for rule induction.LEM2 explores the search space of attribute-value pairs.Its input data set is a lower or upper approximation of a concept, so its input data set is always consistent.In general, LEM2 computes a local covering and then converts it into a rule set [25].Recently, a new, improved version of LEM2, called MLEM2, was developed [26].

Experiments
Our experiments were conducted on 17 data sets, summarized in Table 10.All of these data sets, with the exception of bankruptcy, brain and spectrometry, are available on the University of California at Irvine Machine Learning Repository.The bankruptcy data set is a well-known data set used by E. I. Altman to predict a bankruptcy of companies [27].The leukemia data set describes penetration across the blood-brain barrier [28].The spectrometry data set describes human proteins used in the mass spectrometry [29].Every discretization method was applied to all data sets, with the level of consistency equal to 100%.For a choice of the best attribute, we used gain ratio.Rule sets were induced using the LEM2 algorithm of the LERS data mining system.
Table 11 presents results of ten-fold cross validation, for all data sets except spectrometry, using increasing number of scans.For the spectrometry data set hold-out, with split of the original data set into 70% for training and 30% for testing was applied due to its size.Obviously, for any data set, after some fixed number of scans, an error rate is stable (constant).For example, for the Australian data set, the error rate will be 15.65% for the scan number 4, 5, etc.Thus, any data set from Table 11 is characterized by two error rates: minimal and stable.For a given data set, the smallest error rate from Table 11 will be called minimal and the last entry in the row that corresponds to the data set will be called stable.For example, for the Australian data set, the minimal error rate is 14.93% and the stable error rate is 15.65%.For some data sets (e.g., for bankruptcy), minimal and stable error rates are identical.It is clear from Table 11 that the minimal error rate is associated with 0 scans (i.e., with the method Dominant Attribute) only for the abalone data set.Using the Wilcoxon matched-pairs signed-ranks test, we conclude that the following two statements are statistically highly significant (i.e., the significance level is equal to 1% for a two-tail test): • the minimal error rate associated with Multiple Scanning is smaller than the error rate associated with Dominant Attribute, • the minimal error rate associated with Multiple Scanning is smaller than the smaller error rate associated with Globalized Equal Interval Width and Globalized Equal Frequency per Interval (Table 12).Additionally, the effects of scanning during discretization are presented in Tables 14 and 15.We selected the echocardiogram and iris data sets not only because their all attributes are numerical with real numbers as values but also because they have small number of attributes.For example, for the echocardiogram data set, for 0 scans, i.e., for Dominant Attribute, it is clear that attribute Age was selected as the best and that during discretization eight cut points were selected.After a single scan, the same attribute was selected as the best attribute.The Wall-score attribute was redundant for 0 scans, but it became essential after the first scan.

Conclusions
This paper presents results of experiments in which four different techniques were used for discretization.All four techniques were validated by conducting experiments on 17 data sets with numerical attributes.Our discretization techniques were combined with rule induction using the LEM2 rule induction algorithm.The results of our experiments show that the Multiple Scanning technique is significantly better than: Dominant Attribute and the better results of Globalized Equal Interval Width and Equal Frequency per Interval methods (using two-tailed test and 0.01 level of significance).Thus, we show that there exists a new successful technique for discretization.

Table 1 .
An example of a data set with numerical attributes.
A conditional entropy of the decision d given an attribute a is

Table 1
B and are called B-elementary sets.For Table 1, B-elementary classes are {1}, {2, 3}, {4}, {5} and {6, 7}.Any finite union of B-elementary sets is B-definable.A partition on U constructed from all B-elementary sets of IN D(B) will be denoted by B * .{d}-elementary sets are called concepts, where d is a decision.For example, for Table Thus we will select the cut point 8.7.Obviously, the current discretization of attribute Height into two intervals 7.2..8.7 and 8.7..15.2 is not sufficient, since if we will use only discretized attribute Height D and A = {Height D }, {A} * = {{1, 2}, {3, 4, 5, 6, 7}}, we have AX = ∅ for any member X of {Price} * , so L(A) = 0.The current discretization splits Table1into two sub-tables, Tables 265similarly, the conditional entropy H Height (12.7,U ) = 1.536.

Table 2 .
The first sub-tableof

Table 3 .
The second sub-table of Table1.

Table 4 .
Table 1, partially discretized, with attributes Length and Height.

Table 5 .
A new sub-table of Table 1.

Table 6 .
Table 1 discretized by the Dominant Attribute discretization technique.

Table 8 .
Partially discretized Table 1 using Equal Interval Width.

Table 9 .
Table 1 discretized by Equal Interval Width.

Table 11 .
Error rates for Multiple Scanning.

Table 12 .
Error rates for Globalized Equal Interval Width and Globalized Equal Frequency per Interval.For completeness we present run time for all four approaches: Dominant Attribute, Multiple Scanning, and Globalized Equal Interval Width and Equal Frequency per Interval (Table 13).Our experiments were conducted on a machine with 34 GB of RAM with Inter(R) Xeon Processor X5650 (12 MB cache, 2.66 GHz, 6 Cores) under Fedora 17 Linux operating system.For large data sets, such as abalone and spectrometry, both Dominant Attribute and Multiple Scanning algorithms, based on entropy, were faster than Globalized Equal Interval Width and Equal Frequency per Interval methods.

Table 13 .
Run time for all four approaches: Dominant Attribute, Multiple Scanning, Globalized Equal Interval Width and Globalized Equal Frequency per Interval.

Table 14 .
Number of intervals for scanning data set echocardiogram.

Table 15 .
Number of intervals for scanning data set iris.