SlideShare a Scribd company logo
1 of 19
Artificial Intelligence
Decision Trees
• Decision tree gives us disjunctions of
conjunctions (OR’s of AND’s), that is, they
have the form:
(A AND B) OR (C AND D)
• In tree representation:
A
B
C
D
Decision Trees
• A decision tree is a tree where:
– each non-leaf node has
associated with it an attribute
(feature)
– each leaf node has associated
with it a classification (+ or -)
– each arc has associated with it
one of the possible values of
the attribute at the node from
which the arc is directed
T
BPBP +
+- - +
Low High HighLow
HighLow Normal
ID3 Algorithm
• An algorithm for constructing decision tree
• First step of ID3 is to find the root node
– It uses a special GAIN function for that
– Attribute having the max gain is chosen
• The rest of the attributes are evaluated for
the next slots
Entropy
• Entropy(S) = - p+
log2
p+
- p-
log2
p-
• S is the sample space, or Data set D
• p+
is the proportion of positive examples in S
• p-
is the proportion of negative examples in S
Entropy
• Suppose S is a collection of:
– 14 examples of some Boolean concept
– 9 positive examples
– 5 negative examples
Entropy(S) = - (9/14)log2
(9/14) - (5/14)log2
(5/14)
Entropy(S) = 0.940
Entropy
• Order in the data:
– If all the members are of the same class in S
• if all the members are positive
p+
=1 and p-
= 0 and so:
Entropy(S) = - 1log2
1 - 0log2
0
= - 1 (0) - 0 [log2
1 = 0, also 0log2
0 = 0]
= 0
Entropy
• Disorder in the data:
– If all the members of S are equally distributed, half
are + and half -
• p+
= 0.5 and p-
= 0.5 and so:
Entropy(S) = - 0.5log2
0.5 – 0.5log2
0.5
= - 0.5 (-1) – 0.5 (-1) [log2
0.5 = -1]
= 0.5 + 0.5
= 1
Information Gain
• Given entropy as a measure of the order in a
collection of training examples
• We now define a measure of the effectiveness of an
attribute in classifying the training data
• Information gain, is simply the expected reduction in
entropy caused by partitioning the examples
according to this attribute
ID3
D A B E C
d1
a1
b1
e2
YES
d2
a2
b2
e1
YES
d3
a3
b2
e1
NO
d4
a2
b2
e1
NO
d5
a3
b1
e2
NO
D Temp. BP Allergy SICK
d1
High High No YES
d2
Normal Normal Yes YES
d3
Low Normal Yes NO
d4
Normal Normal Yes NO
d5
Low High No NO
For simplicity:
Temperature = A, High = a1, Normal = a2, Low = a3
BP = B, High = b1, Normal = b2
Allergy = E, Yes = e1, No = e2
ID3
• First step is to calculate the entropy of the
entire set S. We know:
• E(S) = - p+
log2
p+
- p-
log2
p-
=
= 0.97
5
3
log
5
3
5
2
log
5
2
22 −−
ID3
)(
||
||
)(
||
||
)(
||
||
)(),( 3
3
2
2
1
1
SaE
S
Sa
SaE
S
Sa
SaE
S
Sa
SEASG −−−=
where G(S,A) is the gain for A, |Sa1
| is the number of times attribute
A takes the value a1
. E(Sa1
) is the entropy of a1
, which will be
calculated by observing the proportion of total population of a1
and
the number of times the C is YES or NO within these observation
containing a1
for the value of attribute A
S A B E C
d1
a1
b1
e2
YES
d2
a2
b2
e1
YES
d3
a3
b2
e1
NO
d4
a2
b2
e1
NO
d5
a3
b1
e2
NO
|S| = 5 |Sa1| = 1 |Sa2
| = 2 |Sa3
| = 2
ID3
S A B E C
d1
a1
b1
e2
YES
d2
a2
b2
e1
YES
d3
a3
b2
e1
NO
d4
a2
b2
e1
NO
d5
a3
b1
e2
NO
|S| = 5 |Sa1| = 1 |Sa2
| = 2 |Sa3
| = 2
Entropy = - p+log2 p+ - p-log2 p-
E(Sa1
) = -1log2
1 - 0log2
0 = 0
E(Sa3
) = -0log2
0 - 1log2
1 = 0
ID3
= 0.57( ) ( ) ( )0
5
2
1
5
2
0
5
1
97.0),( −−−=ASG
Similarly for B, now since there are only two values observable for the attribute B:
)(
||
||
)(
||
||
)(),( 2
2
1
1
SbE
S
Sb
SbE
S
Sb
SEBSG −−=
= 0.02
)
3
2
log
3
2
3
1
log
3
1
(
5
3
)1(
5
2
97.0),( 22 −−−−=BSG
)39.052.0(
5
3
4.097.0),( +−−=BSG
)(
||
||
)(
||
||
)(),( 2
2
1
1
SeE
S
Se
SeE
S
Se
SEESG −−=
= 0.02
Similarly for E:
ID3
S’ = [d2, d4]YES NO
a1 a2 a3
A
S A B E C
d1
a1
b1
e2
YES
d2
a2
b2
e1
YES
d3
a3
b2
e1
NO
d4
a2
b2
e2
NO
d5
a3
b1
e2
NO
S’ A B E C
d2
a2
b2
e1
YES
d4
a2
b2
e2
NO
ID3
S’ A B E C
d2
a2
b2
e1
YES
d4
a2
b2
e2
NO
E(S’) = - p+
log2
p+
- p-
log2
p-
1
2
1
log
2
1
2
1
log
2
1
22 =−−=
ID3
|S’| = 2 |S’b2
| = 2
)'(
|'|
|'|
)'(),'( 2
2
bSE
S
bS
SEBSG −=
)
2
1
log
2
1
2
1
log
2
1
(
2
2
1),'( 22 −−−=BSG
= 1 - 1 = 0
S’ A B E C
d2
a2
b2
e1
YES
d4
a2
b2
e2
NO
ID3
Similarly for E:
|S’| = 2
|S’e1
| = 1 [since there is only one observation of e1
which outputs a YES]
E(S’e1
) = -1log2
1 - 0log2
0 = 0 [since log 1 = 0]
|S’e2
| = 1 [since there is only one observation of e2
which outputs a NO]
E(S’e2
) = -0log2
0 - 1log2
1 = 0 [since log 1 = 0]
Hence:
S’ A B E C
d2
a2
b2
e1
YES
d4
a2
b2
e2
NO
)'(
|'|
|'|
)'(
|'|
|'|
)'(),'( 2
2
1
1
eSE
S
eS
eSE
S
eS
SEESG −−=
1001)0(
2
1
)0(
2
1
1),'( =−−=−−=ESG
ID3
YES NO
NOYES
a2a1 a3
e2e1
A
E
S A B E C
d1
a1
b1
e2
YES
d2
a2
b2
e1
YES
d3
a3
b2
e1
NO
d4
a2
b2
e1
NO
d5
a3
b1
e2
NO

