贝叶斯判别法做了,中途报了以下错误:

本文介绍了解决使用贝叶斯判别法时遇到的非正定错误的方法。通过删除造成问题的特征列,成功避免了训练过程中出现的协方差矩阵非正定情况。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

贝叶斯判别法做了,中途报了以下错误:
>> ObjBayes=NaiveBayes.fit(training,group);
??? Error using ==> NaiveBayes.fit>gaussianFit at 535
The within-class variance in each feature of TRAINING must be positive. The within-class variance in
feature 18 25 29 43 49 58 68 69 72 76 77 79 83 85 86 93 99 in class 科技 are not positive.

Error in ==> NaiveBayes.fit at 498
            obj = gaussianFit(obj, training, gindex);

>> ObjBayes=NaiveBayes.fit(training,group);
??? Error using ==> NaiveBayes.fit>gaussianFit at 535
The within-class variance in each feature of TRAINING must be positive. The within-class variance in
feature 25 26 27 32 42 44 58 65 66 67 82 in class 新闻 are not positive.

然后我把涉及到的列全删除了,就可以用贝叶斯判别法做了。


原因:列(变量)太多了,导致协方差矩阵非正定,请删除无意义的列。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值