SlideShare a Scribd company logo
1 of 16
Download to read offline
Machine Learning – ECERSICE 2
1399/09/30
Amir Shokri
Exercise 2 – Decision Tree
Amir Shokri
A B C RESULT
F F F F
F F T F
F T F T
F T T F
T F F T
T F T T
T T F F
T T T F
(A AND B) OR (B AND C) XOR (A OR B) A
B B
false true
false
truefalse
true
c
false
true
Exercise 2 – Decision Tree
Amir Shokri
A B C RESULT
F F F T
F F T T
F T F T
F T T F
T F F T
T F T T
T T F T
T T T T
(A AND B AND C) OR (C NAND B) A
B
false true
false
true
c
false
true
Exercise 2 – Decision Tree
A B C D RESULT
F F F F F
F F F T F
F F T F F
F F T T F
F T F F F
F T F T F
F T T F F
F T T T T
T F F F F
T F F T F
T F T F F
T F T T T
T T F F F
T T F T F
T T T F F
T T T T T
(A OR B) AND (B OR C) AND (C AND D)
A
B
B
false
true
false
true
false
true
c
false
true
D
false
c
false D
false
cfalse
true
true
D
false
true
Amir Shokri
Exercise 2 – Decision Tree
Amir Shokri
Example Size Color Shape Class/Label
1 big red circle No
2 big red triangle Yes
3 small red circle No
4 big red triangle No
5 small blue circle No
size
shape
big small
circle
triangle
Exercise 2 – FIND-S
Amir Shokri
Example Size Color Shape Class/Label
1 big red circle No
2 big red triangle Yes
3 small red circle No
4 big red triangle No
5 small blue circle No
h0 = < ∅ , ∅ , ∅ >
h1 = < ∅ , ∅ , ∅ >
h2 = < big, red, triangle >
h3 = < big, red, triangle >
h4 = < big, red, triangle >
Exercise 2 – Candidate elimination
Amir Shokri
Example Size Color Shape Class/Label
1 big red circle No
2 big red triangle Yes
3 small red circle No
4 big red triangle No
5 small blue circle No
S0 = < ∅ , ∅ , ∅ >
G0 = < ?, ?, ? >
Exercise 2 – Candidate elimination
Amir Shokri
Example Size Color Shape Class/Label
1 big red circle No
2 big red triangle Yes
3 small red circle No
4 big red triangle No
5 small blue circle No
S1 = < ∅ , ∅ , ∅ >
G1 = < small, ?, ?> < ?, blue, ? > < ?, ? ,triangle >
Exercise 2 – Candidate elimination
Amir Shokri
Example Size Color Shape Class/Label
1 big red circle No
2 big red triangle Yes
3 small red circle No
4 big red triangle No
5 small blue circle No
S3 = < big, red, triangle >
G3 = < ?, ? ,triangle >
Exercise 2 – Candidate elimination
Amir Shokri
Example Size Color Shape Class/Label
1 big red circle No
2 big red triangle Yes
3 small red circle No
4 big red triangle No
5 small blue circle No
S4 = < big, red, triangle >
G4 = < ?, ? ,triangle >
Exercise 2 – ID3
Amir Shokri
Example Size Color Shape Class/Label
1 big red circle No
2 big red triangle Yes
3 small red circle No
4 big red triangle No
5 small blue circle No
Entropy :
Entropy(S) :
Gain(S, A):
෍
𝑖=1
−𝑝𝑖 ∗ log2(𝑝𝑖)
(−𝑝+ log2 𝑝+ ) − (−𝑝− log2 𝑝− )
𝐸𝑛𝑡𝑟𝑜𝑝ℎ𝑦 𝑆 − ෍
𝑣=𝑉𝑎𝑙𝑢𝑒𝑠(𝐴)
𝑆 𝑣
𝑆
𝐸𝑛𝑡𝑟𝑜𝑝ℎ𝑦(𝑆 𝑣)
Exercise 2 – ID3
Amir Shokri
Example Size Color Shape Class/Label
1 big red circle No
2 big red triangle Yes
3 small red circle No
4 big red triangle No
5 small blue circle No
σ𝑖=1 −𝑝𝑖 ∗ log2 𝑝𝑖 = −
3
4
log2
3
4
−
1
4
log2
1
4
= 0.307 + 0.5 = 0.87
Entropy
Exercise 2 – ID3
Amir Shokri
Example Size Color Shape Class/Label
1 big red circle No
2 big red triangle Yes
3 small red circle No
4 big red triangle No
5 small blue circle No
Gain size:
𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑠𝑚𝑎𝑙𝑙 => −
2
4
0
2
log
0
2
+
2
2
log
2
2
𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑏𝑖𝑔 => −
2
4
1
2
log
1
2
+
1
2
log
1
2
𝐺𝑎𝑖𝑛 𝑆, size = 0.87 − 0 + 0.5 = 0.37
Exercise 2 – ID3
Amir Shokri
Example Size Color Shape Class/Label
1 big red circle No
2 big red triangle Yes
3 small red circle No
4 big red triangle No
5 small blue circle No
Gain color:
𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑟𝑒𝑑 => −
3
4
2
3
log
2
3
+
1
3
log
1
3
𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑏𝑙𝑢𝑒 => −
1
4
1
1
log
1
1
+
0
1
log
0
1
𝐺𝑎𝑖𝑛 𝑆, color = 0.87 − 0.29 + 0 = 0.58
Exercise 2 – ID3
Amir Shokri
Example Size Color Shape Class/Label
1 big red circle No
2 big red triangle Yes
3 small red circle No
4 big red triangle No
5 small blue circle No
Gain shape:
𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑐𝑖𝑟𝑐𝑙𝑒 => −
3
4
0
3
log
0
3
+
3
3
log
3
3
𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑡𝑟𝑖𝑎𝑛𝑔𝑙𝑒 => −
1
4
1
1
log
1
1
+
0
1
log
0
1
𝐺𝑎𝑖𝑛 𝑆, shape = 0.87 − 0 + 0 = 0.87
Exercise 2 – ID3
Amir Shokri
Example Size Color Shape Class/Label
1 big red circle No
2 big red triangle Yes
3 small red circle No
4 big red triangle No
5 small blue circle No
shape
circle triangle