More Related Content

What's hot

Math presentation on domain and range
Math presentation on domain and rangeMath presentation on domain and range
Math presentation on domain and rangeTouhidul Shawan
 
Data analysis with R
Data analysis with RData analysis with R
Data analysis with RShareThis
 
Functionsandpigeonholeprinciple
FunctionsandpigeonholeprincipleFunctionsandpigeonholeprinciple
FunctionsandpigeonholeprincipleShiwani Gupta
 
Domain & range intro presentation
Domain & range intro presentationDomain & range intro presentation
Domain & range intro presentationdaldridge530
 
Functions and graphs
Functions and graphsFunctions and graphs
Functions and graphsSujata Tapare
 
1.4 Functions
1.4 Functions1.4 Functions
1.4 Functionsnicksuf
 
Relations & Functions
Relations & FunctionsRelations & Functions
Relations & FunctionsBitsy Griffin
 
Cypher.PL: Executable Specification of Cypher written in Prolog
Cypher.PL: Executable Specification of Cypher written in PrologCypher.PL: Executable Specification of Cypher written in Prolog
Cypher.PL: Executable Specification of Cypher written in PrologopenCypher
 
Higher Maths 1.2.1 - Sets and Functions
Higher Maths 1.2.1 - Sets and FunctionsHigher Maths 1.2.1 - Sets and Functions
Higher Maths 1.2.1 - Sets and Functionstimschmitz
 
