2
$\begingroup$

Let's say I need to classify addresses with scikit-learn, so if I want my classifier to be able to classify addresses by the street name, and post/zip code, should I do a OneVsRest classifier, or separate them into two different classifiers (for the same training set)?

I have tried both, and it seems like having multiple classifiers might be a better choice, as it feels faster to train multiple smaller classifiers. Is this how it is supposed to be done?

$\endgroup$
2
  • $\begingroup$ MD004, your suggestions are awesome. A quick question, if we have three labels :{A,B,C}, and use OneVsRest to produce three output classes, how do I know which class belongs to A or B or C? $\endgroup$ Jan 31, 2018 at 15:27
  • $\begingroup$ you could post your comments directly to his/her answer actually, then he/she would be able to see your followup question $\endgroup$
    – Jeffrey04
    Feb 2, 2018 at 3:35

1 Answer 1

4
$\begingroup$

Both ways are valid and both are commonly used. Sometimes, a classifier that claims to be multilabel may just be separating the labels into multiple OneVsRest classifiers under-the-hood and conveniently joining the results together at the end.

However, there are cases where the methods are fundamentally different. For instance, in training a neural net with multiple targets (labels), you can setup the structure of the network such that there is shared structure. The shared nodes will end up learning features that are useful for all the targets, which could be very useful.

For example, if you're classes (labels) are "cat-pet", "cat-big", and "dog", you may want an algorithm that first learns to distinguish between any cat and any dog, and then in a later step learns to separate cats that are pets from cats that are big (like a lion!). This is called hierarchy, and if your classifier can exploit hierarchy you may gain better accuracy. If your classes are completely independent however, it may not make any difference.

I suggest you start with the method that is easiest (i.e. OneVsRest), and see if the performance is suitable to your needs, then move to more complicated methods (multilabel, hierarchical methods, etc) only once you need better performance.

$\endgroup$
2
  • $\begingroup$ Excellent answer! Very well-stated. $\endgroup$
    – Kyle.
    Oct 22, 2015 at 22:06
  • $\begingroup$ yea, i was trying to do hierarchical classifying first, but the problem is that if the initial classifier mis-classified a document (roughly 6% chance), then the following result wouldn't make sense anymore lol. I guess I will stick with separating the classifiers, as the more different type of classes are added to the huge, monolithic classifier, parsing the result will be a huge problem... $\endgroup$
    – Jeffrey04
    Oct 23, 2015 at 2:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.