SlideShare a Scribd company logo
Tilani Gunawardena
Covering(Rule-Based)
Algorithms
Example: generating a rule
• Possible rule set for class “a”
• If x > 1.2 then class = a
• If x > 1.2 and y > 2.6 then class = a
• Possible rule set for class “b”:
• If x ≤ 1.2 then class = b
• If x > 1.2 and y ≤ 2.6 then class = b
• Could add more rules, get “perfect” rule set
• Corresponding decision tree: (produces exactly the same
predictions)
• But: rule sets can be more perspicuous when decision trees
suffer from replicated subtrees
• Also: in multiclass situations, covering algorithm
concentrates on one class at a time whereas decision tree
learner takes all classes into account
Rules vs Trees
• Generates a rule by adding tests that
maximize rule’s accuracy
• Similar to situation in decision trees: problem
of selecting an attribute to split on
• Each new test reduces rule’s coverage:
Simple covering algorithm
• Convert decision tree into a rule set
– Straightforward, but rule set overly complex
– More effective conversions are not trivial
• Instead, can generate rule set directly
– for each class in turn find rule set that covers all
instances in it
(excluding instances not in the class)
• Called a covering approach:
– at each stage a rule is identified that “covers”
some of the instances
Covering Algorithms
Selecting a test
• Goal: maximize accuracy
– t total number of instances covered by rule
– p positive examples of the class covered by rule
– t – p number of errors made by rule
 Select test that maximizes the ratio p/t
