find S algo
find S algo
most specific hypothesis based on a given set of training data samples. Read
the training data from a .CSV file.
Program:-
Program:
import csv
num_attributes = 6 a = [ ]
print("\n The Given Training Data Set \n")
print("\n The initial value of hypothesis: ") hypothesis = ['0'] * num_attributes print(hypothesis)
print("\n The Maximally Specific Hypothesis for a given Training Examples :\n")
print(hypothesis)
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
Output:
For Training Example No:1 the hypothesis is ['sunny', 'warm', '?', 'strong', 'warm', 'same']
For Training Example No:2 the hypothesis is 'sunny', 'warm', '?', 'strong', 'warm', 'same']
For Training Example No:3 the hypothesis is 'sunny', 'warm', '?', 'strong', '?', '?']