More Related Content

What's hot

Operaciones combinadas- Potencias y raices
Operaciones combinadas- Potencias y raicesOperaciones combinadas- Potencias y raices
Operaciones combinadas- Potencias y raicesViviana Lloret
 
Foil2
Foil2Foil2
Foil2vzeto
 
8th alg -l3.5
8th alg -l3.58th alg -l3.5
8th alg -l3.5jdurst65
 
TechMathII - Chapter1 Review Jeopardy
TechMathII - Chapter1 Review JeopardyTechMathII - Chapter1 Review Jeopardy
TechMathII - Chapter1 Review Jeopardylmrhodes
 
Math activities
Math activitiesMath activities
Math activitiesshandex
 
Penambahan nombor bercampur berlainan penyebut
Penambahan nombor bercampur berlainan penyebutPenambahan nombor bercampur berlainan penyebut
Penambahan nombor bercampur berlainan penyebutIPG Kampus Pulau Pinang
 
Ejercicios limites
Ejercicios limitesEjercicios limites
Ejercicios limitesrossyherr
 
Quick sort and binary search PDF
Quick sort and binary search PDFQuick sort and binary search PDF
Quick sort and binary search PDFDivya modi
 
Ecs.log.ii parte.3ºsec.
Ecs.log.ii parte.3ºsec.Ecs.log.ii parte.3ºsec.
Ecs.log.ii parte.3ºsec.19671966
 
Sorting linear functions
Sorting linear functionsSorting linear functions
Sorting linear functionsChris Hunter
 
3d. order of operations
3d. order of operations3d. order of operations
3d. order of operationsDominic Dewey
 
Modular Arithmetic: Addition and Subtraction
Modular Arithmetic: Addition and SubtractionModular Arithmetic: Addition and Subtraction
Modular Arithmetic: Addition and SubtractionSam Bowne
 
Math is Awesome ACT Prep
Math is Awesome ACT PrepMath is Awesome ACT Prep
Math is Awesome ACT PrepJTKnull
 

What's hot (19)

Operaciones combinadas- Potencias y raices
Operaciones combinadas- Potencias y raicesOperaciones combinadas- Potencias y raices
Operaciones combinadas- Potencias y raices
 
