如何在Matlab中使用具有离散属性的fitcnb(朴素贝叶斯)?

问题描述 投票:0回答:1

我有一个数据集,如下所示:

enter image description here

第一和第二属性(退款,婚姻状况)是离散属性。第三个属性(应税收入)为连续性属性

我想在Matlab中建立模型并在此桌子上训练它。

这是我的尝试:

enter image description here

我收到此错误消息:

正态分布不适合类别Yes和预测变量x1的组合。数据具有零方差。

任何人都可以帮助或指导我如何在Matlab中正确使用fitcnb

matlab machine-learning classification naivebayes
1个回答
0
投票

我们需要为fitcnb指定类别或离散属性

Mdl = fitcnb(Data,Classes,'CategoricalPredictors',[1 2]);

© www.soinside.com 2019 - 2024. All rights reserved.