Step 4 of 6
We now score the base model on the 100 validation emails. They were never used for learning, so the results are an honest first look. Because validation is allowed to guide our decisions, this is where we try improvements. Each improvement is retrained on the training set only and re-measured here.
Of all emails, how many did the model get right?
(caught + correctly kept) ÷ all emails
Can look great even when the model misses most spam, if spam is rare. Never read it alone.
When the model says “spam”, how often is it really spam?
caught ÷ (caught + good mail binned)
Low precision means real emails vanish into the spam folder. Users hate this most.
Of all the real spam, how much did the model catch?
caught ÷ (caught + missed spam)
Low recall means spam keeps reaching the inbox.
One number that balances precision and recall.
2 × precision × recall ÷ (precision + recall)
Handy for ranking versions, but it hides which side is weak. Always look at both.
For a spam filter, precision protects the inbox (no important email lost) and recall protects the user’s attention (no junk getting through). Which one matters more is a product decision, not a maths one.
Accuracy
78.0%
78 of 100 correct
Precision
80.0%
24 of 30 flagged were spam
Recall
60.0%
24 of 40 spam caught
F1
68.6%
Reading the result
Accuracy of 78% sounds fine, but it fell from 84% on the training emails, which is the normal gap between studied and unseen data. The real weakness is recall: 16 of 40 spam emails slipped through (5 polished cold outreach, 2 ceo / gift-card fraud, 4 account phishing, 4 pharmacy spam, 1 fake invoice / parcel), and 6 legit emails were wrongly binned.
v1 · Base model
4 starter features: body length, grammar issues, funky sender characters, sensational subject. Default 0.50 cut-off.
Validation: accuracy 78% · precision 80% · recall 60%
v2 · + more features
We read the validation mistakes of v1. Spam with links, urgent or money wording, generic greetings and cheap domains was slipping through, so we added 5 features for those signals.
Validation: accuracy 90% · precision 94% · recall 80%
v3 · + tuned cut-off
Moved the spam cut-off from 0.50 to 0.67. We picked it on the validation set to keep precision at or above 95%, because a legit email in the spam folder is the costly error, while catching as much spam as possible.
Validation: accuracy 91% · precision 100% · recall 78%
Experiment · outlier clean-up
Log-scaled body length and capped link and exclamation counts. Rejected: no gain on validation, so we dropped it to keep the model simple.
Validation: accuracy 90% · precision 94% · recall 80%
The rejected experiment is just as useful as the wins: validation told us it was not worth the complexity. Notice the last accepted step trades a little recall for a lot of precision, which is a product choice (we would rather let some spam through than hide real mail).
| Version | Accuracy | Precision | Recall | F1 | Missed spam | Good mail binned |
|---|---|---|---|---|---|---|
| v1 | 78.0% | 80.0% | 60.0% | 68.6% | 16 | 6 |
| v2 | 90.0% | 94.1% | 80.0% | 86.5% | 8 | 2 |
| v3 | 91.0% | 100.0% | 77.5% | 87.3% | 9 | 0 |
Out of 40 spam and 60 legit emails. One email = 2.5 points of recall.
| Feature | What it means | Learned weight | What was learned |
|---|---|---|---|
| Number of links | How many web links the body contains. | -0.91 | Spam 1.17 vs legit 0.89 links on average: barely different. The weight even turns negative (-0.91) because receipts, notifications and newsletters from genuine senders are link-heavy. A good moment to ask: is this pattern real, or an accident of this sample? |
| Urgency & money wording | Pressure and payoff language inside the body. | +0.69 | A clear signal: spam averages 2.23 pressure or money phrases against 0.42 in legit mail. It also catches phishing that comes from a clean-looking address. |
| Generic greeting | “Dear Customer / Friend / Winner” instead of addressing the recipient by name. | +0.69 | 64% of spam opens with “Dear Customer/Friend…” against 5% of legit mail. Cheap to compute and strongly separating. |
| Cheap or risky domain ending | Sender domain ends in a TLD heavily used for throw-away domains. | +0.69 | 39% of spam comes from a throw-away domain ending, versus 0% of legit mail. It never fires on legit mail here, but it misses the 61% of spam that uses ordinary-looking domains. |
| Exclamation marks in body | Excited, pushy tone inside the message. | +0.25 | Spam averages 1.07 exclamation marks vs 0.43. A small push towards spam; legit promos use plenty too. |
| Mistake | Type of email | Subject | Sender | Spam probability |
|---|---|---|---|---|
| Missed spam | Polished cold outreach | Quick question about your website | zoe@pixelpine.com | 41% |
| Missed spam | CEO / gift-card fraud | Request | daniel.silva@gmail.com | 5% |
| Missed spam | Polished cold outreach | Ideas to grow Kestrel Labs's traffic | grace@pixelpine.com | 42% |
| Missed spam | Account phishing | URGENT: verify your account within 24 hours | alerts@meridianbanksecure.co | 63% |
| Missed spam | CEO / gift-card fraud | Need your help today | liam.haddad3@outlook.com | 9% |
| Missed spam | Polished cold outreach | Ideas to grow Northwind's traffic | priya@leadspark.com | 41% |
| Missed spam | Polished cold outreach | Quick question about your website | priya@growthloop.com | 41% |
| Missed spam | Fake invoice / parcel | Invoice #11112 attached | service@invoiceonline.com | 31% |
| Missed spam | Polished cold outreach | 10 minutes this week? | zoe@rankwise.com | 19% |
Validation scores are now slightly optimistic
We looked at these results many times and made choices based on them, so the model has been indirectly shaped to fit this particular set. That is why we need a third set that nobody has looked at. On to the blind test.