Functional Programming in Swift
Functional Programming in SwiftFunctional Programming in Swift
Functional Programming in SwiftSaugat Gautam
 
Basic arithmetic, instruction execution and program
Basic arithmetic, instruction execution and programBasic arithmetic, instruction execution and program
Basic arithmetic, instruction execution and programJyotiprakashMishra18
 

What's hot (17)

Math presentation on domain and range
Math presentation on domain and rangeMath presentation on domain and range
Math presentation on domain and range
 
Graph of functions
Graph of functionsGraph of functions
Graph of functions
 
Data analysis with R
Data analysis with RData analysis with R
Data analysis with R
 
Functionsandpigeonholeprinciple
FunctionsandpigeonholeprincipleFunctionsandpigeonholeprinciple
Functionsandpigeonholeprinciple
 
Domain & range intro presentation
Domain & range intro presentationDomain & range intro presentation
Domain & range intro presentation
 
Functions and graphs
Functions and graphsFunctions and graphs
Functions and graphs
 
1.4 Functions
1.4 Functions1.4 Functions
1.4 Functions
 
Functions
FunctionsFunctions
Functions
 
Recursion part 2
Recursion part 2Recursion part 2
Recursion part 2
 
Functions
FunctionsFunctions
Functions
 
Functions
FunctionsFunctions
Functions
 
Relations & Functions
Relations & FunctionsRelations & Functions
Relations & Functions
 
Cypher.PL: Executable Specification of Cypher written in Prolog
Cypher.PL: Executable Specification of Cypher written in PrologCypher.PL: Executable Specification of Cypher written in Prolog
Cypher.PL: Executable Specification of Cypher written in Prolog
 
Higher Maths 1.2.1 - Sets and Functions
Higher Maths 1.2.1 - Sets and FunctionsHigher Maths 1.2.1 - Sets and Functions
Higher Maths 1.2.1 - Sets and Functions
 
Functional Programming in Swift
Functional Programming in SwiftFunctional Programming in Swift
Functional Programming in Swift
 
Function Basics Math Wiki
Function Basics   Math WikiFunction Basics   Math Wiki
Function Basics Math Wiki
 
Basic arithmetic, instruction execution and program
Basic arithmetic, instruction execution and programBasic arithmetic, instruction execution and program
Basic arithmetic, instruction execution and program
 

Similar to Artificial Intelligence

3 complex numbers part 3 of 3
3 complex numbers part 3 of 33 complex numbers part 3 of 3
3 complex numbers part 3 of 3naveenkumar9211
 
Asymptotic analysis
Asymptotic analysisAsymptotic analysis
Asymptotic analysisSoujanya V
 
Rough Entropy-Based Gene Selection
Rough Entropy-Based Gene SelectionRough Entropy-Based Gene Selection
Rough Entropy-Based Gene SelectionDr.E.N.Sathishkumar
 
Add math may june 2016 p1
Add math may june 2016 p1Add math may june 2016 p1
Add math may june 2016 p1Don Cunningham
 
Pengolahan Data Panel Logit di Stata: Penilaian Goodness of Fit, Uji Model, d...
Pengolahan Data Panel Logit di Stata: Penilaian Goodness of Fit, Uji Model, d...Pengolahan Data Panel Logit di Stata: Penilaian Goodness of Fit, Uji Model, d...
Pengolahan Data Panel Logit di Stata: Penilaian Goodness of Fit, Uji Model, d...The1 Uploader
 
Theories of continuous optimization
Theories of continuous optimizationTheories of continuous optimization
Theories of continuous optimizationOlivier Teytaud
 
DS Unit-1.pptx very easy to understand..
DS Unit-1.pptx very easy to understand..DS Unit-1.pptx very easy to understand..
DS Unit-1.pptx very easy to understand..KarthikeyaLanka1
 
Discrete Math Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums, ...
Discrete Math Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums, ...Discrete Math Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums, ...
Discrete Math Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums, ...Amr Rashed
 
