Download presentation
Presentation is loading. Please wait.
Published byAsher Byrd Modified over 8 years ago
1
Chapter 8 DISCRETIZATION Cios / Pedrycz / Swiniarski / Kurgan
2
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 2 Outline Why to Discretize Features/Attributes Unsupervised Discretization Algorithms -Equal Width -Equal Frequency Supervised Discretization Algorithms - Information Theoretic Algorithms - CAIM - 2 Discretization - Maximum Entropy Discretization - CAIR Discretization - Other Discretization Methods - K-means clustering - One-level Decision Tree - Dynamic Attribute - Paterson and Niblett
3
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 3 Why to Discretize? The goal of discretization is to reduce the number of values a continuous attribute assumes by grouping them into a number, n, of intervals (bins). Discretization is often a required preprocessing step for many supervised learning methods.
4
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 4 Discretization Discretization algorithms can be divided into: unsupervised vs. supervised – unsupervised algorithms do not use class information static vs. dynamic Discretization of continuous attributes is most often performed one attribute at a time, independent of other attributes – this is known as static attribute discretization. Dynamic algorithm searches for all possible intervals for all features simultaneously.
5
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 5 Discretization x Illustration of the supervised vs. unsupervised discretization
6
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 6 Discretization Discretization algorithms can be divided into: local vs. global If partitions produced apply only to localized regions of the instance space they are called local (e.g., discretization performed by decision trees does not discretize all features) When all attributes are discretized they produce n1 x n2 x ni x… x nd regions, where ni is the number of intervals of the ith attribute; such methods are called global.
7
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 7 Discretization Any discretization process consists of two steps: - 1 st, the number of discrete intervals needs to be decided Often it is done by the user, although a few discretization algorithms are able to do it on their own. - 2 nd, the width (boundary) of each interval must be determined Often it is done by a discretization algorithm itself.
8
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 8 Discretization Problems: Deciding the number of discretization intervals: large number – more of the original information is retained small number – the new feature is “easier” for subsequently used learning algorithms Computational complexity of discretization should be low since this is only a preprocessing step
9
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 9 Discretization Discretization scheme depends on the search procedure – it can start with either the minimum number of discretizing points and find the optimal number of discretizing points as search proceeds maximum number of discretizing points and search towards a smaller number of the points, which defines the optimal discretization
10
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 10 Discretization Search criteria and the search scheme must be determined a priori to guide the search towards final optimal discretization Stopping criteria have also to be chosen to determine the optimal number and location of discretization points
11
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 11 Heuristics for guessing the # of intervals 1. Use the number of intervals that is greater than the number of classes to recognize 2. Use the rule of thumb formula: n Fi = M / (3*C) where: M – number of training examples/instances C – number of classes F i – i th attribute
12
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 12 Unsupervised Discretization Example of rule of thumb: c = 3 (green, blue, red) M=33 Number of discretization intervals: n Fi = M / (3*c) = 33 / (3*3) = 4
13
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 13 Unsupervised Discretization Equal Width Discretization 1.Find the minimum and maximum values for the continuous feature/attribute F i 2.Divide the range of the attribute F i into the user- specified, n Fi,equal-width discrete intervals
14
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 14 Unsupervised Discretization Equal Width Discretization example n Fi = M / (3*c) = 33 / (3*3) = 4 min max
15
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 15 Unsupervised Discretization Equal Width Discretization The number of intervals is specified by the user or calculated by the rule of thumb formula The number of the intervals should be larger than the number of classes, to retain mutual information between class labels and intervals Disadvantage: If values of the attribute are not distributed evenly a large amount of information can be lost Advantage: If the number of intervals is large enough (i.e., the width of each interval is small) the information present in the discretized interval is not lost
16
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 16 Unsupervised Discretization Equal Frequency Discretization 1.Sort values of the discretized feature F i in ascending order 2.Find the number of all possible values for feature F i 3.Divide the values of feature F i into the user-specified n Fi number of intervals, where each interval contains the same number of sorted sequential values
17
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 17 Unsupervised Discretization Equal Frequency Discretization example : n Fi = M / (3*c) = 33 / (3*3) = 4 values/interval = 33 / 4 = 8 Statistics tells us that no fewer than 5 points should be in any given interval/bin. min max
18
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 18 Unsupervised Discretization Equal Frequency Discretization No search strategy The number of intervals is specified by the user or calculated by the rule of thumb formula The number of intervals should be larger than the number of classes to retain the mutual information between class labels and intervals
19
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 19 Supervised Discretization Information Theoretic Algorithms - CAIM 2 Discretization - Maximum Entropy Discretization - CAIR Discretization
20
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 20 Information-Theoretic Algorithms Given a training dataset consisting of M examples belonging to only one of the S classes. Let F indicate a continuous attribute. There exists a discretization scheme D on F that discretizes the continuous attribute F into n discrete intervals, bounded by the pairs of numbers: where d0 is the minimal value and dn is the maximal value of attribute F, and the values are arranged in the ascending order. These values constitute the boundary set for discretization D: {d0, d1, d2, …, dn-1, dn}
21
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 21 Information-Theoretic Algorithms qir is the total number of continuous values belonging to the ith class that are within interval (dr-1, dr] Mi+ is the total number of objects belonging to the ith class M+r is the total number of continuous values of attribute F that are within the interval (dr-1, dr], for i = 1,2…,S and, r = 1,2, …, n. Class Interval Class Total [d 0, d 1 ]…(d r-1, d r ]…(d n-1, d n ] C1:Ci:CSC1:Ci:CS q 11 : q i1 : q S1 ………………………… q 1r : q ir : q Sr ………………………… q 1n : q in : q Sn M 1+ : M i+ : M S+ Interval Total M +1 …M +r …M +n M Quanta matrix
22
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 22 Information-Theoretic Algorithms c = 3 r j = 4 M=33
23
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 23 Information-Theoretic Algorithms Total number of values: M = 8 + 7 + 10 + 8 = 33 M = 11 + 9 + 13 = 33 Number of values in the First interval: q +first = 5 + 1 + 2 = 8 Number of values in the Red class: q red+ = 5 + 2 + 4 + 0 = 11
24
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 24 Information-Theoretic Algorithms The estimated joint probability of the occurrence that attribute F values are within interval Dr = (dr-1, dr] and belong to class Ci is calculated as: p red, first = 5 / 33 = 0.24 The estimated class marginal probability that attribute F values belong to class Ci, pi+, and the estimated interval marginal probability that attribute F values are within the interval Dr = (dr-1, dr] p+r, are: p red+ = 11 / 33 p +first = 8 / 33
25
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 25 Information-Theoretic Algorithms Class-Attribute Mutual Information (I), between the class variable C and the discretization variable D for attribute F is defined as: I = 5/33*log((5/33) /(11/33*8/33)) + …+ 4/33*log((4/33)/(13/33)*8/33)) Class-Attribute Information (INFO) is defined as: INFO = 5/33*log((8/33)/(5/33)) + …+ 4/33*log((8/33)/(4/33))
26
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 26 Information-Theoretic Algorithms Shannon’s entropy of the quanta matrix is defined as: H = 5/33*log(1 /(5/33)) + …+ 4/33*log(1/(4/33)) Class-Attribute Interdependence Redundancy (CAIR, or R) is the I value normalized by entropy H: Class-Attribute Interdependence Uncertainty (U) is the INFO normalized by entropy H:
27
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 27 Information-Theoretic Algorithms The entropy measures randomness of distribution of data points, with respect to class variable and interval variable The CAIR (a normalized entropy measure) measures Class- Attribute interdependence relationship GOAL Discretization should maximize the interdependence between class labels and the attribute variables and at the same time minimize the number of intervals
28
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 28 Information-Theoretic Algorithms Maximum value of entropy H occurs when all elements of the quanta matrix are equal (the worst case - “chaos”) q = 1 p sr =1/12 p +r =3/12 I = 12* 1/12*log(1) = 0 INFO = 12* 1/12*log((3/12)/(1/12)) = log(C) = 1.58 H = 12* 1/12*log(1/(1/12)) = 3.58 R = I / H = 0 U = INFO / H = 0.44
29
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 29 Information-Theoretic Algorithms Minimum value of entropy H occurs when each row of the quanta matrix contains only one nonzero value (“dream case” of perfect discretization but in fact no interval can have all 0s) p +r =4/12 (for the first, second and third intervals) p s+ =4/12 I = 3* 4/12*log((4/12)/(4/12*4/12)) = 1.58 INFO = 3* 4/12*log((4/12)/(4/12)) = log(1) = 0 H = 3* 4/12*log(1/(4/12)) = 1.58 R = I / H = 1 U = INFO/ H = 0
30
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 30 Information-Theoretic Algorithms Quanta matrix contains only one non-zero column (degenerate case). Similar to the worst case but in fact no interval can have all 0s. p +r =1 (for the First interval) p s+ =4/12 I = 3* 4/12*log((4/12)/(4/12*12/12)) = log(1) = 0 INFO = 3* 4/12*log((12/12)/(4/12)) = 1.58 H = 3* 4/12*log(1/(4/12)) = 1.58 R = I / H = 0 U = INFO / H = 1
31
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 31 Information-Theoretic Algorithms Values of parameters for the three analyzed above cases: ^^ The goal of discretization is to find a partition scheme that a) maximizes the interdependence and b) minimizes the information loss between the class variable and the discretization interval scheme. All introduced measures capture the relationship between the class variable and the attribute values but these two seem to be better: Max of CAIR Min of U
32
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 32 CAIM Algorithm CAIM discretization criterion where: n is the number of intervals r iterates through all intervals, i.e. r = 1, 2,..., n maxr is the maximum value among all qir values (maximum in the rth column of the quanta matrix), i = 1, 2,..., S, M+r is the total number of continuous values of attribute F that are within the interval (dr-1, dr] Quanta matrix: Class Interval Class Total [d 0, d 1 ]…(d r-1, d r ]…(d n-1, d n ] C1:Ci:CSC1:Ci:CS q 11 : q i1 : q S1 ………………………… q 1r : q ir : q Sr ………………………… q 1n : q in : q Sn M 1+ : M i+ : M S+ Interval Total M +1 …M +r …M +n M
33
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 33 CAIM Algorithm CAIM discretization criterion The larger the value of the CAIM ([0, M], where M is # of values of attribute F, the higher the interdependence between the class labels and the intervals The algorithm favors discretization schemes where each interval contains majority of its values grouped within a single class label (the max r values) The squared max r value is scaled by the M+r to eliminate negative influence of the values belonging to other classes, on the class with the maximum number of values, on the entire discretization scheme The sum is divided by the number of intervals (n) to favor discretization schemes with small number of intervals
34
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 34 CAIM Algorithm Given: M examples described by continuous attributes F i, S classes For every F i do: Step1 1.1 find maximum (d n ) and minimum (d o ) values 1.2 sort all distinct values of F i in ascending order and initialize all possible interval boundaries, B, with the minimum, maximum, and the midpoints, for all adjacent pairs 1.3 set the initial discretization scheme to D:{[d o,d n ]}, set variable GlobalCAIM=0 Step2 2.1 initialize k=1 2.2 tentatively add an inner boundary, which is not already in D, from set B, and calculate the corresponding CAIM value 2.3 after all tentative additions have been tried, accept the one with the highest corresponding value of CAIM 2.4 if (CAIM >GlobalCAIM or k<S) then update D with the accepted, in step 2.3, boundary and set the GlobalCAIM=CAIM, otherwise terminate 2.5 set k=k+1 and go to 2.2 Result:Discretization scheme D
35
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 35 CAIM Algorithm Uses greedy top-down approach that finds local maximum values of CAIM. Although the algorithm does not guarantee finding the global maximum of the CAIM criterion it is effective and computationally efficient: O(M log(M)) Starts with a single interval and divides it iteratively using for the division the boundaries that correspond to the highest values of CAIM criterion Assumes that every discretized attribute needs at least the number of intervals that is equal to the number of classes (almost always the case)
36
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 36 raw data (red = Iris-setosa, blue = Iris-versicolor, black = Iris-virginica) Discretization scheme generated by the CAIM algorithm iterationmax CAIM# intervals 1 16.7 1 2 37.5 2 3 46.1 3 4 34.7 4 3 46.1 3 CAIM Algorithm Example
37
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 37 CAIM Algorithm Experiments Comparison with five state-of-the-art discretization algorithms: Equal-Width and Equal Frequency (unsupervised) supervised: Patterson-Niblett, Maximum Entropy, and CADD All algorithms are used to discretize four mixed-mode datasets. Quality of the discretization is evaluated based on the CAIR criterion value, the number of generated intervals, and the time of execution. The discretized datasets are used to generate rules by the CLIP4 algorithm. The accuracy of the rules is compared (for the 6 discretization algorithms) over the four datasets. NOTE: CAIR criterion was used in the CADD algorithm to evaluate class-attribute interdependency
38
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 38 raw data (red = Iris-setosa, blue = Iris-versicolor, black = Iris-virginica) Discretization scheme generated by the Equal Width algorithm Discretization scheme generated by the Equal Frequency algorithm Discretization scheme generated by the Paterson-Niblett algorithm Discretization scheme generated by the Maximum Entropy algorithm Discretization scheme generated by the CADD algorithm Discretization scheme generated by the CAIM algorithm Algorithm#intervalsCAIR value Equal Width 4 0.59 Equal Frequency 4 0.66 Paterson-Niblett 12 0.53 Max. Entropy 4 0.47 CADD 4 0.74 CAIM 3 0.82 CAIM Algorithm Example
39
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 39 CAIM Algorithm Comparison Properties Datasets IrissatthywavionsmoHeapid # of classes36332322 # of examples1506435720036003512855270768 # of training / testing examples 10 x CV # of attributes43621 3413 8 # of continuous attributes 43662132268 CV = cross validation
40
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 40 CAIM Algorithm Comparison CriterionDiscretization Method Dataset irisstdsatstdthystdwavstdionstdsmostdheastdpidstd CAIR mean value through all intervals Equal Width 0.400.010.2400.07100.06800.09800.01100.08700.0580 Equal Frequency 0.410.010.2400.03800.06400.09500.01000.07900.0520 Paterson-Niblett 0.350.010.2100.1440.010.14100.19200.01200.08800.0520 Maximum Entropy 0.300.010.2100.03200.06200.10000.01100.08100.0480 CADD 0.510.010.2600.02600.06800.13000.01500.0980.010.0570 IEM 0.520.010.2200.1410.010.11200.1930.010.00000.1180.020.0790.01 CAIM 0.540.010.2600.1700.010.13000.16800.01000.1380.010.0840 # of intervals Equal Width 16025201260.4863006400220.485601060 Equal Frequency 16025201260.4863006400220.485601060 Paterson-Niblett 4804320450.7925203840170.52480.53620.48 Maximum Entropy 16025201250.5263005726.70220.48560.42970.32 CADD 160.712461.26843.486281.4353610.26220.48550.32960.92 IEM 120.484304.88281.60911.5011317.6920100.48171.27 CAIM 120216018063064060120160
41
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 41 CAIM Algorithm Comparison AlgorithmDiscretization Method Datasets irissatthywavionsmopidhea # std # # # # # # # CLIP4 # rules generated after discretization Equal Width 4.2 0.4 47.9 1.2 7.0 0.0 14.0 0.0 1.1 0.3 20.0 0.0 7.3 0.5 7.0 0.5 Equal Frequency 4.9 0.6 47.4 0.8 7.0 0.0 14.0 0.0 1.9 0.3 19.9 0.3 7.2 0.4 6.1 0.7 Paterson-Niblett 5.2 0.4 42.7 0.8 7.0 0.0 14.0 0.0 2.0 0.0 19.3 0.7 1.4 0.5 7.0 1.1 Maximum Entropy 6.5 0.7 47.1 0.9 7.0 0.0 14.0 0.0 2.1 0.3 19.8 0.6 7.0 0.0 6.0 0.7 CADD 4.4 0.7 45.9 1.5 7.0 0.0 14.0 0.0 2.0 0.0 20.0 0.0 7.1 0.3 6.8 0.6 IEM 4.0 0.5 44.7 0.9 7.0 0.0 14.0 0.0 2.1 0.7 18.9 0.6 3.6 0.5 8.3 0.5 CAIM 3.6 0.5 45.6 0.7 7.0 0.0 14.0 0.0 1.9 0.3 18.5 0.5 1.9 0.3 7.6 0.5 C5.0 Equal Width 6.0 0.0 348.5 18.1 31.8 2.5 69.8 20.3 32.7 2.9 1.0 0.0 249.7 11.4 66.9 5.6 Equal Frequency 4.2 0.6 367.0 14.1 56.4 4.8 56.3 10.6 36.5 6.5 1.0 0.0 303.4 7.8 82.3 0.6 Paterson-Niblett 11.8 0.4 243.4 7.8 15.9 2.3 41.3 8.1 18.2 2.1 1.0 0.0 58.6 3.5 58.0 3.5 Maximum Entropy 6.0 0.0 390.7 21.9 42.0 0.8 63.1 8.5 32.6 2.4 1.0 0.0 306.5 11.6 70.8 8.6 CADD 4.0 0.0 346.6 12.0 35.7 2.9 72.5 15.7 24.6 5.1 1.0 0.0 249.7 15.9 73.2 5.8 IEM 3.2 0.6 466.9 22.0 34.1 3.0 270.1 19.0 12.9 3.0 1.0 0.0 11.5 2.4 16.2 2.0 CAIM 3.2 0.6 332.2 16.1 10.9 1.4 58.2 5.6 7.7 1.3 1.0 0.0 20.0 2.4 31.8 2.9 Built-in 3.8 0.4 287.7 16.6 11.2 1.3 46.2 4.1 11.1 2.0 1.4 1.3 35.0 9.3 33.3 2.5
42
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 42 CAIM Algorithm Features: fast and efficient supervised discretization for any class-labeled data maximizes interdependence between the class labels and the generated discrete intervals generates the smallest number of intervals for a given continuous attribute when used as a preprocessing step for a learning algorithm significantly improves the results in terms of accuracy automatically selects the number of intervals in contrast to many other discretization algorithms its execution time is comparable to the time required by (the simplest) unsupervised discretization algorithms
43
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 43 Initial Discretization Splitting discretization Search starts with only one interval (like in CAIM) - the minimum and the maximum defining the lower and upper boundaries. The optimal interval scheme is found by successively adding candidate boundary points. Merging discretization The search starts with all boundary points (like in 2 ) (all midpoints between two adjacent values) and then some intervals are merged to obtain the optimal interval scheme.
44
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 44 Merging Discretization Methods 2 method Entropy-based method K-means discretization
45
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 45 2 Discretization 2 uses class information so it is a supervised discretization method Interval Boundary Point (BP), divides the feature values, from the range [a, b], into two parts, to the left BP = [a, BP] and to the right BP = (BP, b] To measure the degree of independence between the partition defined by the decision attribute (class) and one defined by the interval BP the 2 is calculated from the quanta matrix: (if q+r or qi+ is zero then Eir is set to 0.1)
46
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 46 2 Discretization If the partitions defined by a decision attribute and by an interval BP are independent for any class then: P (qi+) = P (qi+ | LBP) = P (qi+ | RBP) which means that qir = Eir for any r [1, 2] and i [1,..., C], and 2 = 0.
47
2 Discretization Initially, each distinct value of a feature is considered to be an interval BP 2 test is performed for every pair of adjacent intervals Intervals with the least 2 values are merged as low 2 values indicate similar class distributions © 2007 Cios / Pedrycz / Swiniarski / Kurgan
48
48 2 Discretization 1. Sort m feature values in increasing order 2. Each value forms its own interval 3. Consider two adjacent intervals (columns) T j and T j+1 in quanta matrix and calculate 4. Merge a pair of adjacent intervals (j and j+1) with the smallest value of 2 and that satisfies: where alpha is the confidence interval and (c-1) is the number of degrees of freedom 5. Repeat steps 3 and 4 with (m-1) discretization intervals
49
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 49 2 Discretization
50
SampleFK 111 232 371 481 591 6112 7232 8371 9392 10451 11461 12591 ChiMerge Discretization example after (Kerber, 1992) also (Liu et al., 2002) and (Dougherty at al., 1995) F- feature K- class Sort F in increasing order of its values
51
SampleFK 111 232 371 481 591 6112 7232 8371 9392 10451 11461 12591 {0,2} {2,5} {5,7.5} {7.5,8.5} {8.5,10} {10,17} {17,30} {30,38} {38,42} {42,45.5} {45.5,52} {52,60} Intervals Start with every unique value of F forming its own interval
52
SampleFK 111 232 371 481 591 6112 7232 8371 9392 10451 11461 12591 SampleK=1K=2 3101 4101 total202 SampleK=1K=2 2011 3101 total112 Calculate Chi2 test on every adjacent interval
53
SampleK=1K=2 3101 4101 total202 SampleK=1K=2 2011 3101 total112 E 11 =.5 E 12 =.5 E 21 =.5 E 22 =.5 E 11 = 1 E 12 = 0 E 21 = 1 E 22 = 0 X 2 = (0-.5) 2 /.5 + (1-.5) 2 /.5 + (1-.5) 2 /.5 + (0-.5) 2 /.5 = 2 X 2 = (1-1) 2 /1+(0-0) 2 /0+ (1-1) 2 /1+(0-0) 2 /0 = 0 With alpha =.1 and df=1 from Chi2 distribution table merge if X 2 < 2.7024
54
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 54 Degree of Freedom A robot arm can have 7 degrees of freedom as follows: Shoulder motion is called pitch (up and down) or yaw (left and right) Elbow motion is a pitch Wrist motion can be pitch or yaw Rotation (roll) is possible for both wrist and shoulder
55
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 55 Degree of Freedom The number of independent pieces of information necessary to estimate the parameters of a model. Examples: The sample mean has one degree of freedom. A random vector consisting of n independent observations has n degrees of freedom (as it can lie anywhere in the n-D space).
56
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 56 DF 0.9950.9750.200.100.050.0250.020.010.0050.0020.001 10.00003930.0009821.6422.7063.8415.0245.4126.6357.8799.55010.828 20.01000.05063.2194.6055.9917.3787.8249.21010.59712.42913.816 30.07170.2164.6426.2517.8159.3489.83711.34512.83814.79616.266 40.2070.4845.9897.7799.48811.14311.66813.27714.86016.92418.467 50.4120.8317.2899.23611.07012.83313.38815.08616.75018.90720.515 60.6761.2378.55810.64512.59214.44915.03316.81218.54820.79122.458 70.9891.6909.80312.01714.06716.01316.62218.47520.27822.60124.322 81.3442.18011.03013.36215.50717.53518.16820.09021.95524.35226.124 91.7352.70012.24214.68416.91919.02319.67921.66623.58926.05627.877 102.1563.24713.44215.98718.30720.48321.16123.20925.18827.72229.588
57
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 57 DF 250196.161208.098268.599279.050287.882295.689298.039304.940311.346319.227324.832 300240.663253.912320.397331.789341.395349.874352.425359.906366.844375.369381.425 350285.608300.064372.051384.306394.626403.723406.457414.474421.900431.017437.488 400330.903346.482423.590436.649447.632457.305460.211468.724476.606486.274493.132 450376.483393.118475.035488.849500.456510.670513.736522.717531.026541.212548.432 500422.303439.936526.401540.930553.127563.852567.070576.493585.207595.882603.446 550468.328486.910577.701592.909605.667616.878620.241630.084639.183650.324658.215 600514.529534.019628.943644.800658.094669.769673.270683.516692.982704.568712.771 650560.885581.245680.134696.614710.421722.542726.176736.807746.625758.639767.141 700607.380628.577731.280748.359762.661775.211778.972789.974800.131812.556821.347 750653.997676.003782.386800.043814.822827.785831.670843.029853.514866.336875.404 800700.725723.513833.456851.671866.911880.275884.279895.984906.786919.991929.329 850747.554771.099884.492903.249918.937932.689936.808948.848959.957973.534983.133 900794.475818.756935.499954.782970.904985.032989.2631001.6301013.0361026.9741036.826 950841.480866.477986.4781006.2721022.8161037.3111041.6511054.3341066.0311080.3201090.418 1000888.564914.2571037.4311057.7241074.6791089.5311093.9771106.9691118.9481133.5791143.917
58
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 58 DF
59
SampleFK 111 232 173 184 195 1378 2116 2237 9392 14510 14611 15912 {0,2} {2,5} {5,7.5} {7.5,8.5} {8.5,10} {10,17} {17,30} {30,38} {38,42} {42,45.5} {45.5,52} {52,60} Intervals Chi 2 2 2 0 0 2 0 2 2 2 0 0 Calculate Chi2 values for all adjacent intervals Merge the intervals with the smallest Chi2 values
60
SampleFK 111 232 371 481 591 6112 7232 8371 9392 10451 11461 12591 {0,2} {2,5} {5,10} {10,30} {30,38} {38,42} {42,60} Intervals 2 4 5 3 2 4 Chi 2 Repeat
61
SampleFK 111 232 371 481 591 6112 7232 8371 9392 10451 11461 12591 {0,5} {5,10} {10,30} {30,42} {42,60} Intervals 1.875 5 1.33 1.875 Chi 2 Repeat
62
SampleFK 111 232 173 184 195 6112 7232 8371 9392 10451 11461 12591 {0,5} {5,10} {10,30} {42,60} Intervals 1.875 3.93 Chi 2 Repeat until
63
SampleFK 111 232 371 481 591 6112 7232 8371 9392 10451 11461 12591 {0,10} {10,30} {42,60} Intervals 2.72 3.93 Chi 2 There are no more intervals that satisfy the Chi2 test
64
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 64 Maximum Entropy Discretization Let T be the set of all possible discretization schemes with corresponding quanta matrices The goal of the maximum entropy discretization is to find a t* T such that H(t*) H(t) t T The method ensures discretization with minimum information loss
65
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 65 Maximum Entropy Discretization To avoid the problem of maximizing the total entropy we approximate it by maximizing the marginal entropy, and use the boundary improvement (i.e., successive local perturbation) to maximize the total entropy of the quanta matrix.
66
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 66 Maximum Entropy Discretization Given: Training data set consisting of M examples and C classes For each feature DO: 1. Initial selection of the interval boundaries: a) Calculate heuristic number of intervals = M/(3*C) b) Set the initial boundary so that the sums of the rows for each column in the quanta matrix distribute as evenly as possible to maximize the marginal entropy 2. Local improvement of the interval boundaries a) Boundary adjustments are made in increments of the ordered feature values to both the lower boundary and the upper boundary for each interval b) Accept the new boundary if the total entropy is increased by such an adjustment c) Repeat the above until no improvement can be achieved Result: Interval boundaries for each feature
67
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 67 Maximum Entropy Discretization Example calculations for Petal Width attribute for Iris data [0.02, 0.25] (0.25, 1.25] (1.25, 1.65] (1.65, 2.55] sum Iris-setosa34160050 Iris-versicolor01533250 iris-virginica0044650 sum34313748150 Entropy after phase I: 2.38 [0.02, 0.25] (0.25, 1.35] (1.35, 1.55] (1.55, 2.55] sum Iris-setosa34160050 Iris-versicolor02817550 iris-virginica0034750 sum34442052150 Entropy after phase II: 2.43
68
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 68 Maximum Entropy Discretization Advantages: preserves information about the given data set Disadvantages: hides information about the class-attribute interdependence This discretization leaves the most difficult relationship (class-attribute) to be found by the subsequently used machine learning algorithm.
69
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 69 CAIR Discretization Class-Attribute Interdependence Redundancy Overcomes the problem of ignoring the relationship between the class variable and the attribute values ble It maximizes the interdependence relationship, as measured by CAIR The method is highly combinatoric so a heuristic local optimization method is used
70
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 70 CAIR Discretization STEP 1: Interval Initialization 1.Sort unique values of the attribute in increasing order 2.Calculate number of intervals using the rule of thumb formula 3.Perform maximum entropy discretization on the sorted unique values – initial intervals are obtained 4. The quanta matrix is formed using the initial intervals STEP 2: Interval Improvement 1.Tentatively eliminate each boundary and calculate the CAIR value 2.Accept the new boundaries where CAIR has the largest value 3.Keep updating the boundaries until there is no increase in the value of CAIR
71
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 71 CAIR Discretization STEP 3: Interval Reduction: Redundant (statistically insignificant) intervals are merged. Perform this test for each adjacent interval: where 2 - 2 value at certain significance level specified by the user L - total number of the values in two adjacent intervals H - the entropy for the adjacent intervals; F j – j th feature If the test is significant (true) at certain confidence level (say 1- 0.05) perform test for the next pair of intervals; otherwise, adjacent intervals are merged.
72
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 72 CAIR Discretization Disadvantages: Uses the rule of thumb to select initial boundaries For large number of unique values, large number of initial intervals is searched - computationally expensive Using maximum entropy discretization to initialize the intervals results in the worst initial discretization in terms of class-attribute interdependence The boundary perturbation can be time consuming because the search space can be large, so that the perturbation is difficult to converge 2 test has to be performed and its confidence interval must be specified by the user
73
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 73 Supervised Discretization Other Supervised Algorithms - K-means clustering - One-level Decision Tree - Dynamic Attribute - Paterson and Niblett
74
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 74 K-means Clustering Discretization K-means clustering is an iterative method of finding clusters in multidimensional data; the user must define: –number of clusters for each feature –similarity function –performance index and termination criterion
75
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 75 K-means Clustering Discretization Given: Training data set consisting of M examples, and C classes (must be known), user-defined number of intervals nFi for feature Fi 1. For class cj do ( j = 1,..., C ) 2. Choose K = nFi as the initial number of cluster centers. Initially the first K values of the feature can be selected as the cluster centers. 3. Distribute the values of the feature among the K cluster centers, based on the minimal distance criterion. As the result, feature values will cluster around the updated K cluster centers. 4. Compute K new cluster centers such that for each cluster the sum of the squared distances from all points in the same cluster to the new cluster center is minimized 5. Check if the updated K cluster centers are the same as the previous ones, if yes go to step 1; otherwise go to step 3 Result: Interval boundaries for a single feature
76
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 76 K-means Clustering Discretization Example: cluster centers interval’s boundaries (min value, 5 midpoints, max value)
77
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 77 K-means Clustering Discretization The clustering must be done for all attribute values for each class separately. The final boundaries for this attribute will be all of the boundaries for all the classes. Specifying the number of clusters is the most significant factor influencing the result of discretization: to select the proper number of clusters, we may cluster the attribute into several different numbers of intervals, and then calculate some measure of goodness of clustering to choose the most “correct” number of clusters
78
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 78 One-level Decision Tree Discretization One-Rule Discretizer (1RD) Algorithm by Holte (1993) Divides feature F i range into a number of intervals, under the constraint that each interval must include at least the user- specified number of values Starts with initial partition into some intervals, each containing the minimum number of values (like 5) Then moves initial partition boundaries, by adding a feature value, so that the interval contains a strong majority of values from one class
79
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 79 One-level Decision Tree Discretization Example: discretizes using only one feature (x1 or x2) a b x 1 x 2 x 1 x 2
80
One-level Decision Tree Discretization Sort feature values in an ascending order Divide into intervals Each interval should contain at least a given minimum of values Increase the boundary by adding a feature value so that the interval contains a strong majority of values from one class
81
One-level Decision Tree Discretization Merge consecutive intervals if they have the same majority class The feature Temp is thus divided into two intervals [64, 77.5] and (77.5, 85]
82
One-level decision tree A tree is built based on the found intervals for feature Temp Temp Yes No [64,77.5] (77.5,85]
83
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 83 Dynamic Discretization
84
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 84 Dynamic Discretization IF x1= 1 AND x2= I THEN class = MINUS (covers 10 minuses) IF x1= 2 AND x2= IITHEN class = PLUS (covers 10 pluses) IF x1= 2 AND x2= IIITHEN class = MINUS (covers 5 minuses) IF x1= 2 AND x2= ITHEN class = MINUS MAJORITY CLASS (covers 3 minuses & 2 pluses) IF x1= 1 AND x2= IITHEN class = PLUS MAJORITY CLASS (covers 2 pluses & 1 minus)
85
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 85 Dynamic Discretization IF x2= ITHEN class = MINUS MAJORITY CLASS (covers 10 minuses & 2 pluses) IF x2= IITHEN class = PLUS MAJORITY CLASS (covers 10 pluses & 1 minus) IF x2= IIITHEN class = MINUS (covers 5 minuses)
86
© 2007 Cios / Pedrycz / Swiniarski / Kurgan 86 References Cios, K.J., Pedrycz, W. and Swiniarski, R. 1998. Data Mining Methods for Knowledge Discovery. Kluwer Kurgan, L. and Cios, K.J. (2002). CAIM Discretization Algorithm, IEEE Transactions of Knowledge and Data Engineering, 16(2): 145-153 Ching J.Y., Wong A.K.C. & Chan K.C.C. (1995). Class-Dependent Discretization for Inductive Learning from Continuous and Mixed Mode Data, IEEE Transactions on Pattern Analysis and Machine Intelligence, v.17, no.7, pp. 641-651 Gama J., Torgo L. and Soares C. (1998). Dynamic Discretization of Continuous Attributes. Progress in Artificial Intelligence, IBERAMIA 98, Lecture Notes in Computer Science, Volume 1484/1998, 466, DOI: 10.1007/3-540-49795- 1_14
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.