Trying to get my feet wet with machine learning on text.

The most common dataset I've seen in this space is the sms dataset with classes ham and spam.

And the most common and successful approach seems to be to model this as a binary classification problem and to use a multinomial naïve Bayes to solve it.

However I'm trying to understand why this is a binary classification problem.

I understand that the spam category has some common features associated with it across the class - such as ads, offers , free discounts and so on.

But there's no definition for what is a ham class is there? The definition of ham is - everything other than spam.

So why is this a binary classification task?

For more context - I'm trying to solve the problem of whether a news article belongs to the politics class or to the non-political class.

Suppose I have a labelled dataset of around 3000 samples in each class.

The non political class is a mix of classes like sports , religion , science and technology and miscellaneous.

Will a binary classifier work better than an algorithm such as oneclassSVM where anything other than political news is an outlier ?

What are some of the other algorithms that I can use to solve this problem? I have heard about PU learning but I haven't seen any implementations of algorithms in any machine learning libraries ( I'm working with python)

If any of you have experience doing class modelling on text. Please share your comments and insights

Thank you!


1 Answer 1


Regarding the case of spam vs ham, you are right that the spam category has common features (words), whereas the ham category could have multiple sub-categories, each with distinct feature sets. However, these distinct features can also be used to label an instance as "ham". Eg: If spam messages don't usually talk about sports scores, then the occurrence of the word "score", could be used to classify a message as "ham", even when it co-occurs with typical spam words such as "ad", "offer", etc. However, the one-class classifier cannot make use of such a mechanism.

In a similar manner, specific features will help to identify a news article as belonging to "sports", "religion", etc, thereby making them easier to label as "non-political". The miscellaneous class would be more diverse, however.

One-class SVMs are useful in cases where you want to detect novel instances, the kind of which you have not seen before, and hence cannot characterize in advance. Binary classification can be used when the understanding is that the available labeled dataset covers the typical kind of examples you would see while using the model for prediction.


Your Answer

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

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