In [4]:
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.0001, 0]]))
print(clf.predict_proba([[0.0001, 0]]))


[2]
[[ 0.49985  0.50015]]

In [ ]:


In [5]:
%matplotlib inline

import matplotlib.pyplot as plt
plt.scatter(X[:,0],X[:,1])


Out[5]:
<matplotlib.collections.PathCollection at 0x10a37c128>

In [ ]: