function to implement one vs all classifier