I am using the following code to predict output for an SMS text using Naive Bayes
from sklearn.naive_bayes import MultinomialNB
mnb=MultinomialNB()
mnb.fit(X,Y)
X_test = np.array(['This is a sample sms'], dtype=object)
X_test_transformed = vec.transform(X_test)
X_test = X_transformed.toarray()
proba=mnb.predict_proba(X_test)
print(proba)
I train the model using fit
function on X, Y. And now I want to predict if the
SMS This is a sample sms
is spam or not. I am not sure what I am doing wrong
Because the last line should give me a probability. But it gives me the following output
enter image description here
[[9.99999987e-01 1.30424974e-08]
[9.99996703e-01 3.29712871e-06]
[1.15232279e-22 1.00000000e+00]
...
[9.62666043e-01 3.73339566e-02]
[9.99984562e-01 1.54382674e-05]
[9.66244280e-01 3.37557203e-02]]