Master method
Master method Master method
Master method Rajendran
 
Real number system full
Real  number  system fullReal  number  system full
Real number system fullAon Narinchoti
 
Real number system full
Real  number  system fullReal  number  system full
Real number system fullAon Narinchoti
 

Similar to Artificial Intelligence (20)

3 complex numbers part 3 of 3
3 complex numbers part 3 of 33 complex numbers part 3 of 3
3 complex numbers part 3 of 3
 
AsymptoticAnalysis.ppt
AsymptoticAnalysis.pptAsymptoticAnalysis.ppt
AsymptoticAnalysis.ppt
 
Asymptotic analysis
Asymptotic analysisAsymptotic analysis
Asymptotic analysis
 
Rough Entropy-Based Gene Selection
Rough Entropy-Based Gene SelectionRough Entropy-Based Gene Selection
Rough Entropy-Based Gene Selection
 
Add math may june 2016 p1
Add math may june 2016 p1Add math may june 2016 p1
Add math may june 2016 p1
 
Nbvtalkatbzaonencryptionpuzzles
NbvtalkatbzaonencryptionpuzzlesNbvtalkatbzaonencryptionpuzzles
Nbvtalkatbzaonencryptionpuzzles
 
Nbvtalkatbzaonencryptionpuzzles
NbvtalkatbzaonencryptionpuzzlesNbvtalkatbzaonencryptionpuzzles
Nbvtalkatbzaonencryptionpuzzles
 
Pengolahan Data Panel Logit di Stata: Penilaian Goodness of Fit, Uji Model, d...
Pengolahan Data Panel Logit di Stata: Penilaian Goodness of Fit, Uji Model, d...Pengolahan Data Panel Logit di Stata: Penilaian Goodness of Fit, Uji Model, d...
Pengolahan Data Panel Logit di Stata: Penilaian Goodness of Fit, Uji Model, d...
 
Theories of continuous optimization
Theories of continuous optimizationTheories of continuous optimization
Theories of continuous optimization
 
Digital signature
Digital signatureDigital signature
Digital signature
 
Number theory lecture (part 1)
Number theory lecture (part 1)Number theory lecture (part 1)
Number theory lecture (part 1)
 
DS Unit-1.pptx very easy to understand..
DS Unit-1.pptx very easy to understand..DS Unit-1.pptx very easy to understand..
DS Unit-1.pptx very easy to understand..
 
ID3 Algorithm
ID3 AlgorithmID3 Algorithm
ID3 Algorithm
 
Discrete Math Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums, ...
Discrete Math Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums, ...Discrete Math Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums, ...
Discrete Math Chapter 2: Basic Structures: Sets, Functions, Sequences, Sums, ...
 
Master method
Master method Master method
Master method
 
Real number system full
Real  number  system fullReal  number  system full
Real number system full
 
Real number system full
Real  number  system fullReal  number  system full
Real number system full
 
Information Security Seminar #2
Information Security Seminar #2Information Security Seminar #2
Information Security Seminar #2
 
8076892 (1).ppt
8076892 (1).ppt8076892 (1).ppt
8076892 (1).ppt
 
file_5.pptx
file_5.pptxfile_5.pptx
file_5.pptx
 

More from Nilt1234

Lisp tutorial
Lisp tutorialLisp tutorial
Lisp tutorialNilt1234
 
INTRODUCTION TO LISP
INTRODUCTION TO LISPINTRODUCTION TO LISP
INTRODUCTION TO LISPNilt1234
 
relational algebra (joins)
relational algebra (joins)relational algebra (joins)
relational algebra (joins)Nilt1234
 
relational algebra-(basics)
 relational algebra-(basics) relational algebra-(basics)
relational algebra-(basics)Nilt1234
 
SQL Queries
SQL QueriesSQL Queries
SQL QueriesNilt1234
 
SQL Queries
SQL QueriesSQL Queries
SQL QueriesNilt1234
 
introduction of Database
introduction of Databaseintroduction of Database
introduction of DatabaseNilt1234
 
Database Architecture
Database Architecture Database Architecture
Database Architecture Nilt1234
 