• We are finished when p/t = 1 or the set of instances can’t be
split any further
Age Spectacle prescription Astigmatism Tear production rate Recommended lenses
Young Myope No Reduced None
Young Myope No Normal Soft
Young Myope Yes Reduced None
Young Myope Yes Normal Hard
Young Hypermetrope No Reduced None
Young Hypermetrope No Normal Soft
Young Hypermetrope Yes Reduced None
Young Hypermetrope Yes Normal Hard
Pre-presbyopic Myope No Reduced None
Pre-presbyopic Myope No Normal Soft
Pre-presbyopic Myope Yes Reduced None
Pre-presbyopic Myope Yes Normal Hard
Pre-presbyopic Hypermetrope No Reduced None
Pre-presbyopic Hypermetrope No Normal Soft
Pre-presbyopic Hypermetrope Yes Reduced None
Pre-presbyopic Hypermetrope Yes Normal None
Presbyopic Myope No Reduced None
Presbyopic Myope No Normal None
Presbyopic Myope Yes Reduced None
Presbyopic Myope Yes Normal Hard
Presbyopic Hypermetrope No Reduced None
Presbyopic Hypermetrope No Normal Soft
Presbyopic Hypermetrope Yes Reduced None
Presbyopic Hypermetrope Yes Normal None
Example: Contact lens data
• Rule we seek:
• Possible tests:
Age = Young
Age = Pre-presbyopic
Age = Presbyopic
Spectacle prescription = Myope
Spectacle prescription = Hypermetrope
Astigmatism = no
Astigmatism = yes
Tear production rate = Reduced
Tear production rate = Normal
If ?
then recommendation = hard
Example: Contact lens data
• Rule we seek:
• Possible tests:
Age = Young 2/8
Age = Pre-presbyopic 1/8
Age = Presbyopic 1/8
Spectacle prescription = Myope 3/12
Spectacle prescription = Hypermetrope 1/12
Astigmatism = no 0/12
Astigmatism = yes 4/12
Tear production rate = Reduced 0/12
Tear production rate = Normal 4/12
If ?
then recommendation = hard
Modified rule and resulting data
• Rule with best test added:
• Instances covered by modified rule:
Age Spectacle prescription Astigmatism Tear production rate Recommended lenses
Young Myope Yes Reduced None
Young Myope Yes Normal Hard
Young Hypermetrope Yes Reduced None
Young Hypermetrope Yes Normal hard
Pre-presbyopic Myope Yes Reduced None
Pre-presbyopic Myope Yes Normal Hard
Pre-presbyopic Hypermetrope Yes Reduced None
Pre-presbyopic Hypermetrope Yes Normal None
Presbyopic Myope Yes Reduced None
Presbyopic Myope Yes Normal Hard
Presbyopic Hypermetrope Yes Reduced None
Presbyopic Hypermetrope Yes Normal None
If astigmatism = yes
then recommendation = hard
Further refinement
• Current state:
• Possible tests:
Age = Young
Age = Pre-presbyopic
Age = Presbyopic
Spectacle prescription = Myope
Spectacle prescription = Hypermetrope
Tear production rate = Reduced
Tear production rate = Normal
If astigmatism = yes
and ?
then recommendation = hard
Further refinement
• Current state:
• Possible tests:
Age = Young 2/4
Age = Pre-presbyopic 1/4
Age = Presbyopic 1/4
Spectacle prescription = Myope 3/6
Spectacle prescription = Hypermetrope 1/6
Tear production rate = Reduced 0/6
Tear production rate = Normal 4/6
If astigmatism = yes
and ?
then recommendation = hard
Modified rule and resulting data
• Rule with best test added:
• Instances covered by modified rule:
Age Spectacle prescription Astigmatism Tear production rate Recommended
lenses
Young Myope Yes Normal Hard
Young Hypermetrope Yes Normal hard
Pre-presbyopic Myope Yes Normal Hard
Pre-presbyopic Hypermetrope Yes Normal None
Presbyopic Myope Yes Normal Hard
Presbyopic Hypermetrope Yes Normal None
If astigmatism = yes
and tear production rate = normal
then recommendation = hard
Further refinement
• Current state:
• Possible tests:
• Tie between the first and the fourth test
– We choose the one with greater coverage
Age = Young 2/2
Age = Pre-presbyopic 1/2
Age = Presbyopic 1/2
Spectacle prescription = Myope 3/3
Spectacle prescription = Hypermetrope 1/3
If astigmatism = yes
and tear production rate = normal
and ?
then recommendation = hard
The result
• Final rule:
• Second rule for recommending “hard lenses”:
(built from instances not covered by first rule)
If astigmatism = yes
and tear production rate = normal
and spectacle prescription = myope
then recommendation = hard
Age Spectacle prescription Astigmatism Tear production rate Recommended lenses
Young Myope No Reduced None
Young Myope No Normal Soft
Young Myope Yes Reduced None
Young Myope Yes Normal Hard
Young Hypermetrope No Reduced None
Young Hypermetrope No Normal Soft
Young Hypermetrope Yes Reduced None
Young Hypermetrope Yes Normal Hard
Pre-presbyopic Myope No Reduced None
Pre-presbyopic Myope No Normal Soft
Pre-presbyopic Myope Yes Reduced None
Pre-presbyopic Myope Yes Normal Hard
Pre-presbyopic Hypermetrope No Reduced None
Pre-presbyopic Hypermetrope No Normal Soft
Pre-presbyopic Hypermetrope Yes Reduced None
Pre-presbyopic Hypermetrope Yes Normal None
Presbyopic Myope No Reduced None
Presbyopic Myope No Normal None
Presbyopic Myope Yes Reduced None
Presbyopic Myope Yes Normal Hard
Presbyopic Hypermetrope No Reduced None
Presbyopic Hypermetrope No Normal Soft
Presbyopic Hypermetrope Yes Reduced None
Presbyopic Hypermetrope Yes Normal None
Age Spectacle prescription Astigmatism Tear production rate Recommended lenses
Young Myope No Reduced None
Young Myope No Normal Soft
Young Myope Yes Reduced None
Young Myope Yes Normal Hard
Young Hypermetrope No Reduced None
Young Hypermetrope No Normal Soft
Young Hypermetrope Yes Reduced None
Young Hypermetrope Yes Normal Hard
Pre-presbyopic Myope No Reduced None
Pre-presbyopic Myope No Normal Soft
Pre-presbyopic Myope Yes Reduced None
Pre-presbyopic Myope Yes Normal Hard
Pre-presbyopic Hypermetrope No Reduced None
Pre-presbyopic Hypermetrope No Normal Soft
Pre-presbyopic Hypermetrope Yes Reduced None
Pre-presbyopic Hypermetrope Yes Normal None
Presbyopic Myope No Reduced None
Presbyopic Myope No Normal None
Presbyopic Myope Yes Reduced None
Presbyopic Myope Yes Normal Hard
Presbyopic Hypermetrope No Reduced None
Presbyopic Hypermetrope No Normal Soft
Presbyopic Hypermetrope Yes Reduced None
Presbyopic Hypermetrope Yes Normal None
Age Spectacle prescription Astigmatism Tear production rate Recommended lenses
Young Myope No Reduced None
Young Myope No Normal Soft
Young Myope Yes Reduced None
Young Hypermetrope No Reduced None
Young Hypermetrope No Normal Soft
Young Hypermetrope Yes Reduced None
Young Hypermetrope Yes Normal Hard
Pre-presbyopic Myope No Reduced None
Pre-presbyopic Myope No Normal Soft
Pre-presbyopic Myope Yes Reduced None
Pre-presbyopic Hypermetrope No Reduced None
Pre-presbyopic Hypermetrope No Normal Soft
Pre-presbyopic Hypermetrope Yes Reduced None
Pre-presbyopic Hypermetrope Yes Normal None
Presbyopic Myope No Reduced None
Presbyopic Myope No Normal None
Presbyopic Myope Yes Reduced None
Presbyopic Hypermetrope No Reduced None
Presbyopic Hypermetrope No Normal Soft
Presbyopic Hypermetrope Yes Reduced None
Presbyopic Hypermetrope Yes Normal None
Example: Contact lens data
• Rule we seek:
• Possible tests:
Age = Young
Age = Pre-presbyopic
Age = Presbyopic
Spectacle prescription = Myope
Spectacle prescription = Hypermetrope
Astigmatism = no
Astigmatism = yes
Tear production rate = Reduced
Tear production rate = Normal
If ?
then recommendation = hard
Example: Contact lens data
• Rule we seek:
• Possible tests:
Age = Young 1/7
Age = Pre-presbyopic 0/7
Age = Presbyopic 0/7
Spectacle prescription = Myope 0/9
Spectacle prescription = Hypermetrope 1/12
Astigmatism = no 0/12
Astigmatism = yes 1/9
Tear production rate = Reduced 0/12
Tear production rate = Normal 1/9
If ?
then recommendation = hard
Modified rule and resulting data
• Rule with best test added:
• Instances covered by modified rule:
If age = Young
then recommendation = hard
Age Spectacle prescription Astigmatism Tear production rate Recommended lenses
Young Myope No Reduced None
Young Myope No Normal Soft
Young Myope Yes Reduced None
Young Hypermetrope No Reduced None
Young Hypermetrope No Normal Soft
Young Hypermetrope Yes Reduced None
Young Hypermetrope Yes Normal Hard
Further refinement
• Current state:
• Possible tests:
If age = Young
and ?
then recommendation = hard
Spectacle prescription = Myope
Spectacle prescription = Hypermetrope
Astigmatism = no
Astigmatism = yes
Tear production rate = Reduced
Tear production rate = Normal
Further refinement
• Current state:
• Possible tests:
If age = Young
and ?
then recommendation = hard
Spectacle prescription = Myope 0/3
Spectacle prescription = Hypermetrope 1/4
Astigmatism = no 0/4
Astigmatism = yes 1/3
Tear production rate = Reduced 0/4
Tear production rate = Normal 1/3
Modified rule and resulting data
• Rule with best test added:
• Instances covered by modified rule:
If age = Young
and Astigmatism = yes
then recommendation = hard
Age Spectacle prescription Astigmatism Tear production rate Recommended lenses
Young Myope Yes Reduced None
Young Hypermetrope Yes Reduced None
Young Hypermetrope Yes Normal Hard
Further refinement
• Current state:
• Possible tests:
Spectacle prescription = Myope
Spectacle prescription = Hypermetrope
Tear production rate = Reduced
Tear production rate = Normal
If age = Young
and Astigmatism = yes
and ?
then recommendation = hard
Further refinement
• Current state:
• Possible tests:
Spectacle prescription = Myope 0/1
Spectacle prescription = Hypermetrope 1/2
Tear production rate = Reduced 0/2
Tear production rate = Normal 1/1
If age = Young
and Astigmatism = yes
and ?
then recommendation = hard
Final Results
If age = Young
and astigmatism = yes
and tear production rate=normal
then recommendation = hard
Age Spectacle prescription Astigmatism Tear production rate Recommended lenses
Young Myope Yes Normal Hard
Young Hypermetrope Yes Normal Hard
If astigmatism = yes
and tear production rate = normal
and spectacle prescription = myope
then recommendation = hard
Age Spectacle prescription Astigmatism Tear production rate Recommended lenses
Young Myope Yes Normal Hard
Pre-presbyopic Myope Yes Normal Hard
Presbyopic Myope Yes Normal Hard
Pseudo-code for PRISM
For each class C
Initialize E to the instance set
While E contains instances in class C
Create a rule R with an empty left-hand side that predicts class C
Until R is perfect (or there are no more attributes to use) do
For each attribute A not mentioned in R, and each value v,
Consider adding the condition A = v to the left-hand side of R
Select A and v to maximize the accuracy p/t
(break ties by choosing the condition with the largest p)
Add A = v to R
Remove the instances covered by R from E
• PRISM with outer loop removed generates a
decision list for one class
– Subsequent rules are designed for rules that are
not covered by previous rules
– Order doesn’t matter because all rules predict the
same class
• Outer loop considers all classes separately
– No order dependence implied
Separate and conquer
• Methods like PRISM (for dealing with one
class) are separate-and-conquer algorithms:
– First, a rule is identified
– Then, all instances covered by the rule are
separated out
– Finally, the remaining instances are “conquered”
• Difference to divide-and-conquer methods:
– Subset covered by rule doesn’t need to be
explored any further

