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

S-Algorithim Machine Learning

Uploaded by

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

S-Algorithim Machine Learning

Uploaded by

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

import csv

import os

#!usr/bin/python #list creatin

hypo=['%','%','%','%','%','%']

with open('1.csv') as csv_file:

readcsv = csv.reader(csv_file, delimiter=',')

print(readcsv)

data=[]

print("\nThe given training examples are:")

for row in readcsv:

print(row)

if row[len(row)-1] =='Yes':

data.append(row)

print("\nThe positive examples are:")

for x in data:

print(x)

print("\n")

TotalExamples=len(data)

i=0

j=0

k=0

print("The steps of the Find-s algorithm are\n",hypo)

list =[]

p=0

d=len(data[p])-1

for j in range(d):

list.append(data[i][j])

hypo=list

for i in range(1,TotalExamples):

for k in range(d):
if hypo[k]!=data[i][k]:

hypo[k]='?'

else:

hypo[k]

print(hypo)

print("---------------------------------")

print("\nThe maximally specific Find-s hypothesis for the given training examples
is");

list=[]

for i in range(d):

list.append(hypo[i])

print(list)

You might also like