[R] Regarding Naive bayes classification

Vishnampettai akron_aadhithya at yahoo.com
Sun Aug 22 20:35:15 CEST 2010


Hi,
  I have a small doubt regarding naive Bayes. I am able to classify the
data's properly but i am just stuck up with how to get the probability
values for naive bayes. In the case of SVM we have "attr" function that
helps in displaying the probability values. Is there any function similar to
"attr" in naive Bayes that can be used for displaying the attribute values.
my code is given below: 
library(e1071)
train<-read.table("C:/Users/Aadhithya/Desktop/ThesisDatasetsComb/Part1/Dataset1/groups/train/D1TRg10.txt",header=T);
test<-read.table("C:/Users/Aadhithya/Desktop/ThesisDatasetsComb/Part1/Dataset1/groups/test/D1TEg10.txt",header=T);
length(test);
cl <- c(c(rep("ALL",10), rep("AML",10)));
cl <- factor(cl) 
model <- naiveBayes(t(train),cl);
pred<-predict(model, t(test),decision.values=TRUE,probability=TRUE)
attr(pred,"probabilities");
table(pred,t(cl)); 

-- 
View this message in context: http://r.789695.n4.nabble.com/Regarding-Naive-bayes-classification-tp2334314p2334314.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list