Foil2
Foil2Foil2
Foil2
 
8th alg -l3.5
8th alg -l3.58th alg -l3.5
8th alg -l3.5
 
TechMathII - Chapter1 Review Jeopardy
TechMathII - Chapter1 Review JeopardyTechMathII - Chapter1 Review Jeopardy
TechMathII - Chapter1 Review Jeopardy
 
Math activities
Math activitiesMath activities
Math activities
 
Penambahan nombor bercampur berlainan penyebut
Penambahan nombor bercampur berlainan penyebutPenambahan nombor bercampur berlainan penyebut
Penambahan nombor bercampur berlainan penyebut
 
Ejercicios limites
Ejercicios limitesEjercicios limites
Ejercicios limites
 
Bentuk akar
Bentuk akarBentuk akar
Bentuk akar
 
Alg2 lesson 11-2
Alg2 lesson 11-2Alg2 lesson 11-2
Alg2 lesson 11-2
 
Mathemagica
MathemagicaMathemagica
Mathemagica
 
Quick sort and binary search PDF
Quick sort and binary search PDFQuick sort and binary search PDF
Quick sort and binary search PDF
 
Aptitude test paper
Aptitude test paperAptitude test paper
Aptitude test paper
 
Vectors intro
Vectors introVectors intro
Vectors intro
 
Ecs.log.ii parte.3ºsec.
Ecs.log.ii parte.3ºsec.Ecs.log.ii parte.3ºsec.
Ecs.log.ii parte.3ºsec.
 
Sorting linear functions
Sorting linear functionsSorting linear functions
Sorting linear functions
 
Binary Search
Binary SearchBinary Search
Binary Search
 
3d. order of operations
3d. order of operations3d. order of operations
3d. order of operations
 
Modular Arithmetic: Addition and Subtraction
Modular Arithmetic: Addition and SubtractionModular Arithmetic: Addition and Subtraction
Modular Arithmetic: Addition and Subtraction
 
Math is Awesome ACT Prep
Math is Awesome ACT PrepMath is Awesome ACT Prep
Math is Awesome ACT Prep
 

More from Amir Shokri

LAUNCH - growth practices - PRODUCT MANAGER
LAUNCH - growth practices - PRODUCT MANAGERLAUNCH - growth practices - PRODUCT MANAGER
LAUNCH - growth practices - PRODUCT MANAGERAmir Shokri
 
Project Management Growth Practices
Project Management Growth PracticesProject Management Growth Practices
Project Management Growth PracticesAmir Shokri
 
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 7
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 7GROWTH PRACTICES - Cracking the PM Career - CHAPTER 7
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 7Amir Shokri
 
Numbers, math operation, converting bases
Numbers, math operation, converting basesNumbers, math operation, converting bases
Numbers, math operation, converting basesAmir Shokri
 
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 4
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 4GROWTH PRACTICES - Cracking the PM Career - CHAPTER 4
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 4Amir Shokri
 
review of image memorability methods
review of image memorability methodsreview of image memorability methods
review of image memorability methodsAmir Shokri
 
beyesian learning exercises
beyesian learning exercisesbeyesian learning exercises
beyesian learning exercisesAmir Shokri
 
Bayesian learning
Bayesian learningBayesian learning
Bayesian learningAmir Shokri
 
machine learning code
machine learning codemachine learning code
machine learning codeAmir Shokri
 
Concept learning
Concept learningConcept learning
Concept learningAmir Shokri
 
logical operators decision tree
logical operators decision treelogical operators decision tree
logical operators decision treeAmir Shokri
 
Mining social network graphs - persian
Mining social network graphs - persianMining social network graphs - persian
Mining social network graphs - persianAmir Shokri
 
product glossary
product glossaryproduct glossary
product glossaryAmir Shokri
 
Popular Maple codes Book - Persian
Popular Maple codes Book - PersianPopular Maple codes Book - Persian
Popular Maple codes Book - PersianAmir Shokri
 
