find s

import pandas as pd
import numpy as np
data=pd.read_csv(“/home/user/Downloads/data.csv”)
print(data,”\n”)

d=np.array(data)[:,:-1]
print(“\nThe attributes are:”,d)

target=np.array(data)[:,-1]
print(“\nThe target is:”,target)

def train(c,t):
    for i,val in enumerate(t):
        if val==”Yes”:
            specific_hypothesis=c[i].copy()
            break;
    for i,val in enumerate(c):
        if t[i]==”Yes”:
            for x in range(len(specific_hypothesis)):
                if val[x]!=specific_hypothesis[x]:
                    specific_hypothesis[x]=’?’
                else:
                    pass
    return specific_hypothesis

print(“\nFinal Hypothesis is:”,train(d,target))import pandas as pd
import numpy as np
data=pd.read_csv(“/home/user/Downloads/data.csv”)
print(data,”\n”)

d=np.array(data)[:,:-1]
print(“\nThe attributes are:”,d)

target=np.array(data)[:,-1]
print(“\nThe target is:”,target)

def train(c,t):
    for i,val in enumerate(t):
        if val==”Yes”:
            specific_hypothesis=c[i].copy()
            break;
    for i,val in enumerate(c):
        if t[i]==”Yes”:
            for x in range(len(specific_hypothesis)):
                if val[x]!=specific_hypothesis[x]:
                    specific_hypothesis[x]=’?’
                else:
                    pass
    return specific_hypothesis

print(“\nFinal Hypothesis is:”,train(d,target))

Scroll to Top