Username Remember Me?
Password   forgot password?
   
   
Threshold SVC
Posted: 01 March 2017 10:46 AM   [ Ignore ]  
Novice
Rank
Total Posts:  3
Joined  2016-11-04

Hi,

I’m trying to obtain the soft outputs from my SVM classifier, which I optimized using a ROC. However when I use the - infront of my SVC pipeline, I get a list of values from -x to +y. The threshold between my two classes is not at 0, because the datapoints from class 1 get soft outputs from -0.3 to +y and the datapoints from class 2 get soft outputs from -x to -0.5. My question is, can I get the threshold that determines the hardoutputs? And how do I interpret the soft ouputs?

Thanks!

Profile
 
 
Posted: 01 March 2017 03:59 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  371
Joined  2008-04-26

Dear Lisanne,

there is no public interface to get thresholds or weights of ROC optimized operating points in perClass. Why do you need it?

For a two-class case, SVM returns one soft output with positive results for one and negative for other class. The target (positive) class is available in .lab field of the pipeline (e.g. p(2).lab if you use defaults and the first step does scaling). You may visualize its soft outputs on some set with

>> sdfeatplotdata * -)

In the feature plot, you can see the threshold and also can get a confusion matrix at different locations via right mouse click.

Does it help?

With Kind Regards,

Pavel

Profile
 
 
Posted: 01 March 2017 04:07 PM   [ Ignore ]   [ # 2 ]  
Novice
Rank
Total Posts:  3
Joined  2016-11-04

Dear Pavel,

Thank you for your fast respons. I want to show the chance/ probability that a datapoint belongs to the class to which it is classified. As I see it, the points closer to the thershold will have an increased chance of belonging to the other class compared to the points further from the therhold. I don’t know if that is the correct way of interpreting the results. But if it is, it would be useful to know the threshold, so you can determine the chances.

Kind regards,
Lisanne

Profile
 
 
Posted: 01 March 2017 05:50 PM   [ Ignore ]   [ # 3 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  371
Joined  2008-04-26

Dear Lisanne,

I see. In the upcoming perClass 5.1, sdsvc adds a ‘prob’ option for the two-class case, that uses the Platt algorithm (used by libSVM).
I’m attaching the sdsvc.m and sdsvc.p files you can drop in perclass directory replacing the old ones.

For details on estimating probabilities from SVM output, check out: https://www.csie.ntu.edu.tw/~cjlin/papers/svmprob/svmprob.pdf

Kind Regards,

Pavel

>> load fruit
>> b=a(:,:,1:2)
'Fruit set' 200 by 2 sddata2 classes'apple'(100'banana'(100
>> 
rand('state',42); p=sdsvc(b,'rbf','C',1,'prob')
....................
sigma=0.86471 C=1 err=0.020 SVs=41
sequential pipeline       2x1 
'Scaling+Support Vector Machine'
 
1 Scaling                 2x2  standardization
 2 Support vector machine    2x1  RBF kernel
sigma=0.8641 SVs
 3 Scaling                 1x1 
 4 Probability scaling     1x2 
 5 Decision                2x1  weighting
2 classes


>> out=b*-p
'Fruit set' 200 by 2 sddata2 classes'apple'(100'banana'(100
>> +
out(1:10)

ans =

    
0.9861    0.0139
    0.9966    0.0034
    0.9903    0.0097
    0.9903    0.0097
    0.9922    0.0078
    0.9865    0.0135
    0.9663    0.0337
    0.9867    0.0133
    0.9898    0.0102
    0.9688    0.0312

>> sdscatter(a,-p)

Kind Regards,

Pavel

File Attachments
sdsvc.p  (File Size: 4KB - Downloads: 38)
sdsvc.m  (File Size: 3KB - Downloads: 44)
Profile
 
 
Posted: 02 March 2017 08:39 AM   [ Ignore ]   [ # 4 ]  
Novice
Rank
Total Posts:  3
Joined  2016-11-04

Hi Pavel,

Thank you very much for the scripts! This is exactly what I wanted :)

Best!
Lisanne

Profile