Hi there at SCIKIT

First time user/poster here, but I'd like to thank you for this useful
piece of software.

Using scikit-learn 0.10

Why does the following (pastebin: http://pastebin.com/Hufs6aZJ):

from sklearn.naive_bayes import *

import sklearn
from sklearn.naive_bayes import *

print sklearn.__version__

X = np.array([ [1, 1, 1, 1, 1],
               [0, 0, 0, 0, 0] ])
print "X: ", X
Y = np.array([ 1, 2 ])
print "Y: ", Y

clf = BernoulliNB()
clf.fit(X, Y)
print "Prediction:", clf.predict( [0, 0, 0, 0, 0] )


Print out an answer of "1" ?  Having trained the model on [0,0,0,0,0] => 2
I was expecting "2" as the answer.
And why does replacing Y with

Y = np.array([ 3, 2 ])

Give a different class "2" as an answer (the correct one) ?  Isn't this
just a class label?

Can someone shed some light on this?

Many Thanks
JP

PS Thanks to the IRC people who tried to help (NelleV)


-
Jean-Paul Ebejer
Early Stage Researcher
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to