0% found this document useful (0 votes)
6 views3 pages

Ex - No.2 - Find S Algorithm

Uploaded by

neospirit29
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Ex - No.2 - Find S Algorithm

Uploaded by

neospirit29
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Ex.

No:2 Find S-algorithm

Objective:

The find-S algorithm is a basic concept learning algorithm in machine learning. The find-S
algorithm finds the most specific hypothesis that fits all the positive examples. The algorithm
considers only those positive training examples. The find-S algorithm starts with the most
specific hypothesis and generalizes this hypothesis each time it fails to classify an observed
positive training data. Hence, the Find-S algorithm moves from the most specific hypothesis
to the most general hypothesis.

Steps involved in Find-S:

 Start with the most specific hypothesis. h = {ϕ, ϕ, ϕ, ϕ, ϕ, ϕ}


 Take the next example and if it is negative, then no changes occur to the hypothesis.
 If the example is positive and we find that our initial hypothesis is too specific then
we update our current hypothesis to a general condition.
 Keep repeating the above steps till all the training examples are complete.
 After we have completed all the training examples we will have the final hypothesis
when can use to classify the new examples.

Algorithm:

1. Initialization:
o Set the initial hypothesis h to the most specific one, where all attributes have
specific values (e.g., h = {Sunny, Warm, Strong, Yes}).
2. Iterate through positive examples:
o For each positive example:
 If the example is already covered by h, move on to the next example.
 If the example is not covered by h:
 For each attribute in the example:
 If the attribute value in the example differs from the
corresponding value in h, replace the value in h with a
wildcard ? to generalize the hypothesis.
3. Final Hypothesis:
o The final hypothesis h represents the most specific generalization that covers
all positive examples in the training set.

Symbols used:

∅ (Empty Set) − This symbol represents the absence of any specific value or attribute. It is
often used to initialize the hypothesis as the most specific concept.

? (Don't Care) − The question mark symbol represents a "don't care" or "unknown" value for
an attribute. It is used when the hypothesis needs to generalize over different attribute values
that are present in positive examples.
Positive Examples (+) − The plus symbol represents positive examples, which are instances
labeled as the target class or concept being learned.

Negative Examples (-) − The minus symbol represents negative examples, which are
instances labeled as non-target classes or concepts that should not be covered by the
hypothesis.

Hypothesis (h) − The variable h represents the hypothesis, which is the learned concept or
generalization based on the training data. It is refined iteratively throughout the algorithm.

Example:

Consider the following Training Data Set:


['Sunny', 'Warm', 'Normal', 'Strong', 'Warm', 'Same', 'Yes']
['Sunny', 'Warm', 'High', 'Strong', 'Warm', 'Same', 'Yes']
['Rainy', 'Cold', 'High', 'Strong', 'Warm', 'Change', 'No']
['Sunny', 'Warm', 'High', 'Strong', 'Cool', 'Change', 'Yes']

The initial value of hypothesis:


['ϕ', 'ϕ', 'ϕ', 'ϕ', 'ϕ', 'ϕ']

Find S - Finding a Maximally Specific Hypothesis:

For Training instance No:0 the hypothesis is ['Sunny', 'Warm', 'Normal', 'Strong', 'Warm',
'Same']

For Training instance No:1 the hypothesis is ['Sunny', 'Warm', '?', 'Strong', 'Warm', 'Same']

For Training instance No:2 the hypothesis is ['Sunny', 'Warm', '?', 'Strong', 'Warm', 'Same']

For Training instance No:3 the hypothesis is ['Sunny', 'Warm', '?', 'Strong', '?', '?']

The Maximally Specific Hypothesis for the given Training Examples:

['Sunny', 'Warm', '?', 'Strong', '?', '?']

Problem Statement

Imagine a dataset containing patient attributes and their diagnosed diseases. The Find-S
algorithm could be used to learn symptom-based rules for identifying specific diseases. For
example, the algorithm might discover the rule: "If a patient has fever, cough, and difficulty
breathing, then they are likely to have pneumonia. Apply the Find S-algorithm on the medical
diagnosis data and check how it is working for the above rule using Python code.
Medical Diagnosis Dataset

Feve Difficulty
Samples r Cough Breathing Diagnosed Disease
1 Yes Yes No Pneumonia
2 No Yes No Common Cold
3 Yes Yes Yes Pneumonia Label
4 No No No Healthy
5 Yes Yes Yes Pneumonia

You might also like