• Nie Znaleziono Wyników

RSDM5

N/A
N/A
Protected

Academic year: 2021

Share "RSDM5"

Copied!
34
0
0

Pełen tekst

(1)

Decision tree

Hung Son Nguyen

Institute of Mathematics, Warsaw University

February 15, 2006

(2)

Outline

1 Conflict measure 2 MD-heuristics

3 Searching for binary partition of symbolic values 4 Searching for cuts on numeric attributes

5 Searching for best cuts

Divide and Conquer Technique Example

Discernibility measure:

6 Soft cuts and soft DT

(3)

Test functions

1 Attribute-based tests: ta(u) = a(u);

2 Value-based tests: ta=v(u) = ( 1 if a(u) = v 0 otherwise; 3 Cut-based tests: ta>c(u) = ( 1 if a(u) > c 0 otherwise;

4 Value set based tests:

ta∈S(u) = ( 1 if a(u) ∈ S 0 otherwise; 5 Hyperplane-based tests: tw1a1+...+wkak>w0(u) = ( 1 if w1a1(u) + ... + wkak(u) > w0 0 otherwise;

(4)

Issues of decision tree induction methods

Determine a collection of test functions; T = {t1, t2, ..., tm}

Estimation measure for tests;

F : T × P(U ) → R Search algorithm: e.g., top-down

(5)

Outline

1 Conflict measure 2 MD-heuristics

3 Searching for binary partition of symbolic values

4 Searching for cuts on numeric attributes

5 Searching for best cuts

Divide and Conquer Technique Example

Discernibility measure:

6 Soft cuts and soft DT Soft Decision Tree

(6)

Conflict and discernibility measure

A conflict measure can be defined by

conf lict(X) =X

i<j

ninj

where (n1, ..., nd) is the counting table of X, i.e.,

ni = |{x ∈ X : dec(x) = i}|

If a test t determines a partition of a set of objects X into X1, X2, ..., Xnt, then discernibility measure for t is defined by

Disc(t, X) = conf lict(X) −

nt

X

i=1

(7)

Example

-b b b b b b b b b r r r r r r c1 l1= 4 l2= 1 r1= 5 r2= 5 Disc(c1) = 25 -b b b b b b b b b r r r r r r c2 l1= 8 l2= 1 r1= 1 r2= 5 Disc(c2) = 41

(8)

Test functions in MD-heuristics

MD algorithm is using two kinds of tests depending on attribute types.

For symbolic attributes aj ∈ A, test functions defined by sets of

values, i.e.,

taj∈V (u) = 1 ⇐⇒ [aj(u) ∈ V ]

where V ⊂ Vaj, are considered.

For numeric attributes ai∈ A, only test functions defined by cuts:

tai>c(u) = T rue ⇐⇒ [ai(u) ≤ c] ⇐⇒ [ai(u) ∈ (−∞; ci)]

(9)

MD algorithm

1: Initialize a decision tree T with one node labeled by the set of all objects U ;

2: Q := [T]; {Initialize a FIFO queue Q containing T}

3: while Q is not empty do

4: N := Q.head(); {Get the first element of the queue}

5: X := N.Label;

6: if the major class of X is large enough then

7: N.Label := major class(X);

8: else

9: t := ChooseBestT est(X);

{Search for best test of form ta∈V for V ⊂ Va with respect to

Disc(., X)}

10: N.Label := t;

11: Create two successors of the current node NL and NR and label them

by XL and XR, where

XL= {u ∈ X : t(u) = 0} XR= {u ∈ X : t(u) = 1}

12: Q.insert(NL, NR);{Insert NL and NR into Q}

13: end if

14: end while

(10)

Discernibility

(11)

Properties of MD-heuristics

X t 0 1 XL XR (r1, ..., rd) (n1, ..., nd) (l1, ..., ld) N = n1+ ... + nd L = l1+ ... + ld R = r1+ ... + rd Disc(t, X) = LR − d X i=1 liri Disc(t, X) = d X i=1 li d X i=1 ri− d X i=1 liri Disc(t, X) =X i6=j lirj

(12)

Disc(t, X) = conf lict(X) − conf lict(X1) − conf lict(X2) = 1 2 X i6=j ninj− 1 2 X i6=j lilj− 1 2 X i6=j rirj = 1 2 N 2 d X i=1 n2i ! −1 2 L 2 d X i=1 l2i ! −1 2 R 2 d X i=1 ri2 ! = 1 2 N 2− L2− R2 − 1 2 d X i=1 (n2i − l2i − r2i) = 1 2(L + R) 2− L2− R2 − 1 2 d X i=1 [(li+ ri)2− l2i − r2i] = LR − d X i=1 liri

(13)

Outline

1 Conflict measure

2 MD-heuristics

3 Searching for binary partition of symbolic values

4 Searching for cuts on numeric attributes

5 Searching for best cuts

Divide and Conquer Technique Example

Discernibility measure:

6 Soft cuts and soft DT Soft Decision Tree

(14)

Problem

For a fixed attribute a and an object set X ⊂ U , we define the discernibility degree of a partition P = (V1, V2) as follows

Disca(P |X) = Disc(ta∈V1, X)

= {(x, y) ∈ X2 : x, y are discerned by P }

MD-Partition:

input: A set of objects X and an symbolic attribute a.

output: A binary partition P of Vasuch that Disca(P |X) is

(15)

Let s(vi) = (n1(vi), n2(vi), ..., nd(vi)) denote the counting table of the set

Xvi = {x ∈ X : a(x) = vi}. The distance between two symbolic values

v, w ∈ Va is determined as follows:

δdisc(v, w) = Disc(v, w) =

X

i6=j

ni(v) · nj(w)

One can generalize the definition of distance function by δdisc(V1, V2) =

X

v∈V1,w∈V2

δdisc(v, w)

For arbitrary sets of values V1, V2, V3

δdisc(V1∪ V2, V3) = δdisc(V1, V3) + δdisc(V2, V3) (1)

δdisc(V1, V2) = δdisc(V2, V1) (2)

(16)

Example

A a b dec u1 a1 b1 1 u2 a1 b2 1 u3 a2 b3 1 u4 a3 b1 1 u5 a1 b4 2 u6 a2 b2 2 u7 a2 b1 2 u8 a4 b2 2 u9 a3 b4 2 u10 a2 b5 2 dec = 1 dec = 2 a1 2 1 a2 1 3 a3 1 1 a4 0 1 dec = 1 dec = 2 b1 2 1 b2 1 2 b3 1 0 b4 0 2 b5 0 1 s s s s @ @ @ @ @ s s s s s a1 a3 a2 a4 b5 b1 b2 b3 b4 7 1 3 1 2 4 L L L LL H H H HH            Q Q Q Q Q QQ B B B B B B B        0 2 4 2 5 1 2 1 1 2 a b

(17)

Heuristics

We have proposed the following heuristics for MD-Partition problem:

1 grouping by minimizing conflict: a kind of agglomerative hierarchical

clustering algorithm

2 grouping by maximizing discernibility.

(18)

grouping by minimizing conflict

s s s s @ @ @ @ @ a1 a3 a2 a4 7 1 3 2 4 1 s s s @ @ @ @ @ ? a1 a3 a2 {a2, a4} 5 3 9 s s ? a1 {a1, a3} 14 {a2, a4} s s s s s b5 b1 b2 b3 b4 L L L L H H H H           Q Q Q Q Q Q B B B B B B       0 2 4 2 5 1 2 1 1 2 s s s s @ @ @ @ @ b1 {b4, b5} b2 b3 5 3 6 1 3 2 s s {b2, b4, b5} {b1, b3} 16 . . .

(19)

grouping by maximizing discernibility

s s s s @ @ @ @ @ a1 a3 a2 a4 7 1 3 2 4 1 s s s s 6 6 7 a1 a3 a2 a4 1 3 s s {a1, a3} {a2, a4} 14

(20)

Outline

1 Conflict measure

2 MD-heuristics

3 Searching for binary partition of symbolic values 4 Searching for cuts on numeric attributes

5 Searching for best cuts

Divide and Conquer Technique Example

Discernibility measure:

6 Soft cuts and soft DT Soft Decision Tree

(21)

Let us consider two cuts cL< cR on attribute a.

Lemma

The following equation holds:

Disc(cR) − Disc(cL) = d X i=1  (Ri− Li) X j6=i Mj   (3)

where (L1, ..., Ld), (M1, ..., Md) and (R1, ..., Rd) are the counting tables

of intervals (−∞; cL), [cL; cR) and [cR; ∞), respectively (see Figure ??).

cL cR

L1 L2... Ld M M1 2...Md R1R2...Rd

(22)

Boundary cuts

Definition

The cut ci∈ Ca, where 1 < i < N , is called the boundary cut if there

exist at least two such objects u1, u2∈ U that a(u1) ∈ [ci−1, ci),

a(u2) ∈ [ci, ci+1) and dec(u1) 6= dec(u2).

Theorem

The cut cBest maximizing the function Disc(a, c) can be found among

(23)

Tail cuts

Definition

By a median of the kth decision class we mean a cut c ∈ Ca which

minimizing the value |Lk− Rk|. The median of the kth decision class will

be denoted by M edian(k).

Let c1 < c2... < cN be the set of consecutive candidate cuts, and let

cmin = min

i {M edian(i)} and cmax= maxi {M edian(i)}

Then we have the following theorem:

Theorem

The quality function Disc : {c1, ..., cN} → N defined over the set of cuts

is increasing in {c1, ..., cmin} and decreasing in {cmax, ..., cN}. Hence

cBest∈ {cmin, ..., cmax}

(24)

Properties of MD-heuristics

Theorem

In case of decision tables with two decision classes, any single cut ci,

which is a local maximum of the function Disc, resolves more than half of conflicts in the decision table, i.e.

Disc (ci) ≥

1

2· conflict (S)

Theorem

In case of decision table with two decision classes and n objects, the height of the MD decision tree using hyperplanes is not larger than 2 log n − 1.

(25)

Outline

1 Conflict measure

2 MD-heuristics

3 Searching for binary partition of symbolic values

4 Searching for cuts on numeric attributes 5 Searching for best cuts

Divide and Conquer Technique Example

Discernibility measure:

6 Soft cuts and soft DT Soft Decision Tree

(26)

The algorithm outline:

1. Divide the set of possible cuts into k intervals 2. Chose the interval to which the best cut may belong

with the highest probability.

3. If the considered interval is not STABLE enough then Go to Step 1

4. Return the current interval as a result.

The number of SQL queries is O(d · k logkn) and is minimum for

k = 3;

How to define the measure evaluating the quality of the interval [cL; cR]?

(27)
(28)
(29)

We construct estimation measures for intervals in four cases:

Discernibility measure Entropy Measure

Independency as-sumption ? ? Dependency assumption ? ?

Under dependency assumption, i.e. x1 M1 ' x2 M2 ' ... ' xd Md ' x1+ ... + xd M1+ ... + Md = x M =: t ∈ [0, 1]

discernibility measure for [cL; cR] can be estimated by:

W (cL) + W (cR) + conf lict(cL; cR)

2 +

[W (cR) − W (cL)]2

conf lict(cL; xR)

(30)

Under dependency assumption, i.e. x1, ..., xd are independent random

variables with uniform distribution over sets {0, ..., M1}, ..., {0, ..., Md},

respectively.

The mean E(W (c)) for any cut c ∈ [cL; cR] satisfies

E(W (c)) =W (cL) + W (cR) + conf lict(cL; cR) 2

and for the standard deviation of W (c) we have

D2(W (c)) = n X i=1   Mi(Mi+ 2) 12   X j6=i (Rj− Lj)   2 

One can construct the measure estimating quality of the best cut in [cL; cR] by

(31)

Outline

1 Conflict measure

2 MD-heuristics

3 Searching for binary partition of symbolic values

4 Searching for cuts on numeric attributes

5 Searching for best cuts

Divide and Conquer Technique Example

Discernibility measure: 6 Soft cuts and soft DT

Soft Decision Tree

(32)

A soft cut is any triple p = ha, l, ri, where a ∈ A is an attribute,

l, r ∈ < are called the left and right bounds of p ; the value ε = r−l2 is called the uncertain radius of p.

We say that a soft cut p discerns a pair of objects x1, x2 if a (x1) < l

and a (x2) > r.

-l r a

The intuitive meaning of p = ha, l, ri:

there is a real cut somewhere between l and r.

for any value v ∈ [l, r] we are not able to check if v is either on the left side or on the right side of the real cut.

[l, r] is an uncertain interval of the soft cut p. normal cut can be treated as soft cut of radius 0.

(33)

The test functions can be defined by soft cuts

Here we propose two strategies using described above soft cuts:

fuzzy decision tree: any new object u can be classified as follows:

For every internal node, compute the probability that u turns left and u turns right;

For every leave L compute the probability that u is reaching L; The decision for u is equal to decision labeling the leaf with largest probability.

rough decision tree: in case of uncertainty

Use both left and right subtrees to classify the new object; Put together their answer and return the answer vector; Vote for the best decision class.

(34)

Searching for soft cuts

STANDARD ALGORITHM FOR BEST CUT

For a given attribute a and a set of candidate cuts {c1, ..., cN}, the

best cut (a, ci) with respect to given heuristic measure

F : {c1, ..., cN} → R+

can be founded in time Ω(N ).

The minimal number of simple SQL queries of form SELECT COUNT

FROM datatable

WHERE (a BETWEEN cLAND cR) GROUPED BY d.

necessary to find out the best cut is Ω(dN ) OUR PROPOSITIONS FOR SOFT CUTS

Tail cuts can be eliminated Divide and Conquer Technique

Cytaty

Powiązane dokumenty

Faculty of Mathematics and Information Science Warsaw University of Technology 00-662 Warszawa

In 1969 Fried and MacRae [7] gave an algebraic proof valid for an arbitrary field K under the assumption that ∂f 6≡ 0 mod char K, reducing the theorem to the Jordan–H¨ older

By an F H k -coloring of a graph we mean a partition of its edges into a forest F and a graph H of maximum degree at most k, i.e., a coloring of the edge set of the graph with

Next, we replace the translations by the free generators with a free family of operators and prove inequalities of the same type.. It was shown

In the more easterly part of trench W1-5, the remains of walls were found attached to the eastern face of building W1-B, likely from the Early Islamic period.. This newer structure

Oleszkiewicz, Institute of Mathematics, University of Warsaw, Banacha 2, 02-097 Warszawa,

1 We choose the attribute with the greatest information gain (the greatest reduction in entropy), which becomes the root of the decision tree.. 2 For each value of the

1 (for practical purposes, the Earth can be taken as a perfect sphere) we will define a plane tangent to the surface of the Earth at a latitude φ, and then use a Cartesian