ValueError: Unknown label type:

Viewed 17

I am just Starting this naive Bayes Theoram and Getting stuck by this please tell me what to do, this is my code ::

import sklearn
from sklearn.naive_bayes import GaussianNB
from sklearn.model_selection import train_test_split

from sklearn import metrics
from sklearn.metrics import accuracy_score

df = (pd.read_csv("C:\\Users\\dhana\\Downloads\\Mechanics\\train.csv"))

X = []
Y = []
for i in df.Age:
    X.append(str(i))
    
for j in df.Fare:
    Y.append(j)

X_train, X_test, y_train, y_test = train_test_split(X,Y,test_size=0.3,random_state= 17)

model = GaussianNB()
model.fit(X_train,y_train)
print(model)

y_expect = y_test
y_pred = model.predict(X_test)


print(accuracy_score(y_expect,y_pred))```
0 Answers
Related