Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: I need optimized way to get classes
Replies: 4   Last Post: Jun 2, 2012 8:04 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
besbesmany

Posts: 103
Registered: 5/14/11
I need optimized way to get classes
Posted: Jun 2, 2012 5:25 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I've matrix P contains 3 columns which is my classes ratio,
summation of each row =1

p = [0.8 0.1 0.1; 0.7 0.1 0.2; 0.2 0.3 0.5]
p classes should be [1 ; 1; 3] which is the biggest column index

then match with given testclass = [1;2;3] to get acc

the following code:

ppp=P(1:end,:);
[mx inAv_Pmg]=max(ppp,[],2);
[mxRef inRef]=max(testclass,[],2);
l=length(find((inAv_Pmg-inRef)==0));
acc =(l/length(testclass))*100;

how to do it in optimized way because i need to repeat this code alot of time



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2013. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.