SlideShare ist ein Scribd-Unternehmen logo
1 von 56
Data Mining in
Artificial Intelligence:
Decision Trees
Outline
 Introduction: Data Flood
 Top-Down Decision Tree Construction
 Choosing the Splitting Attribute
 Information Gain and Gain Ratio
 Pruning

2
Trends leading to Data Flood
 More data is generated:
 Bank, telecom, other
business transactions ...
 Scientific Data: astronomy,
biology, etc
 Web, text, and e-commerce

3
Data Growth
 Large DB examples as of 2003:
 France Telecom has largest decision-support DB,
~30TB; AT&T ~ 26 TB
 Alexa internet archive: 7 years of data, 500 TB
 Google searches 3.3 Billion pages, ? TB

 Twice as much information was created in 2002
as in 1999 (~30% growth rate)
 Knowledge Discovery is NEEDED to make
sense and use of data.
4
Machine Learning / Data Mining
Application areas
 Science
 astronomy, bioinformatics, drug discovery, …

 Business
 advertising, CRM (Customer Relationship management),
investments, manufacturing, sports/entertainment, telecom, eCommerce, targeted marketing, health care, …

 Web:
 search engines, bots, …

 Government
 law enforcement, profiling tax cheaters, anti-terror(?)
5
Assessing Credit Risk: Example
 Situation: Person applies for a loan
 Task: Should a bank approve the loan?
 Note: People who have the best credit don’t need
the loans, and people with worst credit are not
likely to repay. Bank’s best customers are in the
middle

6
Credit Risk - Results
 Banks develop credit models using variety of
machine learning methods.
 Mortgage and credit card proliferation are the
results of being able to successfully predict if a
person is likely to default on a loan
 Widely deployed in many countries

7
DNA Microarrays – Example
Given microarray data for a number of samples
(patients), can we
 Accurately diagnose the disease?
 Predict outcome for given treatment?
 Recommend best treatment?

8
Example: ALL/AML Leukemia data
 38 training cases, 34 test, ~ 7,000 genes
 2 Classes: Acute Lymphoblastic Leukemia (ALL)
vs Acute Myeloid Leukemia (AML)
 Use train data to build diagnostic model
ALL

AML

Results on test data better than human expert
33/34 correct (1 error may be mislabeled)
9
Related Fields
Machine
Learning

Visualization

Data Mining and
Knowledge Discovery

Statistics

Databases

10
Knowledge Discovery Process
flow, according to CRISP-DM

see
www.crisp-dm.org
for more
information

Monitoring

11
Major Data Mining Tasks
 Classification: predicting an item class
 Clustering: finding clusters in data
 Associations: e.g. A & B & C occur
frequently

 Visualization: to facilitate human discovery
 …

12
Data Mining Tasks: Classification
Learn a method for predicting the instance class
from pre-labeled (classified) instances
Many approaches:
Statistics,
Decision Trees,
Neural Networks,
...

13
DECISION TREE
 An internal node is a test on an attribute.
 A branch represents an outcome of the test, e.g.,
Color=red.
 A leaf node represents a class label or class
label distribution.
 At each node, one attribute is chosen to split
training examples into distinct classes as much
as possible
 A new case is classified by following a matching
path to a leaf node.
14
Weather Data: Play or not Play?
Outlook

Temperature

Humidity

Windy

Play?

sunny

hot

high

false

No

sunny

hot

high

true

No

overcast

hot

high

false

Yes

rain

mild

high

false

Yes

rain

cool

normal

false

Yes

rain

cool

normal

true

No

overcast

cool

normal

true

Yes

sunny

mild

high

false

No

sunny

cool

normal

false

Yes

rain

mild

normal

false

Yes

sunny

mild

normal

true

Yes

overcast

mild

high

true

Yes

overcast

hot

normal

false

Yes

rain

mild

high

true

No

15

Note:
Outlook is the
Forecast,
no relation to
Microsoft
email program
Example Tree for “Play?”
Outlook
sunny

overcast

Humidity

Yes

rain

Windy

high

normal

true

false

No

Yes

No

Yes

16
Building Decision Tree [Q93]
 Top-down tree construction
 At start, all training examples are at the root.
 Partition the examples recursively by choosing one
attribute each time.

 Bottom-up tree pruning
 Remove subtrees or branches, in a bottom-up
manner, to improve the estimated accuracy on new
cases.

17
Choosing the Splitting Attribute
 At each node, available attributes are evaluated
on the basis of separating the classes of the
training examples. A Goodness function is used
for this purpose.
 Typical goodness functions:
 information gain (ID3/C4.5)
 information gain ratio
 gini index

