Query: When Naive bayes is built based on model i am predicting the value for new data set. System gives me prediction value as Yes or No. I want to what is probably calculated for prediction.

You can find the probability of predicted values by looking at the posterior part of the predicted data.

Lets consider the iris dataset as my train dataset and  below data is my test dataset that I have created

Sepal.Length,Sepal.Width,Petal.Length,Petal.Width,Species

40,5.1,3.8,1.5,0.3,virginica

21,5.5,3.4,1.7,0.2,versicolor

10,5.1,3.7,1.5,0.4,setosa

32,3.6,3.6,1.0,0.1,virginica

24,5.1,3.3,1.7,0.5,versicolor

70,10.8,4.4,1.9,0.3,setosa

Implement NaiveBayes on the iris dataset.

library(klaR)

data("iris")

m<-NaiveBayes(Species ~ . , data=iris)

predicted_data<-predict(m,testdata_withspecies)

predicted_data

\$class

40 21 10 32 24 70

setosa setosa setosa setosa setosa virginica

Levels: setosa versicolor virginica

\$posterior

setosa versicolor virginica

40 1.000000e+00 1.808513e-17 1.963924e-24

21 1.000000e+00 3.737210e-15 3.814878e-22

10 1.000000e+00 1.210057e-15 7.788592e-23

32 1.000000e+00 7.943930e-21 1.929141e-27

24 1.000000e+00 3.147327e-11 8.175305e-19

70 2.661358e-29 5.114435e-05 9.999489e-01

The above output indicates that probability of Sepal with length-40 being a Setosa is 1 , being versicolor is 1.808513e-17 = 0 ( Approximately) , being virginica is 1.963924e-24 = 0 ( Approximately)

Here I have classified the data on Species column. In the same way you can also classify the data on the column that accepts values -  Yes or No.

Hope this helps.