File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -2428,7 +2428,13 @@ public class svm {
2428
2428
pairwise_prob[ j] [ i] =1-pairwise_prob[ i] [ j] ;
2429
2429
k++;
2430
2430
}
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);
2432
2438
2433
2439
int prob_max_idx = 0;
2434
2440
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(
2612
2612
pairwise_prob[j][i]=1 -pairwise_prob[i][j];
2613
2613
k++;
2614
2614
}
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);
2616
2622
2617
2623
int prob_max_idx = 0 ;
2618
2624
for (i=1 ;i<nr_class;i++)
You can’t perform that action at this time.
0 commit comments