Suppose that we have unlabeled data. That is, all we have are a collection of emails and want to determine whether any of them is spam or not. Let's say we have $1,000$ rules to determine whether a particular email is spam or not. For example, one rule could be that a sender's email address should not contain the text no_reply . If an email does contain this text, then it would be classified as spam.

What are the advantages/disadvantages of a rules-based approach for detecting spam vs. a non-rules-based approach/unsupervised methods for detecting spam?

Would there even be a point in constructing a non-rules based model given that we already have a rules-based model? Could we use the rules-based model to create some labeled training data and then apply supervised techniques?


Yes, there would be a point. Assuming your rule set is accurate, then you can use data classified with it to train a model. This model can be expected to be more robust and properly categorise emails that your rule-set will not handle.

Why? Machine learning algorithms generally work on features, and identify relationships between those features that lead to a classification decision. A human rule author basically does the same, but they might not notice subtle relationships; a good ML algorithm, however, might pick those up.

So you could have a hybrid model, where you first use your rule-based classifier, and anything that does not get classified is then run through the ML classifier.

  • 2
    $\begingroup$ This. But you should also take into account that your rules and therefore your training data have incorrect classifications. For example, no_reply as a localpart is relatively common for automatically generated emails that are not spam at all, but requested by the recipient. My experience (I've built a deep learning spam classifier) is that with a very basic feature set reasonable results can be achieved (after training on manually classified samples). $\endgroup$ Mar 22 '19 at 18:08
  • 1
    $\begingroup$ However, for production quality, you need several iterations of looking at the results (especially misclassifications) and adjusting feature extraction. $\endgroup$ Mar 22 '19 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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