MATLAB Answers


classification/ Discriminant analysis functions

Asked by Hadeel Arslan on 17 Apr 2013
  • I'm not really a user of MatLab but I have a homework so that I'm learning and I need your help please
  • so ...I have a char data in MS excel file , it gives a matrix of 1824x22 + extra column called class with is either ('e','p'), I have to divide the data into 2 haves(testing_set , training_set), **train the corresponding classifier.
  • compare the categories produced (classifications) by classify function on the testing set with the actual classes provided in the testing set. Calculate the percentage of cases that that were correctly classified by the four types of classify function.
  • I already did this so far and I can't go any farther without help
 MATLAB code
raw = double(cell2mat(raw))
dimen = size(raw)
nraw = dimen(1)
ncol = dimen(2)
train_set = raw(1:(nrow/2),:)
test_set = raw(((nrow/2) + 1):nrow,:)


Log in to comment.

2 Answers

Answer by Tom Lane
on 18 Apr 2013

I don't have your data. I suspect you need to define train_set and test_set to have only the data without the class labels. Then create train_class and test_class to hold the class labels. Then type "help classify" and "help confusionmat" and see where that gets you.


I wasn't really looking for your data, just getting across the idea that depending on how it's organized you probably need to separate the class labels from the rest. Do try out my suggestion and see how it goes.

Log in to comment.

Answer by Hadeel Arslan on 18 Apr 2013
Edited by Hadeel Arslan on 18 Apr 2013


Log in to comment.

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today