18
Which attribute to select?

19
A criterion for attribute selection
 Which is the best attribute?
 The one which will result in the smallest tree
 Heuristic: choose the attribute that produces the
“purest” nodes

 Popular impurity criterion: information gain
 Information gain increases with the average purity of
the subsets that an attribute produces

 Strategy: choose attribute that results in greatest
information gain
20
Computing information
 Information is measured in bits
 Given a probability distribution, the info required to
predict an event is the distribution’s entropy
 Entropy gives the information required in bits (this can
involve fractions of bits!)

21
Entropy
 Formula for computing the entropy:
entropy( p1 , p2 ,, pn ) = − p1logp1 − p2 logp2  − pn logpn

22
Example: fair coin throw
 P (head) = 0.5
 P (tail) = 0.5

entropy(0.5,0.5) =

− 0.5 log2 (0.5) − 0.5 log2 (0.5) =

− 0.5 * −1 * 2 = 1 bit
23
Example: biased coin throw

P(head)

0.5

0.25

0.1

0

P(tail)

0.5

0.75

0.9

1

Entropy

1 0.811 0.469 0.000

24
Entropy of a split
 Information in a split with x items of one class, y
items of the second class

x
y
info([x, y]) = entropy(
,
)
x+y x+y
x
x
y
y
=−
log(
)−
log(
)
x+ y
x+ y
x+ y
x+ y

25
Example: attribute “Outlook”
 “Outlook” = “Sunny”: 2 and 3
split
2
2 3
3
info([2,3]) = entropy(2/5,3/5) = − log( ) − log( ) = 0.971 bits
5
5 5
5

26
Outlook = Overcast
 “Outlook” = “Overcast”: 4/0 split
Note: log(0) is
info([4,0]) = entropy(1,0) = −1log(1) − 0 log(0) = 0 bits not defined, but
we evaluate
0*log(0) as zero

27
Outlook = Rainy
 “Outlook” = “Rainy”:

3
3 2
2
info([3,2]) = entropy(3/5,2/5) = − log( ) − log( ) = 0.971 bits
5
5 5
5

28
Expected Information
Expected information for attribute:
info([3,2], [4,0],[3,2]) = (5 / 14) × 0.971 + (4 / 14) × 0 + (5 / 14) × 0.971
= 0.693 bits

29
Computing the information gain
 Information gain:
(information before split) – (information after split)
gain(" Outlook" ) = info([9,5]) - info([2,3], [4,0], [3,2]) = 0.940 - 0.693
= 0.247 bits

 Information gain for attributes from weather data:
gain(" Outlook" ) = 0.247 bits
gain(" Temperature" ) = 0.029 bits
gain(" Humidity") = 0.152 bits
gain(" Windy") = 0.048 bits
30
Continuing to split

gain(" Temperature" ) = 0.571 bits

gain(" Humidity") = 0.971 bits

gain(" Windy") = 0.020 bits
31
The final decision tree

 Note: not all leaves need to be pure; sometimes
identical instances have different classes
⇒ Splitting stops when data can’t be split any further
32
Highly-branching attributes
 Problematic: attributes with a large number of
values (extreme case: ID code)
 Subsets are more likely to be pure if there is a
large number of values
⇒Information gain is biased towards choosing attributes
with a large number of values
⇒This may result in overfitting (selection of an attribute
that is non-optimal for prediction)

33
Weather Data with ID code
ID

Outlook

Temperature

Humidity

Windy

Play?

A

sunny

hot

high

false

No

B

sunny

hot

high

true

No

C

overcast

hot

high

false

Yes

D

rain

mild

high

false

Yes

E

rain

cool

normal

false

Yes

F

rain

cool

normal

true

No

G

overcast

cool

normal

true

Yes

H

sunny

mild

high

false

No

I

sunny

cool

normal

false

Yes

J

rain

mild

normal

false

Yes

K

sunny

mild

normal

true

Yes

L

overcast

mild

high

true

Yes

M

overcast

hot

normal

false

Yes

N

rain

mild

high

true

No

34
Split for ID Code Attribute

