I am trying to plot the decision surface for a Gaussian Naive Bayes classifier. I seem to be having a bit of a problem with training the classifier though. I am also very new to machine learning.
First I generate 100 random points, with half having a different coordinate and label.
for i in range(50):
point1.append([np.random.randint(50,80),np.random.randint(50,80)])
point1L.append(1)
for i in range(50):
point2.append([np.random.randint(10,40),np.random.randint(10,70)])
point2L.append(0)
I then train it.
clf = GaussianNB()
clf.fit(point1,point1L)
clf.fit(point2, point2L)
I then run into a problem. The classifier I have here doesn't seem to be able to differentiate between the two points.
print(clf.predict([np.random.randint(50,80),np.random.randint(50,80)]))
print(clf.predict([np.random.randint(10,40),np.random.randint(10,70)]))
The result I get for this always seem to be:
[0]
[0]
What am I doing wrong, and how do I fix it?
On a side note, I would also like to know if I can plot the decision boundary straight from the classifier itself, and not by comparing decisions by the classifier at every point.