Username Remember Me?
Password   forgot password?
   
   
constrain function
Posted: 14 July 2017 09:44 PM   [ Ignore ]  
Master
RankRankRank
Total Posts:  60
Joined  2010-05-27

Dear Developer,

I wanted to pass a varible rather than the class name into the constrain functio.

EG.

% ops=sdops(’w’,rand(10000,3)*5000-1000,tr.lab.list);
% r=sdroc(out,’ops’,ops,’measures’,{’TPr’,’12’,’precision’,’12’,’TPr’,’13’,’precision’,’13’,’TPr’,’80’,’precision’,’80’},’confmat’);

r2=constrain(r,’TPr(12)’,TrpNum,’precision(12)’,PrecisionNum);

the above codes work. Now, I want to pass the varible to the contstrain (to replace the lab), Can I do it?

class1=’12’;
e.g.
r2=constrain(r,’TPr(class1)’,TrpNum,’precision(class1)’,PrecisionNum)

this does not seem to be working.

I got the error: Error using sdroc/constrain
Unknown measure ‘TPr(class1)’

Can you please help how to best handle it?

thanks!

Profile
 
 
Posted: 14 July 2017 09:45 PM   [ Ignore ]   [ # 1 ]  
Master
RankRankRank
Total Posts:  60
Joined  2010-05-27

Also for setcurop
I want to use setcuop as following:

r3=setcurop(r2,’max’,’precision(class1)’);% it does not seem to be working.

Profile
 
 
Posted: 25 July 2017 03:05 PM   [ Ignore ]   [ # 2 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  367
Joined  2008-04-26

Dear Liwei,

you need to concatenate the string denoting the measure (e.g. ‘precision(’) with the class name.

Example:

>> load fruit
>> 
>> 
a
'Fruit set' 260 by 2 sddata3 classes'apple'(100'banana'(100'stone'(60
>> 
p=sdfisher(a)
sequential pipeline       2x1 'Fisher linear discriminant'
 
1 LDA                     2x2 
 2 Gaussian model          2x3  single cov
.mat.
 
3 Normalization           3x3 
 4 Decision                3x1  weighting
3 classes
>> r=sdroc(a,p)
ROC (2000 w-based op.points4 measures), curop1325
est
1:err(apple)=0.122:err(banana)=0.113:err(stone)=0.054:mean-error=0.09
>> classname='banana'

classname =

banana

>> r2=setcurop(r,'min',['err(' classname ')'])
ROC (2000 w-based op.points4 measures), curop26
est
1:err(apple)=0.552:err(banana)=0.003:err(stone)=0.224:mean-error=0.26

Does it help?

With Kind Regards,

Pavel

Profile