Entropy of split = 0 (since each leaf node is “pure”, having only
one case.
Information gain is maximal for ID code
35
Gain ratio
 Gain ratio: a modification of the information gain
that reduces its bias on high-branch attributes
 Gain ratio should be
 Large when data is evenly spread
 Small when all data belong to one branch

 Gain ratio takes number and size of branches
into account when choosing an attribute
 It corrects the information gain by taking the intrinsic
information of a split into account (i.e. how much info
do we need to tell which branch an instance belongs
to)
36
Gain Ratio and Intrinsic Info.
 Intrinsic information: entropy of distribution of
instances into branches

|S |
|S |
IntrinsicInfo(S , A) ≡ −∑ i log i .
|S| 2 | S |
 Gain ratio (Quinlan’86) normalizes info gain by:

GainRatio(S , A) =

37

Gain(S , A)
.
IntrinsicInfo(S , A)
Gain ratios for weather data
Outlook

Temperature

Info:

0.693

Info:

0.911

Gain: 0.940-0.693

0.247

Gain: 0.940-0.911

0.029

Split info: info([5,4,5])

1.577

Split info: info([4,6,4])

1.362

Gain ratio: 0.247/1.577

0.156

Gain ratio: 0.029/1.362

0.021

Humidity

Windy

Info:

0.788

Info:

0.892

Gain: 0.940-0.788

0.152

Gain: 0.940-0.892

0.048

Split info: info([7,7])

1.000

Split info: info([8,6])

0.985

Gain ratio: 0.152/1

0.152

Gain ratio: 0.048/0.985

0.049

38
Industrial-strength algorithms


For an algorithm to be useful in a wide range of realworld applications it must:



Allow missing values



Be robust in the presence of noise





Permit numeric attributes

Be able to approximate arbitrary concept descriptions (at least
in principle)

Basic schemes need to be extended to fulfill these
requirements

42
Numeric attributes


Standard method: binary splits


E.g. temp < 45



Unlike nominal attributes,
every attribute has many possible split points



Solution is straightforward extension:



Choose “best” split point





Evaluate info gain (or other measure)
for every possible split point of attribute
Info gain for best split point is info gain for attribute

Computationally more demanding
43
Weather data - numeric
Outlook

Temperature

Humidity

Windy

Play

Sunny

85

85

False

No

Sunny

80

90

True

No

Overcast

83

86

False

Yes

Rainy

75

80

False

Yes

…

…

…

…

…

If outlook = sunny and humidity > 83 then play = no
If outlook = rainy and windy = true then play = no
If outlook = overcast then play = yes
If humidity < 85 then play = yes
If none of the above then play = yes

44
Example


Split on temperature attribute:
64

65

68

69

Yes

No

Yes Yes

70
Yes

71
No

72
No

72

75

Yes Yes

75

80

Yes



No

83
Yes

E.g. temperature < 71.5: yes/4, no/2
temperature ≥ 71.5: yes/5, no/3



81

Info([4,2],[5,3])
= 6/14 info([4,2]) + 8/14 info([5,3])
= 0.939 bits



Place split points halfway between values



Can evaluate all split points in one pass!
45

85
Yes No
Speeding up
 Entropy only needs to be evaluated between points
of different classes (Fayyad & Irani, 1992)
value 64
class Yes

65

68

69

No

Yes Yes

70
Yes

71
No

72
No

72

75

Yes Yes

X

75

80

Yes

81
No

83
Yes

85
Yes No

Potential optimal breakpoints
Breakpoints between values of the same class cannot
be optimal

46
Missing values
 Missing value denoted “?” in C4.X
 Simple idea: treat missing as a separate value
 Q: When this is not appropriate?
 When values are missing due to different reasons
 Example: field IsPregnant=missing for a male patient
should be treated differently (no) than for a female
patient of age 25 (unknown)

47
Missing values - advanced
Split instances with missing values into pieces





A piece going down a branch receives a weight
proportional to the popularity of the branch
weights sum to 1

Info gain works with fractional instances




use sums of weights instead of counts

During classification, split the instance into pieces
in the same way


Merge probability distribution using weights

48
Pruning


Goal: Prevent overfitting to noise in the
data



Two strategies for “pruning” the decision
tree:
 Postpruning - take a fully-grown decision tree
and discard unreliable parts
 Prepruning - stop growing a branch when
information becomes unreliable



Postpruning preferred in practice—
prepruning can “stop too early”
49
Prepruning


Based on statistical significance test


Stop growing the tree when there is no statistically significant
association between any attribute and the class at a particular
node



Most popular test: chi-squared test



ID3 used chi-squared test in addition to information gain


Only statistically significant attributes were allowed to be
selected by information gain procedure

50
b

class

1

0

0

0

2

0

1

1

3

1

0

1

4

Early stopping

a

1

1

0



Pre-pruning may stop the growth process
prematurely: early stopping



Classic example: XOR/Parity-problem


No individual attribute exhibits any significant
association to the class



Structure is only visible in fully expanded tree



Pre-pruning won’t expand the root node



But: XOR-type problems rare in practice



And: pre-pruning faster than post-pruning
51
Post-pruning


First, build full tree



Then, prune it


Fully-grown tree shows all attribute interactions



Problem: some subtrees might be due to chance effects



Two pruning operations:
1.
2.



Subtree replacement
Subtree raising

Possible strategies:


error estimation



significance testing



MDL principle

52
Subtree replacement


Bottom-up



Consider replacing a tree
only after considering all
its subtrees



Ex: labor negotiations

53
Subtree replacement, 2

54
Subtree replacement, 3

55
Estimating error rates


Prune only if it reduces the estimated error



Error on the training data is NOT a useful estimator
Q: Why?

A: it would result in very little pruning, because
decision tree was built on the same training data



Use hold-out set for pruning
(“reduced-error pruning”)



C4.5’s method


Derive confidence interval from training data



Use a heuristic limit, derived from this, for pruning



Shaky statistical assumptions (based on training data)



Seems to work OK in practice
56
From trees to rules
 Simple way: one rule for each leaf
 C4.5rules: greedily prune conditions from each rule
if this reduces its estimated error
 Can produce duplicate rules
 Check for this at the end

 Then
 look at each class in turn
 consider the rules for that class
 find a “good” subset (guided by MDL)

 Then rank the subsets to avoid conflicts
 Finally, remove rules (greedily) if this decreases
error on the training data
57
WEKA – Machine Learning
and Data Mining Workbench
J4.8 – Java implementation
of C4.8
Many more decision-tree and
other machine learning methods

58
Summary
 Decision Trees
 splits – binary, multi-way
 split criteria – information gain, gain ratio
 missing value treatment
 pruning
 rule extraction from trees

59

Weitere ähnliche Inhalte

Ähnlich wie Data-Mining

unit 5 decision tree2.pptx
unit 5 decision tree2.pptxunit 5 decision tree2.pptx
unit 5 decision tree2.pptxssuser5c580e1
 
Machine learning
Machine learningMachine learning
Machine learningRohit Kumar
 
Lecture 4 Decision Trees (2): Entropy, Information Gain, Gain Ratio
Lecture 4 Decision Trees (2): Entropy, Information Gain, Gain RatioLecture 4 Decision Trees (2): Entropy, Information Gain, Gain Ratio
Lecture 4 Decision Trees (2): Entropy, Information Gain, Gain RatioMarina Santini
 
Privacy-preserving Information Sharing: Tools and Applications
Privacy-preserving Information Sharing: Tools and ApplicationsPrivacy-preserving Information Sharing: Tools and Applications
Privacy-preserving Information Sharing: Tools and ApplicationsEmiliano De Cristofaro
 
Learning
LearningLearning
Learningbutest
 
Machine learning 101
Machine learning 101Machine learning 101
Machine learning 101AmmarChalifah
 
introduction to machin learning
introduction to machin learningintroduction to machin learning
introduction to machin learningnilimapatel6
 
Classification (ML).ppt
Classification (ML).pptClassification (ML).ppt
Classification (ML).pptrajasamal1999
 
Ml study notes id3
Ml study notes   id3Ml study notes   id3
Ml study notes id3Feri Handoyo
 
CLASSIFIER SELECTION MODELS FOR INTRUSION DETECTION SYSTEM (IDS)
CLASSIFIER SELECTION MODELS FOR INTRUSION DETECTION SYSTEM (IDS)CLASSIFIER SELECTION MODELS FOR INTRUSION DETECTION SYSTEM (IDS)
CLASSIFIER SELECTION MODELS FOR INTRUSION DETECTION SYSTEM (IDS)ieijjournal1
 
Big Data & Machine Learning - TDC2013 São Paulo - 12/0713
Big Data & Machine Learning - TDC2013 São Paulo - 12/0713Big Data & Machine Learning - TDC2013 São Paulo - 12/0713
Big Data & Machine Learning - TDC2013 São Paulo - 12/0713Mathieu DESPRIEE
 
Big Data & Machine Learning - TDC2013 Sao Paulo
Big Data & Machine Learning - TDC2013 Sao PauloBig Data & Machine Learning - TDC2013 Sao Paulo
Big Data & Machine Learning - TDC2013 Sao PauloOCTO Technology
 
Data Mining Concepts 15061
Data Mining Concepts 15061Data Mining Concepts 15061
Data Mining Concepts 15061badirh
 
Data Mining Concepts
Data Mining ConceptsData Mining Concepts
Data Mining Conceptsdataminers.ir
 

Ähnlich wie Data-Mining (20)

unit 5 decision tree2.pptx
unit 5 decision tree2.pptxunit 5 decision tree2.pptx
unit 5 decision tree2.pptx
 
Decision tree
Decision treeDecision tree
Decision tree
 
Machine learning
Machine learningMachine learning
Machine learning
 
Lecture 4 Decision Trees (2): Entropy, Information Gain, Gain Ratio
Lecture 4 Decision Trees (2): Entropy, Information Gain, Gain RatioLecture 4 Decision Trees (2): Entropy, Information Gain, Gain Ratio
Lecture 4 Decision Trees (2): Entropy, Information Gain, Gain Ratio
 
Biodata analysis
Biodata analysisBiodata analysis
Biodata analysis
 
Privacy-preserving Information Sharing: Tools and Applications
Privacy-preserving Information Sharing: Tools and ApplicationsPrivacy-preserving Information Sharing: Tools and Applications
Privacy-preserving Information Sharing: Tools and Applications
 
PPID3 AICCSA08
PPID3 AICCSA08PPID3 AICCSA08
PPID3 AICCSA08
 
NETWORJS3.pdf
NETWORJS3.pdfNETWORJS3.pdf
NETWORJS3.pdf
 
Learning
LearningLearning
Learning
 
Machine learning 101
Machine learning 101Machine learning 101
Machine learning 101
 
introduction to machin learning
introduction to machin learningintroduction to machin learning
introduction to machin learning
 
i2ml3e-chap1.pptx
i2ml3e-chap1.pptxi2ml3e-chap1.pptx
i2ml3e-chap1.pptx
 
Classification (ML).ppt
Classification (ML).pptClassification (ML).ppt
Classification (ML).ppt
 
Ml study notes id3
Ml study notes   id3Ml study notes   id3
Ml study notes id3
 
ID3 Algorithm
ID3 AlgorithmID3 Algorithm
ID3 Algorithm
 
CLASSIFIER SELECTION MODELS FOR INTRUSION DETECTION SYSTEM (IDS)
CLASSIFIER SELECTION MODELS FOR INTRUSION DETECTION SYSTEM (IDS)CLASSIFIER SELECTION MODELS FOR INTRUSION DETECTION SYSTEM (IDS)
CLASSIFIER SELECTION MODELS FOR INTRUSION DETECTION SYSTEM (IDS)
 
Big Data & Machine Learning - TDC2013 São Paulo - 12/0713
Big Data & Machine Learning - TDC2013 São Paulo - 12/0713Big Data & Machine Learning - TDC2013 São Paulo - 12/0713
Big Data & Machine Learning - TDC2013 São Paulo - 12/0713
 
Big Data & Machine Learning - TDC2013 Sao Paulo
Big Data & Machine Learning - TDC2013 Sao PauloBig Data & Machine Learning - TDC2013 Sao Paulo
Big Data & Machine Learning - TDC2013 Sao Paulo
 
Data Mining Concepts 15061
Data Mining Concepts 15061Data Mining Concepts 15061
Data Mining Concepts 15061
 
Data Mining Concepts
Data Mining ConceptsData Mining Concepts
Data Mining Concepts
 

Kürzlich hochgeladen

Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinojohnmickonozaleda
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 

Kürzlich hochgeladen (20)

Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipino
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 

Data-Mining

  • 1. Data Mining in Artificial Intelligence: Decision Trees
  • 2. Outline  Introduction: Data Flood  Top-Down Decision Tree Construction  Choosing the Splitting Attribute  Information Gain and Gain Ratio  Pruning 2
  • 3. Trends leading to Data Flood  More data is generated:  Bank, telecom, other business transactions ...  Scientific Data: astronomy, biology, etc  Web, text, and e-commerce 3
  • 4. Data Growth  Large DB examples as of 2003:  France Telecom has largest decision-support DB, ~30TB; AT&T ~ 26 TB  Alexa internet archive: 7 years of data, 500 TB  Google searches 3.3 Billion pages, ? TB  Twice as much information was created in 2002 as in 1999 (~30% growth rate)  Knowledge Discovery is NEEDED to make sense and use of data. 4
  • 5. Machine Learning / Data Mining Application areas  Science  astronomy, bioinformatics, drug discovery, …  Business  advertising, CRM (Customer Relationship management), investments, manufacturing, sports/entertainment, telecom, eCommerce, targeted marketing, health care, …  Web:  search engines, bots, …  Government  law enforcement, profiling tax cheaters, anti-terror(?) 5
  • 6. Assessing Credit Risk: Example  Situation: Person applies for a loan  Task: Should a bank approve the loan?  Note: People who have the best credit don’t need the loans, and people with worst credit are not likely to repay. Bank’s best customers are in the middle 6
  • 7. Credit Risk - Results  Banks develop credit models using variety of machine learning methods.  Mortgage and credit card proliferation are the results of being able to successfully predict if a person is likely to default on a loan  Widely deployed in many countries 7
  • 8. DNA Microarrays – Example Given microarray data for a number of samples (patients), can we  Accurately diagnose the disease?  Predict outcome for given treatment?  Recommend best treatment? 8
  • 9. Example: ALL/AML Leukemia data  38 training cases, 34 test, ~ 7,000 genes  2 Classes: Acute Lymphoblastic Leukemia (ALL) vs Acute Myeloid Leukemia (AML)  Use train data to build diagnostic model ALL AML Results on test data better than human expert 33/34 correct (1 error may be mislabeled) 9
  • 10. Related Fields Machine Learning Visualization Data Mining and Knowledge Discovery Statistics Databases 10
  • 11. Knowledge Discovery Process flow, according to CRISP-DM see www.crisp-dm.org for more information Monitoring 11
  • 12. Major Data Mining Tasks  Classification: predicting an item class  Clustering: finding clusters in data  Associations: e.g. A & B & C occur frequently  Visualization: to facilitate human discovery  … 12
  • 13. Data Mining Tasks: Classification Learn a method for predicting the instance class from pre-labeled (classified) instances Many approaches: Statistics, Decision Trees, Neural Networks, ... 13
  • 14. DECISION TREE  An internal node is a test on an attribute.  A branch represents an outcome of the test, e.g., Color=red.  A leaf node represents a class label or class label distribution.  At each node, one attribute is chosen to split training examples into distinct classes as much as possible  A new case is classified by following a matching path to a leaf node. 14
  • 15. Weather Data: Play or not Play? Outlook Temperature Humidity Windy Play? sunny hot high false No sunny hot high true No overcast hot high false Yes rain mild high false Yes rain cool normal false Yes rain cool normal true No overcast cool normal true Yes sunny mild high false No sunny cool normal false Yes rain mild normal false Yes sunny mild normal true Yes overcast mild high true Yes overcast hot normal false Yes rain mild high true No 15 Note: Outlook is the Forecast, no relation to Microsoft email program
  • 16. Example Tree for “Play?” Outlook sunny overcast Humidity Yes rain Windy high normal true false No Yes No Yes 16
  • 17. Building Decision Tree [Q93]  Top-down tree construction  At start, all training examples are at the root.  Partition the examples recursively by choosing one attribute each time.  Bottom-up tree pruning  Remove subtrees or branches, in a bottom-up manner, to improve the estimated accuracy on new cases. 17
  • 18. Choosing the Splitting Attribute  At each node, available attributes are evaluated on the basis of separating the classes of the training examples. A Goodness function is used for this purpose.  Typical goodness functions:  information gain (ID3/C4.5)  information gain ratio  gini index 18
  • 19. Which attribute to select? 19
  • 20. A criterion for attribute selection  Which is the best attribute?  The one which will result in the smallest tree  Heuristic: choose the attribute that produces the “purest” nodes  Popular impurity criterion: information gain  Information gain increases with the average purity of the subsets that an attribute produces  Strategy: choose attribute that results in greatest information gain 20
  • 21. Computing information  Information is measured in bits  Given a probability distribution, the info required to predict an event is the distribution’s entropy  Entropy gives the information required in bits (this can involve fractions of bits!) 21
  • 22. Entropy  Formula for computing the entropy: entropy( p1 , p2 ,, pn ) = − p1logp1 − p2 logp2  − pn logpn 22
  • 23. Example: fair coin throw  P (head) = 0.5  P (tail) = 0.5 entropy(0.5,0.5) = − 0.5 log2 (0.5) − 0.5 log2 (0.5) = − 0.5 * −1 * 2 = 1 bit 23
  • 24. Example: biased coin throw P(head) 0.5 0.25 0.1 0 P(tail) 0.5 0.75 0.9 1 Entropy 1 0.811 0.469 0.000 24
  • 25. Entropy of a split  Information in a split with x items of one class, y items of the second class x y info([x, y]) = entropy( , ) x+y x+y x x y y =− log( )− log( ) x+ y x+ y x+ y x+ y 25
  • 26. Example: attribute “Outlook”  “Outlook” = “Sunny”: 2 and 3 split 2 2 3 3 info([2,3]) = entropy(2/5,3/5) = − log( ) − log( ) = 0.971 bits 5 5 5 5 26
  • 27. Outlook = Overcast  “Outlook” = “Overcast”: 4/0 split Note: log(0) is info([4,0]) = entropy(1,0) = −1log(1) − 0 log(0) = 0 bits not defined, but we evaluate 0*log(0) as zero 27
  • 28. Outlook = Rainy  “Outlook” = “Rainy”: 3 3 2 2 info([3,2]) = entropy(3/5,2/5) = − log( ) − log( ) = 0.971 bits 5 5 5 5 28
  • 29. Expected Information Expected information for attribute: info([3,2], [4,0],[3,2]) = (5 / 14) × 0.971 + (4 / 14) × 0 + (5 / 14) × 0.971 = 0.693 bits 29
  • 30. Computing the information gain  Information gain: (information before split) – (information after split) gain(" Outlook" ) = info([9,5]) - info([2,3], [4,0], [3,2]) = 0.940 - 0.693 = 0.247 bits  Information gain for attributes from weather data: gain(" Outlook" ) = 0.247 bits gain(" Temperature" ) = 0.029 bits gain(" Humidity") = 0.152 bits gain(" Windy") = 0.048 bits 30
  • 31. Continuing to split gain(" Temperature" ) = 0.571 bits gain(" Humidity") = 0.971 bits gain(" Windy") = 0.020 bits 31
  • 32. The final decision tree  Note: not all leaves need to be pure; sometimes identical instances have different classes ⇒ Splitting stops when data can’t be split any further 32
  • 33. Highly-branching attributes  Problematic: attributes with a large number of values (extreme case: ID code)  Subsets are more likely to be pure if there is a large number of values ⇒Information gain is biased towards choosing attributes with a large number of values ⇒This may result in overfitting (selection of an attribute that is non-optimal for prediction) 33
  • 34. Weather Data with ID code ID Outlook Temperature Humidity Windy Play? A sunny hot high false No B sunny hot high true No C overcast hot high false Yes D rain mild high false Yes E rain cool normal false Yes F rain cool normal true No G overcast cool normal true Yes H sunny mild high false No I sunny cool normal false Yes J rain mild normal false Yes K sunny mild normal true Yes L overcast mild high true Yes M overcast hot normal false Yes N rain mild high true No 34
  • 35. Split for ID Code Attribute Entropy of split = 0 (since each leaf node is “pure”, having only one case. Information gain is maximal for ID code 35
  • 36. Gain ratio  Gain ratio: a modification of the information gain that reduces its bias on high-branch attributes  Gain ratio should be  Large when data is evenly spread  Small when all data belong to one branch  Gain ratio takes number and size of branches into account when choosing an attribute  It corrects the information gain by taking the intrinsic information of a split into account (i.e. how much info do we need to tell which branch an instance belongs to) 36
  • 37. Gain Ratio and Intrinsic Info.  Intrinsic information: entropy of distribution of instances into branches |S | |S | IntrinsicInfo(S , A) ≡ −∑ i log i . |S| 2 | S |  Gain ratio (Quinlan’86) normalizes info gain by: GainRatio(S , A) = 37 Gain(S , A) . IntrinsicInfo(S , A)
  • 38. Gain ratios for weather data Outlook Temperature Info: 0.693 Info: 0.911 Gain: 0.940-0.693 0.247 Gain: 0.940-0.911 0.029 Split info: info([5,4,5]) 1.577 Split info: info([4,6,4]) 1.362 Gain ratio: 0.247/1.577 0.156 Gain ratio: 0.029/1.362 0.021 Humidity Windy Info: 0.788 Info: 0.892 Gain: 0.940-0.788 0.152 Gain: 0.940-0.892 0.048 Split info: info([7,7]) 1.000 Split info: info([8,6]) 0.985 Gain ratio: 0.152/1 0.152 Gain ratio: 0.048/0.985 0.049 38
  • 39. Industrial-strength algorithms  For an algorithm to be useful in a wide range of realworld applications it must:   Allow missing values  Be robust in the presence of noise   Permit numeric attributes Be able to approximate arbitrary concept descriptions (at least in principle) Basic schemes need to be extended to fulfill these requirements 42
  • 40. Numeric attributes  Standard method: binary splits  E.g. temp < 45  Unlike nominal attributes, every attribute has many possible split points  Solution is straightforward extension:   Choose “best” split point   Evaluate info gain (or other measure) for every possible split point of attribute Info gain for best split point is info gain for attribute Computationally more demanding 43
  • 41. Weather data - numeric Outlook Temperature Humidity Windy Play Sunny 85 85 False No Sunny 80 90 True No Overcast 83 86 False Yes Rainy 75 80 False Yes … … … … … If outlook = sunny and humidity > 83 then play = no If outlook = rainy and windy = true then play = no If outlook = overcast then play = yes If humidity < 85 then play = yes If none of the above then play = yes 44
  • 42. Example  Split on temperature attribute: 64 65 68 69 Yes No Yes Yes 70 Yes 71 No 72 No 72 75 Yes Yes 75 80 Yes  No 83 Yes E.g. temperature < 71.5: yes/4, no/2 temperature ≥ 71.5: yes/5, no/3  81 Info([4,2],[5,3]) = 6/14 info([4,2]) + 8/14 info([5,3]) = 0.939 bits  Place split points halfway between values  Can evaluate all split points in one pass! 45 85 Yes No
  • 43. Speeding up  Entropy only needs to be evaluated between points of different classes (Fayyad & Irani, 1992) value 64 class Yes 65 68 69 No Yes Yes 70 Yes 71 No 72 No 72 75 Yes Yes X 75 80 Yes 81 No 83 Yes 85 Yes No Potential optimal breakpoints Breakpoints between values of the same class cannot be optimal 46
  • 44. Missing values  Missing value denoted “?” in C4.X  Simple idea: treat missing as a separate value  Q: When this is not appropriate?  When values are missing due to different reasons  Example: field IsPregnant=missing for a male patient should be treated differently (no) than for a female patient of age 25 (unknown) 47
  • 45. Missing values - advanced Split instances with missing values into pieces    A piece going down a branch receives a weight proportional to the popularity of the branch weights sum to 1 Info gain works with fractional instances   use sums of weights instead of counts During classification, split the instance into pieces in the same way  Merge probability distribution using weights 48
  • 46. Pruning  Goal: Prevent overfitting to noise in the data  Two strategies for “pruning” the decision tree:  Postpruning - take a fully-grown decision tree and discard unreliable parts  Prepruning - stop growing a branch when information becomes unreliable  Postpruning preferred in practice— prepruning can “stop too early” 49
  • 47. Prepruning  Based on statistical significance test  Stop growing the tree when there is no statistically significant association between any attribute and the class at a particular node  Most popular test: chi-squared test  ID3 used chi-squared test in addition to information gain  Only statistically significant attributes were allowed to be selected by information gain procedure 50
  • 48. b class 1 0 0 0 2 0 1 1 3 1 0 1 4 Early stopping a 1 1 0  Pre-pruning may stop the growth process prematurely: early stopping  Classic example: XOR/Parity-problem  No individual attribute exhibits any significant association to the class  Structure is only visible in fully expanded tree  Pre-pruning won’t expand the root node  But: XOR-type problems rare in practice  And: pre-pruning faster than post-pruning 51
  • 49. Post-pruning  First, build full tree  Then, prune it  Fully-grown tree shows all attribute interactions  Problem: some subtrees might be due to chance effects  Two pruning operations: 1. 2.  Subtree replacement Subtree raising Possible strategies:  error estimation  significance testing  MDL principle 52
  • 50. Subtree replacement  Bottom-up  Consider replacing a tree only after considering all its subtrees  Ex: labor negotiations 53
  • 53. Estimating error rates  Prune only if it reduces the estimated error  Error on the training data is NOT a useful estimator Q: Why? A: it would result in very little pruning, because decision tree was built on the same training data  Use hold-out set for pruning (“reduced-error pruning”)  C4.5’s method  Derive confidence interval from training data  Use a heuristic limit, derived from this, for pruning  Shaky statistical assumptions (based on training data)  Seems to work OK in practice 56
  • 54. From trees to rules  Simple way: one rule for each leaf  C4.5rules: greedily prune conditions from each rule if this reduces its estimated error  Can produce duplicate rules  Check for this at the end  Then  look at each class in turn  consider the rules for that class  find a “good” subset (guided by MDL)  Then rank the subsets to avoid conflicts  Finally, remove rules (greedily) if this decreases error on the training data 57
  • 55. WEKA – Machine Learning and Data Mining Workbench J4.8 – Java implementation of C4.8 Many more decision-tree and other machine learning methods 58
  • 56. Summary  Decision Trees  splits – binary, multi-way  split criteria – information gain, gain ratio  missing value treatment  pruning  rule extraction from trees 59

Hinweis der Redaktion

  1. Lecture 1
  2. &lt;number&gt;
  3. &lt;number&gt;
  4. &lt;number&gt;
  5. &lt;number&gt;