More Related Content

What's hot (20)

PPTX
Credit Card Fraud PPT - Reena Prajapati.pptx
Boston Institute of Analytics
 
PDF
Mining Frequent Patterns And Association Rules
Rashmi Bhat
 
PDF
Perspective in Informatics 3 - Assignment 2 - Answer Sheet
Hoang Nguyen Phong
 
PDF
Machine Learning at Netflix Scale
Aish Fenton
 
PPTX
Classification techniques in data mining
Kamal Acharya
 
PDF
Decision trees & random forests
SC5.io
 
PDF
4. Block Ciphers
Sam Bowne
 
PPTX
Introduction to Data Mining and Data Warehousing
Kamal Acharya
 
PPTX
Symmetric encryption and message confidentiality
CAS
 
PPT
Neural Networks in Data Mining - “An Overview”
Dr.(Mrs).Gethsiyal Augasta
 
PDF
Uint-4 Mining Data Stream.pdf
Sitamarhi Institute of Technology
 
PPTX
Lecture 18: Gaussian Mixture Models and Expectation Maximization
butest
 
PPTX
Machine Learning Project - Email Spam Filtering using Enron Dataset
Aman Singhla
 
PPT
Knowledge Discovery Using Data Mining
parthvora18
 
PPTX
Ensemble methods in machine learning
SANTHOSH RAJA M G
 
