Classification using multinomial naive bayes is not working, see the code
from sklearn.naive_bayes import MultinomialNB
from sklearn.feature_extraction import DictVectorizer
import numpy as np
# training data
data = [
{'house': 100, 'street': 50, 'shop': 25, 'car': 100, 'tree': 20},
{'house': 5, 'street': 5, 'shop': 0, 'car': 10, 'tree': 500, 'river': 1}
]
dv = DictVectorizer(sparse=False)
X = dv.fit_transform(data)
Y = np.array([10, 20])
mnb=MultinomialNB(alpha=1.0, class_prior=None, fit_prior=True)
mnb.fit(X, Y)
# test data
test_data1 = [
{'testname': 0, 'street': 0, 'shop': 0, 'car': 0, 'Hi': 0, 'Blue': 5},
]
print (mnb.predict(dv.transform(test_data1)) )
Output is [10], But I was expecting it to be [20].
What is wrong here, my understanding?