I want to classify the images with decision tree classifier ….. but I got an error. I am attaching a code for your kind consideration and attention. your prompt reply will be much appreciated thank you. How to change the train-data to a numeric matrix.
-- Decision tree-- load('train_highimg_fea.mat','a'); load('train_lowimg_fea.mat','b'); load('test_highimg_fea.mat','c'); load('test_lowimg_fea.mat','d'); train_data = [a; b]; train_label = ones(400,1); train_label(201:400) = -1; % Train the classifier
TreeMdl = fitctree(train_data ,train_label);test_data = [c;d];test_label = ones(150,1);test_label(101:150) = -1; predict_labletree= predict(TreeMdl,test_data); save('predict_labletree.mat');
—Command Window— Error–
Error using classreg.learning.FullClassificationRegressionModel.prepareDataCR (line 171) X must be a numeric matrix. Error in ClassificationTree.prepareData (line 512) classreg.learning.FullClassificationRegressionModel.prepareDataCR(... Error in classreg.learning.FitTemplate/fit (line 213) this.PrepareData(X,Y,this.BaseFitObjectArgs{:}); Error in fitctree (line 194) this = fit(temp,X,Y); Error in decesiontree_test (line 15) TreeMdl = fitctree(train_data ,train_label);
Best Answer