classification/ Discriminant analysis functions

3 views (last 30 days)
  • 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]=xlsread('orderedfile','A1:V8124')
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,:)

Answers (2)

Tom Lane
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.
  2 Comments
Tom Lane
Tom Lane on 18 Apr 2013
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.

Sign in to comment.


Hadeel Arslan
Hadeel Arslan on 18 Apr 2013
Edited: Hadeel Arslan on 18 Apr 2013

Community Treasure Hunt

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

Start Hunting!