2 dancer qiao dancer_qiao 于 2017.09.04 13:02 提问

matlab 做朴素贝叶斯分类,报错 The data has zero variance.

代码:
nb=fitcnb(train_data,train_label);

predict_label =predict(nb,test_data);

错误:
错误使用 ClassificationNaiveBayes/fitNonMNDists (line 231)
A normal distribution cannot be fit for the combination of class 112 and predictor x1. The data has zero variance.

出错 ClassificationNaiveBayes (line 103)
this.DistributionParameters = fitNonMNDists(this);

出错 classreg.learning.FitTemplate/fit (line 258)
[varargout{1:nargout}] = this.MakeFitObject(X,Y,W,this.ModelParams,fitArgs{:});

出错 ClassificationNaiveBayes.fit (line 131)
this = fit(temp,X,Y);

出错 fitcnb (line 223)
this = ClassificationNaiveBayes.fit(X,Y,varargin{:});

出错 jueceshu (line 24)
nb=fitcnb(train_data,train_label);

Csdn user default icon
上传中...
上传图片
插入图片