deepswarm optimising convolutional neural networks using swarm intelligence (...
deepswarm optimising convolutional neural networks using swarm intelligence (...deepswarm optimising convolutional neural networks using swarm intelligence (...
deepswarm optimising convolutional neural networks using swarm intelligence (...Amir Shokri
 

More from Amir Shokri (20)

LAUNCH - growth practices - PRODUCT MANAGER
LAUNCH - growth practices - PRODUCT MANAGERLAUNCH - growth practices - PRODUCT MANAGER
LAUNCH - growth practices - PRODUCT MANAGER
 
Remote work
Remote workRemote work
Remote work
 
Project Management Growth Practices
Project Management Growth PracticesProject Management Growth Practices
Project Management Growth Practices
 
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 7
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 7GROWTH PRACTICES - Cracking the PM Career - CHAPTER 7
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 7
 
Numbers, math operation, converting bases
Numbers, math operation, converting basesNumbers, math operation, converting bases
Numbers, math operation, converting bases
 
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 4
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 4GROWTH PRACTICES - Cracking the PM Career - CHAPTER 4
GROWTH PRACTICES - Cracking the PM Career - CHAPTER 4
 
review of image memorability methods
review of image memorability methodsreview of image memorability methods
review of image memorability methods
 
key.net
key.netkey.net
key.net
 
beyesian learning exercises
beyesian learning exercisesbeyesian learning exercises
beyesian learning exercises
 
Knn
KnnKnn
Knn
 
Bayesian learning
Bayesian learningBayesian learning
Bayesian learning
 
machine learning code
machine learning codemachine learning code
machine learning code
 
ID3 Algorithm
ID3 AlgorithmID3 Algorithm
ID3 Algorithm
 
Concept learning
Concept learningConcept learning
Concept learning
 
logical operators decision tree
logical operators decision treelogical operators decision tree
logical operators decision tree
 
Matplotlib
MatplotlibMatplotlib
Matplotlib
 
Mining social network graphs - persian
Mining social network graphs - persianMining social network graphs - persian
Mining social network graphs - persian
 
product glossary
product glossaryproduct glossary
product glossary
 
Popular Maple codes Book - Persian
Popular Maple codes Book - PersianPopular Maple codes Book - Persian
Popular Maple codes Book - Persian
 
deepswarm optimising convolutional neural networks using swarm intelligence (...
deepswarm optimising convolutional neural networks using swarm intelligence (...deepswarm optimising convolutional neural networks using swarm intelligence (...
deepswarm optimising convolutional neural networks using swarm intelligence (...
 

Recently uploaded

_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
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
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 

Recently uploaded (20)

_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
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
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
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
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 

machine learning - id3, find-s, candidate elimination, desicion tree example

  • 1. Machine Learning – ECERSICE 2 1399/09/30 Amir Shokri
  • 2. Exercise 2 – Decision Tree Amir Shokri A B C RESULT F F F F F F T F F T F T F T T F T F F T T F T T T T F F T T T F (A AND B) OR (B AND C) XOR (A OR B) A B B false true false truefalse true c false true
  • 3. Exercise 2 – Decision Tree Amir Shokri A B C RESULT F F F T F F T T F T F T F T T F T F F T T F T T T T F T T T T T (A AND B AND C) OR (C NAND B) A B false true false true c false true
  • 4. Exercise 2 – Decision Tree A B C D RESULT F F F F F F F F T F F F T F F F F T T F F T F F F F T F T F F T T F F F T T T T T F F F F T F F T F T F T F F T F T T T T T F F F T T F T F T T T F F T T T T T (A OR B) AND (B OR C) AND (C AND D) A B B false true false true false true c false true D false c false D false cfalse true true D false true Amir Shokri
  • 5. Exercise 2 – Decision Tree Amir Shokri Example Size Color Shape Class/Label 1 big red circle No 2 big red triangle Yes 3 small red circle No 4 big red triangle No 5 small blue circle No size shape big small circle triangle
  • 6. Exercise 2 – FIND-S Amir Shokri Example Size Color Shape Class/Label 1 big red circle No 2 big red triangle Yes 3 small red circle No 4 big red triangle No 5 small blue circle No h0 = < ∅ , ∅ , ∅ > h1 = < ∅ , ∅ , ∅ > h2 = < big, red, triangle > h3 = < big, red, triangle > h4 = < big, red, triangle >
  • 7. Exercise 2 – Candidate elimination Amir Shokri Example Size Color Shape Class/Label 1 big red circle No 2 big red triangle Yes 3 small red circle No 4 big red triangle No 5 small blue circle No S0 = < ∅ , ∅ , ∅ > G0 = < ?, ?, ? >
  • 8. Exercise 2 – Candidate elimination Amir Shokri Example Size Color Shape Class/Label 1 big red circle No 2 big red triangle Yes 3 small red circle No 4 big red triangle No 5 small blue circle No S1 = < ∅ , ∅ , ∅ > G1 = < small, ?, ?> < ?, blue, ? > < ?, ? ,triangle >
  • 9. Exercise 2 – Candidate elimination Amir Shokri Example Size Color Shape Class/Label 1 big red circle No 2 big red triangle Yes 3 small red circle No 4 big red triangle No 5 small blue circle No S3 = < big, red, triangle > G3 = < ?, ? ,triangle >
  • 10. Exercise 2 – Candidate elimination Amir Shokri Example Size Color Shape Class/Label 1 big red circle No 2 big red triangle Yes 3 small red circle No 4 big red triangle No 5 small blue circle No S4 = < big, red, triangle > G4 = < ?, ? ,triangle >
  • 11. Exercise 2 – ID3 Amir Shokri Example Size Color Shape Class/Label 1 big red circle No 2 big red triangle Yes 3 small red circle No 4 big red triangle No 5 small blue circle No Entropy : Entropy(S) : Gain(S, A): ෍ 𝑖=1 −𝑝𝑖 ∗ log2(𝑝𝑖) (−𝑝+ log2 𝑝+ ) − (−𝑝− log2 𝑝− ) 𝐸𝑛𝑡𝑟𝑜𝑝ℎ𝑦 𝑆 − ෍ 𝑣=𝑉𝑎𝑙𝑢𝑒𝑠(𝐴) 𝑆 𝑣 𝑆 𝐸𝑛𝑡𝑟𝑜𝑝ℎ𝑦(𝑆 𝑣)
  • 12. Exercise 2 – ID3 Amir Shokri Example Size Color Shape Class/Label 1 big red circle No 2 big red triangle Yes 3 small red circle No 4 big red triangle No 5 small blue circle No σ𝑖=1 −𝑝𝑖 ∗ log2 𝑝𝑖 = − 3 4 log2 3 4 − 1 4 log2 1 4 = 0.307 + 0.5 = 0.87 Entropy
  • 13. Exercise 2 – ID3 Amir Shokri Example Size Color Shape Class/Label 1 big red circle No 2 big red triangle Yes 3 small red circle No 4 big red triangle No 5 small blue circle No Gain size: 𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑠𝑚𝑎𝑙𝑙 => − 2 4 0 2 log 0 2 + 2 2 log 2 2 𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑏𝑖𝑔 => − 2 4 1 2 log 1 2 + 1 2 log 1 2 𝐺𝑎𝑖𝑛 𝑆, size = 0.87 − 0 + 0.5 = 0.37
  • 14. Exercise 2 – ID3 Amir Shokri Example Size Color Shape Class/Label 1 big red circle No 2 big red triangle Yes 3 small red circle No 4 big red triangle No 5 small blue circle No Gain color: 𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑟𝑒𝑑 => − 3 4 2 3 log 2 3 + 1 3 log 1 3 𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑏𝑙𝑢𝑒 => − 1 4 1 1 log 1 1 + 0 1 log 0 1 𝐺𝑎𝑖𝑛 𝑆, color = 0.87 − 0.29 + 0 = 0.58
  • 15. Exercise 2 – ID3 Amir Shokri Example Size Color Shape Class/Label 1 big red circle No 2 big red triangle Yes 3 small red circle No 4 big red triangle No 5 small blue circle No Gain shape: 𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑐𝑖𝑟𝑐𝑙𝑒 => − 3 4 0 3 log 0 3 + 3 3 log 3 3 𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑡𝑟𝑖𝑎𝑛𝑔𝑙𝑒 => − 1 4 1 1 log 1 1 + 0 1 log 0 1 𝐺𝑎𝑖𝑛 𝑆, shape = 0.87 − 0 + 0 = 0.87
  • 16. Exercise 2 – ID3 Amir Shokri Example Size Color Shape Class/Label 1 big red circle No 2 big red triangle Yes 3 small red circle No 4 big red triangle No 5 small blue circle No shape circle triangle