PPTX
AI_Session 17 CSP.pptx
Guru Nanak Technical Institutions
 
PPTX
Hybrid encryption ppt
prashantdahake
 
PDF
Anomaly detection (Unsupervised Learning) in Machine Learning
Kuppusamy P
 
PDF
Naive Bayes
CloudxLab
 
PDF
Matrix Factorization In Recommender Systems
YONG ZHENG
 
Credit Card Fraud PPT - Reena Prajapati.pptx
Boston Institute of Analytics
 
Mining Frequent Patterns And Association Rules
Rashmi Bhat
 
Perspective in Informatics 3 - Assignment 2 - Answer Sheet
Hoang Nguyen Phong
 
Machine Learning at Netflix Scale
Aish Fenton
 
Classification techniques in data mining
Kamal Acharya
 
Decision trees & random forests
SC5.io
 
4. Block Ciphers
Sam Bowne
 
Introduction to Data Mining and Data Warehousing
Kamal Acharya
 
Symmetric encryption and message confidentiality
CAS
 
Neural Networks in Data Mining - “An Overview”
Dr.(Mrs).Gethsiyal Augasta
 
Uint-4 Mining Data Stream.pdf
Sitamarhi Institute of Technology
 
Lecture 18: Gaussian Mixture Models and Expectation Maximization
butest
 
Machine Learning Project - Email Spam Filtering using Enron Dataset
Aman Singhla
 
Knowledge Discovery Using Data Mining
parthvora18
 
Ensemble methods in machine learning
SANTHOSH RAJA M G
 
AI_Session 17 CSP.pptx
Guru Nanak Technical Institutions
 
Hybrid encryption ppt
prashantdahake
 
Anomaly detection (Unsupervised Learning) in Machine Learning
Kuppusamy P
 
Naive Bayes
CloudxLab
 
Matrix Factorization In Recommender Systems
YONG ZHENG
 

Similar to Covering algorithm (20)

PDF
Dbm630 lecture04
Tokyo Institute of Technology
 
PDF
Machine Learning and Data Mining: 10 Introduction to Classification
Pier Luca Lanzi
 
