import numpy as np
import pandas as pd
from sklearn.preprocessing import LabelEncoder, StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, classification_report, confusion_matrix
from sklearn.naive_bayes import GaussianNB

mushroom = pd.read_csv("/ML/mushroom_csv.csv")
X = mushroom.drop('class', axis=1)
y = mushroom['class']
label_encoder = LabelEncoder()
X = X.apply(label_encoder.fit_transform)
y = label_encoder.fit_transform(y)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=21)
scaler = StandardScaler()
X_train = scaler.fit_transform(X_train)
X_test = scaler.transform(X_test)
NB = GaussianNB()
NB.fit(X_train, y_train)
y_pred = NB.predict(X_test)
conf_matrix = confusion_matrix(y_test, y_pred)
class_report = classification_report(y_test, y_pred)
print("Confusion Matrix:\n", conf_matrix)
print("Classification Report:\n", class_report)

test_data = np.array([[3.4, 2.5, 1.2, 4.1, 5.3, 3.2, 2.1, 6.7, 3.4, 1.3, 5.2, 2.3, 4.5, 3.1],[2.7, 3.1, 1.5, 4.0, 5.1, 3.3, 2.3, 6.6, 3.2, 1.1, 5.1, 2.4, 4.3, 3.0]])

predictions = dt.predict(test_data_scaled)

print(predictions)
