Reputation: 1512
I want to fit Gaussian Naive Bayes on data values with floating point, and the code I'm using is this:
array1 = np.array([[2,2],[3,2]])
array2 = np.array([0.3,3])
clf = GaussianNB()
clf.fit(array1,array2)
But, I get an error saying:
ValueError("Unknown label type: %s" % repr(ys)) ValueError: Unknown label type: (array([ 0.3, 3. ]),)
How can I get around the issue without using a different naive bayes module than the one provided by Sklearn?
Upvotes: 0
Views: 1452
Reputation: 4172
You using array2
as your target labels.
GaussianNB()
is a classifier, so target labels must be integers.(in your case 0.3 is float)
If your labels are real numbers, consider using Regression.
Upvotes: 2