0% found this document useful (0 votes)
16 views1 page

ML 3

Uploaded by

wooyoung654
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)
16 views1 page

ML 3

Uploaded by

wooyoung654
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/ 1

import pandas as pd

df2=pd.read_csv("C:\\Users\\DELL\\OneDrive\Desktop\lab3.csv",header=None)
print("\n The given training data set \n")
print(df2)
print("\n the most general hypothesis:['?','?','?','?','?','?']\n")
print("\n the most specific hypothesis:['0','0','0','0','0','0']\n")
import numpy as np
x=np.array(df2.iloc[0:,:-1])
y=np.array(df2.iloc[0:,-1])
print(x)
print("\n")
print(y)
m,n=x.shape
print("\n")
print(m,n)
print("\n the initial value of hypothesis: ")
hypo=['0']*(n-1)
print("\n Find S: finding a maximally specific hypothesis \n")
print(x)
for i in range(0,m):
if y[i]=='yes':
for j in range(0,n):
if x[i][j]!=hypo[j]:
if hypo[j]=='0':
hypo=x[i,:n]
else:
hypo[j]='?'
print("the hypothesis {0} for training set {0}:".format(i+1),hypo)
print("\n the maximally specific hypothesis for given given training examples:\n")
print(hypo)

You might also like