我在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
我这样做了吗?