cd /news/machine-learning/two-spam-models-ten-emails · home › topics › machine-learning › article
[ARTICLE · art-157662] src=nirmalutwani.substack.com ↗ pub= topic=machine-learning verified=true sentiment=· neutral

Two spam models, ten emails

A developer built two supervised spam-classification models to compare hand-picked features against features learned directly from email data. The first model uses three manually chosen features (a word list, exclamation-mark count, and link presence) with three weights plus a bias, while the second derives roughly 70 word features from the data, one weight each, starting at zero. Both share the same training loop, but their learned biases diverge sharply — about -4.5 for the hand-picked model versus about -0.74 for the data-derived one, since ham words like "thanks" already pull toward not-spam.

read1 min views1 publishedOct 26, 2026
Two spam models, ten emails
Image: Nirmalutwani (auto-discovered)

Quick recap of the simplest machine learning models, using spam.

You have emails that are already marked spam or not.

You train: the program looks at them and learns a few numbers (i.e. weights). Then a new email comes in and you use those weights to decide.

I did two versions. Both have labels on the inputs, so both are supervised. You know the job: spam or not. Inference is the same. A new email comes in. You want an answer. What changes is how you turn the email into numbers.

  1. I pick the features

Count of words from a list I wrote, count of !, and whether there is a link. Training only learns how much those three matter. Three weights, plus a bias.

  1. The features come from the emails

No list. About 70 words from the data, one weight each, all starting at 0. A word in spam goes up. A word in not-spam goes down. How often a word appears is a count. That is not the weight.

Same loop in both. Go through the emails many times. Guess, compare to the label, change the weights. Stop, and the weights are the classifier.

Both models also learn a bias: the guess when every feature is 0. At epoch 0 every weight is 0, so both models guess 0.50. After training, Model 1’s bias is about -4.5. Model 2’s is about -0.74, because ham words like thanks already pull toward not-spam.

Github repo: https://github.com/nirmal91/model-experiments

── more in #machine-learning 4 stories · sorted by recency
── more on @github 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/two-spam-models-ten-…] indexed:0 read:1min 2026-10-26 · —