Malachi Bazar
Malachi Bazar

Reputation: 1825

Scikit Learn Naive Bayes

I'm new to scikit learn and I'm confused as to what this program is trying to predict.

import numpy as 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])
from sklearn.naive_bayes import GaussianNB
clf = GaussianNB()
clf.fit(X, Y)

print(clf.predict([[-0.8, -1]]))

If I run this program I get:

[1]

As far as I can tell "X" is the training data and I'm not sure what "Y" is. If I change:

([[-0.8, -1]])

to

([[-0.8, 1]])

I get

[2]

I just need a little bit of it defined.

Upvotes: 1

Views: 1746

Answers (1)

Farseer
Farseer

Reputation: 4172

Y is a training labels. Function predict returns predicted label.

Upvotes: 2

Related Questions