#import library

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

#Read csv file

df = pd.read_csv('classification.csv')
X = df.iloc[:,0:8].values
y = df.iloc[:,8].values
print(df)


from sklearn.model_selection import train_test_split

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.20, random_state = 0)


from sklearn.naive_bayes import GaussianNB

classifier = GaussianNB()
classifier.fit(X_train, y_train)

y_pred = classifier.predict(X_test)

from sklearn.metrics import confusion_matrix
cm = confusion_matrix(y_test, y_pred)
print(cm)



acc=(2457+238)/(len(y_test))
err=(20+293)/(len(y_test))

print('ACCURACY: ',acc)
print('ERROR: ',err)



