Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
736 B
1
Indexable
Never
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from sklearn.naive_bayes import GaussianNB

df=pd.read_csv('playsheet_dataset.csv')

Numerics=LabelEncoder()

inputs=df.drop('Play',axis='columns')
target=df['Play']

inputs['outlook_n']=Numerics.fit_transform(inputs['Outlook'])
inputs['Temp_n']=Numerics.fit_transform(inputs['Temp'])
inputs['Humidity_n']=Numerics.fit_transform(inputs['Humidity'])
inputs['windy_n']=Numerics.fit_transform(inputs['Windy'])

inputs_n=inputs.drop(['Outlook','Temp','Humidity','Windy'],axis='columns')

Classifier=GaussianNB()
Classifier.fit(inputs_n,target)

accuracy = Classifier.score(inputs_n,target)

print(accuracy)

print(Classifier.predict([[1,1,0,0]]))
Leave a Comment