What is Artificial Intelligence
What is Artificial IntelligenceWhat is Artificial Intelligence
What is Artificial IntelligenceNilt1234
 
Entity Relationship Diagaram
Entity Relationship DiagaramEntity Relationship Diagaram
Entity Relationship DiagaramNilt1234
 

More from Nilt1234 (13)

Lisp tutorial
Lisp tutorialLisp tutorial
Lisp tutorial
 
INTRODUCTION TO LISP
INTRODUCTION TO LISPINTRODUCTION TO LISP
INTRODUCTION TO LISP
 
Lec 09
Lec 09Lec 09
Lec 09
 
relational algebra (joins)
relational algebra (joins)relational algebra (joins)
relational algebra (joins)
 
relational algebra-(basics)
 relational algebra-(basics) relational algebra-(basics)
relational algebra-(basics)
 
Lec 17
Lec  17Lec  17
Lec 17
 
Lec 06
Lec 06Lec 06
Lec 06
 
SQL Queries
SQL QueriesSQL Queries
SQL Queries
 
SQL Queries
SQL QueriesSQL Queries
SQL Queries
 
introduction of Database
introduction of Databaseintroduction of Database
introduction of Database
 
Database Architecture
Database Architecture Database Architecture
Database Architecture
 
What is Artificial Intelligence
What is Artificial IntelligenceWhat is Artificial Intelligence
What is Artificial Intelligence
 
Entity Relationship Diagaram
Entity Relationship DiagaramEntity Relationship Diagaram
Entity Relationship Diagaram
 

Recently uploaded

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 

Recently uploaded (20)

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 

