python - Scikit Learn Naive Bayes -


i'm new scikit learn , i'm confused program trying predict.

import numpy np x = np.array([[-1, -1],            [-2, -1],            [-3, -2],            [1, 1],            [2, 1],            [3, 2]]) y = np.array([1, 1, 1, 2, 2, 2]) sklearn.naive_bayes import gaussiannb clf = gaussiannb() clf.fit(x, y)  print(clf.predict([[-0.8, -1]])) 

if run program get:

[1] 

as far can tell "x" training data , i'm not sure "y" is. if change:

([[-0.8, -1]]) 

to

([[-0.8, 1]]) 

i get

[2] 

i need little bit of defined.

y training labels. function predict returns predicted label.


Comments