File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -2428,7 +2428,13 @@ public class svm {
24282428 pairwise_prob[ j] [ i] =1-pairwise_prob[ i] [ j] ;
24292429 k++;
24302430 }
2431- multiclass_probability(nr_class,pairwise_prob,prob_estimates);
2431+ if (nr_class == 2)
2432+ {
2433+ prob_estimates[ 0] = pairwise_prob[ 0] [ 1] ;
2434+ prob_estimates[ 1] = pairwise_prob[ 1] [ 0] ;
2435+ }
2436+ else
2437+ multiclass_probability(nr_class,pairwise_prob,prob_estimates);
24322438
24332439 int prob_max_idx = 0;
24342440 for(i=1;i<nr_class;i++)
Original file line number Diff line number Diff line change @@ -2612,7 +2612,13 @@ double svm_predict_probability(
26122612 pairwise_prob[j][i]=1 -pairwise_prob[i][j];
26132613 k++;
26142614 }
2615- multiclass_probability (nr_class,pairwise_prob,prob_estimates);
2615+ if (nr_class == 2 )
2616+ {
2617+ prob_estimates[0 ] = pairwise_prob[0 ][1 ];
2618+ prob_estimates[1 ] = pairwise_prob[1 ][0 ];
2619+ }
2620+ else
2621+ multiclass_probability (nr_class,pairwise_prob,prob_estimates);
26162622
26172623 int prob_max_idx = 0 ;
26182624 for (i=1 ;i<nr_class;i++)
You can’t perform that action at this time.
0 commit comments