How to train MNSIT digit data using Naive Bayesian classifier (fitcnb)

조회 수: 11 (최근 30일)
Sudheer Dunna
Sudheer Dunna 2020년 4월 30일
댓글: Sinan Islam 2023년 12월 10일
How to train digitTrain4DArrayData (Inbuilt matlab digit data) using Naive bayesian (fitcnb).
[Xtrain,Ytrain]=digitTrain4DArrayData
Converted 4D data into 2D. ( Tried reading MNIST data from external .csv file also)
inputNaive=fitcnb(inputs,targets)
inputs ( 60000*784) double
targets (6000*1) (tried with double and categorial type)
While training it is showing some error like : A normal distribution cannot be fir for the combination of class 1 and predictor X1. The data has zero variance.

답변 (1개)

Puru Kathuria
Puru Kathuria 2021년 1월 31일
Hi Sudheer,
As far as I understand there is no issue with the data or the function fitcnb. The error signifies that a few columns/features might have zero variance. The fit is based on fitting a normal distribution separately for each class and feature.
The within class variance must be positive in the underlying data and If any class has 0 variance for a feature, that normal fit is invaluable.
You might want to use a different model/classifier for this problem.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by