这种在matlab中使用Naive Bayes的方法是否正确

时间:2013-09-25 17:25:19

标签: matlab classification bayesian-networks

我在matlab中使用朴素贝叶进行分类:

dataFull = csvread('haberman.data.data')
dataTaining = dataFull(250, :)
dataTaining = dataFull(1:250,:)
dataTest = dataFull(251:end, :)
dataTainingClass = dataTaining(:,4)
dataTraining = dataTraining(:,1:3)
dataTraining = dataTaining(:,1:3)
dataTestClass = dataTest(:,4)
dataTest = dataTest(:,1:3)
nb = NaiveBayes.fit(dataTraining, dataTainingClass)
predict(nb, dataTest)
percentange = (dataTestClass == ans)
sum(percentange) / length(percentange)

来自UCI的Haberman数据集dataset

我这样做了吗?

0 个答案:

没有答案