Live data from Hacker News

Autospam and Naive Bayes

pixelfed.blog

11–20 of 39 posts

Re: Autospam and Naive Bayes

#11
"There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies." (Tony Hoare)

Naive Bayes is the former, me thinks.

Re: Autospam and Naive Bayes

#12
post #3

Naive Bayes is also surprisingly powerful for deduplication of large datasets of messy data (and the related problem of record linkage). It's still competitive with cutting edge approaches if carefully applied, and usually much faster so it can be applied to big data. It's the engine behind Splink, the free Python library that I develop: https://github.com/moj-analytical-services/splink

This is a very cool tool. I was testing fastlink recently but found some issues with the docs and implementation. I will check out your tool.

Congrats on winning all those awards.

Re: Autospam and Naive Bayes

#13
The cost to implement a model that can do P(Y|X) can unsurprisingly be much lower than something that can model P(X, Y) and that's not just because its an easier problem but economics and what just works easily.

But in the world of the future which is likely look at the "LLM of everything spoken/written" and given you can solve P(Y|X) P(X|Y) from a model that can do P(Y, X); LLMs could just win because of integration with everything.

Re: Autospam and Naive Bayes

#14
post #12
post #3

Naive Bayes is also surprisingly powerful for deduplication of large datasets of messy data (and the related problem of record linkage). It's still competitive with cutting edge approaches if carefully applied, and usually much faster so it can be applied to big data. It's the engine behind Splink, the free Python library that I develop: https://github.com/moj-analytical-services/splink

This is a very cool tool. I was testing fastlink recently but found some issues with the docs and implementation. I will check out your tool. Congrats on winning all those awards.

Thanks, appreciate it.

Fastlink was the inspiration for Splink - the fundamental statistical model is very similar. The first version of Splink was essentially a port to make it work faster and at greater scale, but we've subsequently added quite a bit of additional functionality

Feel free to ask questions if you run into any issues - we're usually fairly good at responding: https://github.com/moj-analytical-services/splink/discussion...

Re: Autospam and Naive Bayes

#15
No mention of the spammers counter-attack,which was to stuff their spam with keywords to cause naive bayes to misclassify important emails as spam and cause it to be turned off due to unacceptable false positive rates. Spam-filtering is tough because it is an adversarial problem.

Re: Autospam and Naive Bayes

#16
I have some history with Naive Bayes for email filtering[1][2] and it doesn't surprise me that it's still a viable technique. It's incredibly fast to execute and for spam it was fascinating to see that as spammers tried to evade Naive Bayes they were actually increasing the numbers of tokens that made their spam look like spam. And it generalized to multiple categories. To this day I receive messages from people saying they are using POPFile for multi-category email filtering.

As I pointed out in 2004[3], one technique around Naive Bayes (and other machine learning systems) was to pit machine learning against machine learning[4].

[1] https://getpopfile.org/

[2] https://en.wikipedia.org/wiki/POPFile

[3] https://blog.jgc.org/2023/07/how-to-beat-adaptivebayesian-sp...

[4] https://en.wikipedia.org/wiki/Adversarial_machine_learning

Re: Autospam and Naive Bayes

#17
IMHO one of the most overlooked features is that it's the best eXplainable AI out there IMHO. Spam scores are easily understandable and correctable. You can even build quite digestible nomograms [1] . Still everyone is using decision trees as XAI example while in my experience they are very unstable in quite indigestible after a depth of 3. I also believe Naïve Bayes is quite undervalued. What many people however ignore is that you also need to estimate a density function for continuous variables, which like with many kernel based methods might the rather interesting and sometimes not so naïve part.

[1] https://orange3.readthedocs.io/projects/orange-visual-progra...

Re: Autospam and Naive Bayes

#18
post #3

Naive Bayes is also surprisingly powerful for deduplication of large datasets of messy data (and the related problem of record linkage). It's still competitive with cutting edge approaches if carefully applied, and usually much faster so it can be applied to big data. It's the engine behind Splink, the free Python library that I develop: https://github.com/moj-analytical-services/splink

I had a friend that had a record linkage problem which interested me and so I dove down a rabbit-hole of Markov logic, but didn't see any mention of Naive Bayes approach when doing so. Although I don't really have any expertise in the area anyway, so it would be easier for me to miss.

Re: Autospam and Naive Bayes

#19
post #3

Naive Bayes is also surprisingly powerful for deduplication of large datasets of messy data (and the related problem of record linkage). It's still competitive with cutting edge approaches if carefully applied, and usually much faster so it can be applied to big data. It's the engine behind Splink, the free Python library that I develop: https://github.com/moj-analytical-services/splink

I had a friend that had a record linkage problem which interested me and so I dove down a rabbit-hole of Markov logic, but didn't see any mention of Naive Bayes approach when doing so. Although I don't really have any expertise in the area anyway, so it would be easier for me to miss.

The model is usually called the Fellegi Sunter model, but once you get into the maths, it's actually the same as Naïve Bayes. If you're interested I've got a blog post that explains this here: https://www.robinlinacre.com/maths_of_fellegi_sunter/

Re: Autospam and Naive Bayes

#20
post #17

IMHO one of the most overlooked features is that it's the best eXplainable AI out there IMHO. Spam scores are easily understandable and correctable. You can even build quite digestible nomograms [1] . Still everyone is using decision trees as XAI example while in my experience they are very unstable in quite indigestible after a depth of 3. I also believe Naïve Bayes is quite undervalued. What many people however ign…

The issue with NB for explainability is that the model scores can be very badly calibrated due to the "naive" assumption. You find especially on longer documents, the NB scores basically clump around 0 and 1 due to multiplying a bunch of dependent scores together as if they were independent. This means you can't really use them to assess how 'confident' the model is on its decision.

IMO logistic regression, or better fasttext (rank-limited logistic regression) should be the "default" baseline models you should use for NLP classification. They are trained with cross-entropy loss, so the scores are generally fairly well calibrated to an actual confidence score. Moreover since everything is linear (or at least logit-linear), you can do all the same explainability tricks as with NB (a little more effort for fasttext, but it is doable).

Post reply on HN