}
}
+ //
+ // Labels are ordered by their first occurrence in the training set.
+ // However, for two-class sets with -1/+1 labels and -1 appears first,
+ // we swap labels to ensure that internally the binary SVM has positive data corresponding to the +1 instances.
+ //
+ if (nr_class == 2 && label[0] == -1 && label[1] == 1)
+ {
+ swap(label[0],label[1]);
+ swap(count[0],count[1]);
+ for(i=0;i<l;i++)
+ {
+ if(data_label[i] == 0)
+ data_label[i] = 1;
+ else
+ data_label[i] = 0;
+ }
+ }
+
int *start = Malloc(int,nr_class);
start[0] = 0;
for(i=1;i<nr_class;i++)