PPTX
Glasses prescription clinical tips.pptx
Mohamed Elkadim
 
PPTX
RR and Rx.pptx
mikaelgirum
 
PPTX
Glass prescription among youngs and educate elderly about
Dr.Amarendra Kumar
 
PDF
Lesson #1 Data Mining and concepts Topic.pdf
solishennessyvince
 
PDF
Data Mining - Practical Machine Learning.pdf
OBERDAN PINHEIRO
 
PPT
Real Refractive error and spectacle correction.ppt
Bipin Koirala
 
PPTX
High myopia and management
sabina paudel
 
PDF
Lecture 03 Data Representation
Pier Luca Lanzi
 
PPT
Spectacle prescription
Richa Naik
 
PPT
Refraction-I.ppt
Harshika Malik
 
PPTX
Management of visual problems of Aging by Ashith Tripathi
Ashith Tripathi
 
PDF
Crash Course: Prescribing Eyeglasses in Children
Alvina Pauline Santiago, MD
 
PPTX
Prescription of glasses in children
Eranda Wannigama
 
PPT
Presbyopia
GauriSShrestha
 
PPTX
CASE PRESENTATION ON PRESBYOPIA.pptx
BARNABASMUGABI
 
PPTX
CASE PRESENTATION ON PRESBYOPIA.pptx
BARNABASMUGABI
 
Machine Learning and Data Mining: 10 Introduction to Classification
Pier Luca Lanzi
 
Glasses prescription clinical tips.pptx
Mohamed Elkadim
 
RR and Rx.pptx
mikaelgirum
 
Glass prescription among youngs and educate elderly about
Dr.Amarendra Kumar
 
Lesson #1 Data Mining and concepts Topic.pdf
solishennessyvince
 
Data Mining - Practical Machine Learning.pdf
OBERDAN PINHEIRO
 
Real Refractive error and spectacle correction.ppt
Bipin Koirala
 
High myopia and management
sabina paudel
 
Lecture 03 Data Representation
Pier Luca Lanzi
 
Spectacle prescription
Richa Naik
 
Refraction-I.ppt
Harshika Malik
 
Management of visual problems of Aging by Ashith Tripathi
Ashith Tripathi
 
Crash Course: Prescribing Eyeglasses in Children
Alvina Pauline Santiago, MD
 
Prescription of glasses in children
Eranda Wannigama
 
Presbyopia
GauriSShrestha
 
CASE PRESENTATION ON PRESBYOPIA.pptx
BARNABASMUGABI
 
CASE PRESENTATION ON PRESBYOPIA.pptx
BARNABASMUGABI
 
Ad

More from Tilani Gunawardena PhD(UNIBAS), BSc(Pera), FHEA(UK), CEng, MIESL (20)

PDF
Introduction to data mining and machine learning
Tilani Gunawardena PhD(UNIBAS), BSc(Pera), FHEA(UK), CEng, MIESL
 
PPTX
Cheetah:Data Warehouse on Top of MapReduce
Tilani Gunawardena PhD(UNIBAS), BSc(Pera), FHEA(UK), CEng, MIESL
 
PPTX
Interpreting the Data:Parallel Analysis with Sawzall
Tilani Gunawardena PhD(UNIBAS), BSc(Pera), FHEA(UK), CEng, MIESL
 
Introduction to data mining and machine learning
Tilani Gunawardena PhD(UNIBAS), BSc(Pera), FHEA(UK), CEng, MIESL
 
Cheetah:Data Warehouse on Top of MapReduce
Tilani Gunawardena PhD(UNIBAS), BSc(Pera), FHEA(UK), CEng, MIESL
 
Interpreting the Data:Parallel Analysis with Sawzall
Tilani Gunawardena PhD(UNIBAS), BSc(Pera), FHEA(UK), CEng, MIESL
 
Ad

Recently uploaded (20)

PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PPTX
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PPTX
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PDF
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PDF
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
PDF
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 