Artificial Intelligence

  • 2. Decision Trees • Decision tree gives us disjunctions of conjunctions (OR’s of AND’s), that is, they have the form: (A AND B) OR (C AND D) • In tree representation: A B C D
  • 3. Decision Trees • A decision tree is a tree where: – each non-leaf node has associated with it an attribute (feature) – each leaf node has associated with it a classification (+ or -) – each arc has associated with it one of the possible values of the attribute at the node from which the arc is directed T BPBP + +- - + Low High HighLow HighLow Normal
  • 4. ID3 Algorithm • An algorithm for constructing decision tree • First step of ID3 is to find the root node – It uses a special GAIN function for that – Attribute having the max gain is chosen • The rest of the attributes are evaluated for the next slots
  • 5. Entropy • Entropy(S) = - p+ log2 p+ - p- log2 p- • S is the sample space, or Data set D • p+ is the proportion of positive examples in S • p- is the proportion of negative examples in S
  • 6. Entropy • Suppose S is a collection of: – 14 examples of some Boolean concept – 9 positive examples – 5 negative examples Entropy(S) = - (9/14)log2 (9/14) - (5/14)log2 (5/14) Entropy(S) = 0.940
  • 7. Entropy • Order in the data: – If all the members are of the same class in S • if all the members are positive p+ =1 and p- = 0 and so: Entropy(S) = - 1log2 1 - 0log2 0 = - 1 (0) - 0 [log2 1 = 0, also 0log2 0 = 0] = 0
  • 8. Entropy • Disorder in the data: – If all the members of S are equally distributed, half are + and half - • p+ = 0.5 and p- = 0.5 and so: Entropy(S) = - 0.5log2 0.5 – 0.5log2 0.5 = - 0.5 (-1) – 0.5 (-1) [log2 0.5 = -1] = 0.5 + 0.5 = 1
  • 9. Information Gain • Given entropy as a measure of the order in a collection of training examples • We now define a measure of the effectiveness of an attribute in classifying the training data • Information gain, is simply the expected reduction in entropy caused by partitioning the examples according to this attribute
  • 10. ID3 D A B E C d1 a1 b1 e2 YES d2 a2 b2 e1 YES d3 a3 b2 e1 NO d4 a2 b2 e1 NO d5 a3 b1 e2 NO D Temp. BP Allergy SICK d1 High High No YES d2 Normal Normal Yes YES d3 Low Normal Yes NO d4 Normal Normal Yes NO d5 Low High No NO For simplicity: Temperature = A, High = a1, Normal = a2, Low = a3 BP = B, High = b1, Normal = b2 Allergy = E, Yes = e1, No = e2
  • 11. ID3 • First step is to calculate the entropy of the entire set S. We know: • E(S) = - p+ log2 p+ - p- log2 p- = = 0.97 5 3 log 5 3 5 2 log 5 2 22 −−
  • 12. ID3 )( || || )( || || )( || || )(),( 3 3 2 2 1 1 SaE S Sa SaE S Sa SaE S Sa SEASG −−−= where G(S,A) is the gain for A, |Sa1 | is the number of times attribute A takes the value a1 . E(Sa1 ) is the entropy of a1 , which will be calculated by observing the proportion of total population of a1 and the number of times the C is YES or NO within these observation containing a1 for the value of attribute A S A B E C d1 a1 b1 e2 YES d2 a2 b2 e1 YES d3 a3 b2 e1 NO d4 a2 b2 e1 NO d5 a3 b1 e2 NO |S| = 5 |Sa1| = 1 |Sa2 | = 2 |Sa3 | = 2
  • 13. ID3 S A B E C d1 a1 b1 e2 YES d2 a2 b2 e1 YES d3 a3 b2 e1 NO d4 a2 b2 e1 NO d5 a3 b1 e2 NO |S| = 5 |Sa1| = 1 |Sa2 | = 2 |Sa3 | = 2 Entropy = - p+log2 p+ - p-log2 p- E(Sa1 ) = -1log2 1 - 0log2 0 = 0 E(Sa3 ) = -0log2 0 - 1log2 1 = 0
  • 14. ID3 = 0.57( ) ( ) ( )0 5 2 1 5 2 0 5 1 97.0),( −−−=ASG Similarly for B, now since there are only two values observable for the attribute B: )( || || )( || || )(),( 2 2 1 1 SbE S Sb SbE S Sb SEBSG −−= = 0.02 ) 3 2 log 3 2 3 1 log 3 1 ( 5 3 )1( 5 2 97.0),( 22 −−−−=BSG )39.052.0( 5 3 4.097.0),( +−−=BSG )( || || )( || || )(),( 2 2 1 1 SeE S Se SeE S Se SEESG −−= = 0.02 Similarly for E:
  • 15. ID3 S’ = [d2, d4]YES NO a1 a2 a3 A S A B E C d1 a1 b1 e2 YES d2 a2 b2 e1 YES d3 a3 b2 e1 NO d4 a2 b2 e2 NO d5 a3 b1 e2 NO S’ A B E C d2 a2 b2 e1 YES d4 a2 b2 e2 NO
  • 16. ID3 S’ A B E C d2 a2 b2 e1 YES d4 a2 b2 e2 NO E(S’) = - p+ log2 p+ - p- log2 p- 1 2 1 log 2 1 2 1 log 2 1 22 =−−=
  • 17. ID3 |S’| = 2 |S’b2 | = 2 )'( |'| |'| )'(),'( 2 2 bSE S bS SEBSG −= ) 2 1 log 2 1 2 1 log 2 1 ( 2 2 1),'( 22 −−−=BSG = 1 - 1 = 0 S’ A B E C d2 a2 b2 e1 YES d4 a2 b2 e2 NO
  • 18. ID3 Similarly for E: |S’| = 2 |S’e1 | = 1 [since there is only one observation of e1 which outputs a YES] E(S’e1 ) = -1log2 1 - 0log2 0 = 0 [since log 1 = 0] |S’e2 | = 1 [since there is only one observation of e2 which outputs a NO] E(S’e2 ) = -0log2 0 - 1log2 1 = 0 [since log 1 = 0] Hence: S’ A B E C d2 a2 b2 e1 YES d4 a2 b2 e2 NO )'( |'| |'| )'( |'| |'| )'(),'( 2 2 1 1 eSE S eS eSE S eS SEESG −−= 1001)0( 2 1 )0( 2 1 1),'( =−−=−−=ESG
  • 19. ID3 YES NO NOYES a2a1 a3 e2e1 A E S A B E C d1 a1 b1 e2 YES d2 a2 b2 e1 YES d3 a3 b2 e1 NO d4 a2 b2 e1 NO d5 a3 b1 e2 NO