0

我在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 数据

我这样做对吗?

4

0 回答 0