1

My project is acute stroke classification using SVM classifier in MATLAB.

The screenshot below shows the 13 feature extraction of acute stroke (21 patients) and normal brain (6 patients) using glcm which is known as training data for svm classifier.

features

The following screenshot shows Y or group of training data.

Y

This is the code that I am using and its shows error.

Load Trainset.mat
data = new_var;
group = label;
SVMStruct = svmtrain(data, group, 'kernel_function', 'linear');
newClasses = svmclassify(SVMStruct, texturedata, 'showplot', true);
%To plot classification graphs, SVM can take only two dimensional data
data1 = [new_var(:, 1), new_var(:, 2)];
newfeat = [texturedata(:, 1), texturedata(:, 2)];
SVMStruct_new = 
svmtrain(data, group, 'kernel_function', 'linear', 'showplot', true);
%species_Linear_new = svmclassify(SVMStruct_new, newfeat, 'showplot', true);

Warning: Y contains categorical levels that don't appear in the elements of Y. Those levels will be ignored for the purposes of training the classifier. In svmtrain at 277

Error using svmtrain (line 335) Y must contain exactly two groups for method 'SMO'.

I think it's because the value 0 and NAN for normal brain that the row being ignore. So my question is: what should I do to include that row or maybe it absolutely doesn't work for this code?

Tonechas
  • 13,398
  • 16
  • 46
  • 80
Aida Ezati
  • 21
  • 7

1 Answers1

0

Your dataset is not a good one. If that is an accurate dataset you do not need machine learning at all. You can just use just one feature and predict if Acute stroke or Healthy by checking if it non-zero. (i.e Healthy if zero and Acute stroke if non-zero).

I am guessing you do not have data for healthy patient, hence you are just adding zeros to the data where you do not have. That does not make sense.

Yes your zeros and Nan and Inf's are the problem for SVM to learn. But bigger problem is even if you preprocess them, the data is still useless for the reasons i mentioned above. So Try collecting better data first and then start again.

If you could post one positive and negative image (healthy and not healthy), the I can tell you what features could be good ones to start. As I see GLCM is not working for you problem/your way of computing GLCM may not be right.

Hope this helps

harshkn
  • 731
  • 6
  • 13
  • how the way i can get the better dataset? how can i computing the glcm with the right way?can you give me the way sir, please. For acute stroke i extract the reference image of acute stroke using glcm while for healthy one i am using the black image because i though when do the segmentation for normal image the result make the image black because there are no stroke. – Aida Ezati Apr 23 '17 at 05:29
  • Using a black image does not work. I do not know how you get better dataset. That is the problem you have to solve – harshkn Apr 23 '17 at 05:30
  • or i can just convert double array into other parameter? – Aida Ezati Apr 23 '17 at 05:37
  • You don't seem to know what you are doing. It is better you read more about this topic of classification and then try to solve this problem – harshkn Apr 23 '17 at 05:42