Covering algorithm

  • 2. Example: generating a rule • Possible rule set for class “a” • If x > 1.2 then class = a • If x > 1.2 and y > 2.6 then class = a • Possible rule set for class “b”: • If x ≤ 1.2 then class = b • If x > 1.2 and y ≤ 2.6 then class = b • Could add more rules, get “perfect” rule set
  • 3. • Corresponding decision tree: (produces exactly the same predictions) • But: rule sets can be more perspicuous when decision trees suffer from replicated subtrees • Also: in multiclass situations, covering algorithm concentrates on one class at a time whereas decision tree learner takes all classes into account Rules vs Trees
  • 4. • Generates a rule by adding tests that maximize rule’s accuracy • Similar to situation in decision trees: problem of selecting an attribute to split on • Each new test reduces rule’s coverage: Simple covering algorithm
  • 5. • Convert decision tree into a rule set – Straightforward, but rule set overly complex – More effective conversions are not trivial • Instead, can generate rule set directly – for each class in turn find rule set that covers all instances in it (excluding instances not in the class) • Called a covering approach: – at each stage a rule is identified that “covers” some of the instances Covering Algorithms
  • 6. Selecting a test • Goal: maximize accuracy – t total number of instances covered by rule – p positive examples of the class covered by rule – t – p number of errors made by rule  Select test that maximizes the ratio p/t • We are finished when p/t = 1 or the set of instances can’t be split any further
  • 7. Age Spectacle prescription Astigmatism Tear production rate Recommended lenses Young Myope No Reduced None Young Myope No Normal Soft Young Myope Yes Reduced None Young Myope Yes Normal Hard Young Hypermetrope No Reduced None Young Hypermetrope No Normal Soft Young Hypermetrope Yes Reduced None Young Hypermetrope Yes Normal Hard Pre-presbyopic Myope No Reduced None Pre-presbyopic Myope No Normal Soft Pre-presbyopic Myope Yes Reduced None Pre-presbyopic Myope Yes Normal Hard Pre-presbyopic Hypermetrope No Reduced None Pre-presbyopic Hypermetrope No Normal Soft Pre-presbyopic Hypermetrope Yes Reduced None Pre-presbyopic Hypermetrope Yes Normal None Presbyopic Myope No Reduced None Presbyopic Myope No Normal None Presbyopic Myope Yes Reduced None Presbyopic Myope Yes Normal Hard Presbyopic Hypermetrope No Reduced None Presbyopic Hypermetrope No Normal Soft Presbyopic Hypermetrope Yes Reduced None Presbyopic Hypermetrope Yes Normal None
  • 8. Example: Contact lens data • Rule we seek: • Possible tests: Age = Young Age = Pre-presbyopic Age = Presbyopic Spectacle prescription = Myope Spectacle prescription = Hypermetrope Astigmatism = no Astigmatism = yes Tear production rate = Reduced Tear production rate = Normal If ? then recommendation = hard
  • 9. Example: Contact lens data • Rule we seek: • Possible tests: Age = Young 2/8 Age = Pre-presbyopic 1/8 Age = Presbyopic 1/8 Spectacle prescription = Myope 3/12 Spectacle prescription = Hypermetrope 1/12 Astigmatism = no 0/12 Astigmatism = yes 4/12 Tear production rate = Reduced 0/12 Tear production rate = Normal 4/12 If ? then recommendation = hard
  • 10. Modified rule and resulting data • Rule with best test added: • Instances covered by modified rule: Age Spectacle prescription Astigmatism Tear production rate Recommended lenses Young Myope Yes Reduced None Young Myope Yes Normal Hard Young Hypermetrope Yes Reduced None Young Hypermetrope Yes Normal hard Pre-presbyopic Myope Yes Reduced None Pre-presbyopic Myope Yes Normal Hard Pre-presbyopic Hypermetrope Yes Reduced None Pre-presbyopic Hypermetrope Yes Normal None Presbyopic Myope Yes Reduced None Presbyopic Myope Yes Normal Hard Presbyopic Hypermetrope Yes Reduced None Presbyopic Hypermetrope Yes Normal None If astigmatism = yes then recommendation = hard
  • 11. Further refinement • Current state: • Possible tests: Age = Young Age = Pre-presbyopic Age = Presbyopic Spectacle prescription = Myope Spectacle prescription = Hypermetrope Tear production rate = Reduced Tear production rate = Normal If astigmatism = yes and ? then recommendation = hard
  • 12. Further refinement • Current state: • Possible tests: Age = Young 2/4 Age = Pre-presbyopic 1/4 Age = Presbyopic 1/4 Spectacle prescription = Myope 3/6 Spectacle prescription = Hypermetrope 1/6 Tear production rate = Reduced 0/6 Tear production rate = Normal 4/6 If astigmatism = yes and ? then recommendation = hard
  • 13. Modified rule and resulting data • Rule with best test added: • Instances covered by modified rule: Age Spectacle prescription Astigmatism Tear production rate Recommended lenses Young Myope Yes Normal Hard Young Hypermetrope Yes Normal hard Pre-presbyopic Myope Yes Normal Hard Pre-presbyopic Hypermetrope Yes Normal None Presbyopic Myope Yes Normal Hard Presbyopic Hypermetrope Yes Normal None If astigmatism = yes and tear production rate = normal then recommendation = hard
  • 14. Further refinement • Current state: • Possible tests: • Tie between the first and the fourth test – We choose the one with greater coverage Age = Young 2/2 Age = Pre-presbyopic 1/2 Age = Presbyopic 1/2 Spectacle prescription = Myope 3/3 Spectacle prescription = Hypermetrope 1/3 If astigmatism = yes and tear production rate = normal and ? then recommendation = hard
  • 15. The result • Final rule: • Second rule for recommending “hard lenses”: (built from instances not covered by first rule) If astigmatism = yes and tear production rate = normal and spectacle prescription = myope then recommendation = hard
  • 16. Age Spectacle prescription Astigmatism Tear production rate Recommended lenses Young Myope No Reduced None Young Myope No Normal Soft Young Myope Yes Reduced None Young Myope Yes Normal Hard Young Hypermetrope No Reduced None Young Hypermetrope No Normal Soft Young Hypermetrope Yes Reduced None Young Hypermetrope Yes Normal Hard Pre-presbyopic Myope No Reduced None Pre-presbyopic Myope No Normal Soft Pre-presbyopic Myope Yes Reduced None Pre-presbyopic Myope Yes Normal Hard Pre-presbyopic Hypermetrope No Reduced None Pre-presbyopic Hypermetrope No Normal Soft Pre-presbyopic Hypermetrope Yes Reduced None Pre-presbyopic Hypermetrope Yes Normal None Presbyopic Myope No Reduced None Presbyopic Myope No Normal None Presbyopic Myope Yes Reduced None Presbyopic Myope Yes Normal Hard Presbyopic Hypermetrope No Reduced None Presbyopic Hypermetrope No Normal Soft Presbyopic Hypermetrope Yes Reduced None Presbyopic Hypermetrope Yes Normal None
  • 17. Age Spectacle prescription Astigmatism Tear production rate Recommended lenses Young Myope No Reduced None Young Myope No Normal Soft Young Myope Yes Reduced None Young Myope Yes Normal Hard Young Hypermetrope No Reduced None Young Hypermetrope No Normal Soft Young Hypermetrope Yes Reduced None Young Hypermetrope Yes Normal Hard Pre-presbyopic Myope No Reduced None Pre-presbyopic Myope No Normal Soft Pre-presbyopic Myope Yes Reduced None Pre-presbyopic Myope Yes Normal Hard Pre-presbyopic Hypermetrope No Reduced None Pre-presbyopic Hypermetrope No Normal Soft Pre-presbyopic Hypermetrope Yes Reduced None Pre-presbyopic Hypermetrope Yes Normal None Presbyopic Myope No Reduced None Presbyopic Myope No Normal None Presbyopic Myope Yes Reduced None Presbyopic Myope Yes Normal Hard Presbyopic Hypermetrope No Reduced None Presbyopic Hypermetrope No Normal Soft Presbyopic Hypermetrope Yes Reduced None Presbyopic Hypermetrope Yes Normal None
  • 18. Age Spectacle prescription Astigmatism Tear production rate Recommended lenses Young Myope No Reduced None Young Myope No Normal Soft Young Myope Yes Reduced None Young Hypermetrope No Reduced None Young Hypermetrope No Normal Soft Young Hypermetrope Yes Reduced None Young Hypermetrope Yes Normal Hard Pre-presbyopic Myope No Reduced None Pre-presbyopic Myope No Normal Soft Pre-presbyopic Myope Yes Reduced None Pre-presbyopic Hypermetrope No Reduced None Pre-presbyopic Hypermetrope No Normal Soft Pre-presbyopic Hypermetrope Yes Reduced None Pre-presbyopic Hypermetrope Yes Normal None Presbyopic Myope No Reduced None Presbyopic Myope No Normal None Presbyopic Myope Yes Reduced None Presbyopic Hypermetrope No Reduced None Presbyopic Hypermetrope No Normal Soft Presbyopic Hypermetrope Yes Reduced None Presbyopic Hypermetrope Yes Normal None
  • 19. Example: Contact lens data • Rule we seek: • Possible tests: Age = Young Age = Pre-presbyopic Age = Presbyopic Spectacle prescription = Myope Spectacle prescription = Hypermetrope Astigmatism = no Astigmatism = yes Tear production rate = Reduced Tear production rate = Normal If ? then recommendation = hard
  • 20. Example: Contact lens data • Rule we seek: • Possible tests: Age = Young 1/7 Age = Pre-presbyopic 0/7 Age = Presbyopic 0/7 Spectacle prescription = Myope 0/9 Spectacle prescription = Hypermetrope 1/12 Astigmatism = no 0/12 Astigmatism = yes 1/9 Tear production rate = Reduced 0/12 Tear production rate = Normal 1/9 If ? then recommendation = hard
  • 21. Modified rule and resulting data • Rule with best test added: • Instances covered by modified rule: If age = Young then recommendation = hard Age Spectacle prescription Astigmatism Tear production rate Recommended lenses Young Myope No Reduced None Young Myope No Normal Soft Young Myope Yes Reduced None Young Hypermetrope No Reduced None Young Hypermetrope No Normal Soft Young Hypermetrope Yes Reduced None Young Hypermetrope Yes Normal Hard
  • 22. Further refinement • Current state: • Possible tests: If age = Young and ? then recommendation = hard Spectacle prescription = Myope Spectacle prescription = Hypermetrope Astigmatism = no Astigmatism = yes Tear production rate = Reduced Tear production rate = Normal
  • 23. Further refinement • Current state: • Possible tests: If age = Young and ? then recommendation = hard Spectacle prescription = Myope 0/3 Spectacle prescription = Hypermetrope 1/4 Astigmatism = no 0/4 Astigmatism = yes 1/3 Tear production rate = Reduced 0/4 Tear production rate = Normal 1/3
  • 24. Modified rule and resulting data • Rule with best test added: • Instances covered by modified rule: If age = Young and Astigmatism = yes then recommendation = hard Age Spectacle prescription Astigmatism Tear production rate Recommended lenses Young Myope Yes Reduced None Young Hypermetrope Yes Reduced None Young Hypermetrope Yes Normal Hard
  • 25. Further refinement • Current state: • Possible tests: Spectacle prescription = Myope Spectacle prescription = Hypermetrope Tear production rate = Reduced Tear production rate = Normal If age = Young and Astigmatism = yes and ? then recommendation = hard
  • 26. Further refinement • Current state: • Possible tests: Spectacle prescription = Myope 0/1 Spectacle prescription = Hypermetrope 1/2 Tear production rate = Reduced 0/2 Tear production rate = Normal 1/1 If age = Young and Astigmatism = yes and ? then recommendation = hard
  • 27. Final Results If age = Young and astigmatism = yes and tear production rate=normal then recommendation = hard Age Spectacle prescription Astigmatism Tear production rate Recommended lenses Young Myope Yes Normal Hard Young Hypermetrope Yes Normal Hard If astigmatism = yes and tear production rate = normal and spectacle prescription = myope then recommendation = hard Age Spectacle prescription Astigmatism Tear production rate Recommended lenses Young Myope Yes Normal Hard Pre-presbyopic Myope Yes Normal Hard Presbyopic Myope Yes Normal Hard
  • 28. Pseudo-code for PRISM For each class C Initialize E to the instance set While E contains instances in class C Create a rule R with an empty left-hand side that predicts class C Until R is perfect (or there are no more attributes to use) do For each attribute A not mentioned in R, and each value v, Consider adding the condition A = v to the left-hand side of R Select A and v to maximize the accuracy p/t (break ties by choosing the condition with the largest p) Add A = v to R Remove the instances covered by R from E
  • 29. • PRISM with outer loop removed generates a decision list for one class – Subsequent rules are designed for rules that are not covered by previous rules – Order doesn’t matter because all rules predict the same class • Outer loop considers all classes separately – No order dependence implied
  • 30. Separate and conquer • Methods like PRISM (for dealing with one class) are separate-and-conquer algorithms: – First, a rule is identified – Then, all instances covered by the rule are separated out – Finally, the remaining instances are “conquered” • Difference to divide-and-conquer methods: – Subset covered by rule doesn’t need to be explored any further