-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1.py
More file actions
31 lines (25 loc) · 784 Bytes
/
Copy path1.py
File metadata and controls
31 lines (25 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import csv
print("the most specific hypothesis is :[000000]")
a=[]
print("the given training dataset \n")
with open('ws.csv','r') as csvfile:
reader=csv.reader(csvfile)
for row in reader:
a.append(row)
print(row)
num_attributes=len(a[0])-1
print("the initial value of hypothesis:\n")
hypothesis = ['0']*num_attributes
print (hypothesis)
for j in range (0,num_attributes):
hypothesis[j]=a[0][j]
print (hypothesis)
print("For finding maximum specific Hypothesis")
for i in range(0,len(a)):
if a[i][num_attributes]=='yes':
for j in range(0,num_attributes):
if a[i][j]!= hypothesis[j]:
hypothesis[j]='?'
print("For Learnig Example no",i,"the hypothesis is ",hypothesis)
print("The maximally specific hyptothesis for a given training Egs")
print(hypothesis)