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]]))
In [ ]:
In [5]:
%matplotlib inline
import matplotlib.pyplot as plt
plt.scatter(X[:,0],X[:,1])
Out[5]:
In [ ]: