Skip to content
GenAI Learn/Welcome to AI Engineering Fundamentals
Browsing as a guest. Sign in to save your progress and earn XP as you complete chapters.

How to Think Like an ML Practitioner

4 min read

You'll learn to

  • -Contrast rule-writing with learning from examples, using a spam filter you can run
  • -State the trade-off: learned systems handle messy patterns but are harder to explain
  • -Carry the practitioner's three questions into the rest of the phase

Tip: the highlighter is on - just select any text below to mark it. Use the highlighter button up top to change color or turn it off. Highlights are saved on this device only. Log in to save them to your account instead.

Traditional software engineering is rule-writing. You specify exactly what should happen for every input you can foresee. Machine learning inverts this. Instead of writing the rule, you show the system many examples of inputs and correct outputs, and an algorithm finds a rule, or something rule-shaped, that fits.

An Analogy: Teaching a Child to Spot a Dog

You could try to give a child rules: four legs, a tail, barks. Then they meet a three-legged dog that does not bark, and a cat with four legs and a tail. Or you could point at many dogs and many non-dogs and let them work it out. They end up with a good sense of "dog" that they could not fully put into words. ML is the second way.

From "What Should Happen" to "What Usually Happens"

A traditional spam filter might hard-code a rule: if the email contains the word "lottery" and has more than three exclamation points, mark it spam. An ML filter is shown thousands of emails labeled spam or not spam, and learns patterns, such as word choice, sender reputation and structure, that no human wrote down. The demo is a tiny version. The rule is written by hand. The learned filter simply counts how often each word appeared in spam and in ordinary mail, from eight example emails.

Press Run: the hand-written rule misses spam that the examples catch

The trade-off is real. You gain the ability to handle patterns too complex or too numerous to write by hand: the learned filter caught "claim your free cash now", which the rule never mentioned. You lose the ability to point at a single line of code and say "this is why it decided that". Neither is perfect, though. The rule catches the shouting lottery message that the tiny learned filter, with only eight examples, misses. More examples would fix that, whereas the rule needs a person to notice.

  • -Rules-based thinking is precise and debuggable, but brittle to inputs you did not foresee.
  • -Learning-based thinking is flexible and generalizes to new inputs, but is harder to explain and harder to guarantee correct.

Most real systems use both. A production ML system is usually a learned model wrapped in ordinary rules-based code that handles validation, guardrails and fallback behavior. You rarely see a pure ML system with no traditional code around it.

The Practitioner's Questions

When an ML practitioner looks at a problem, they ask different questions from a traditional engineer. What data do we have, and does it represent what we will see in production? What does "correct" even mean here, and can we measure it? What happens when the model is wrong? Can we detect it, and what is the fallback? These three questions come up constantly through the rest of this phase.

Interview Signal

A PM asks you to add a rule: "if a user does X, flag them as high-risk." You suspect this is really a classification problem. How would you explain wanting to reframe it that way?

Weak Answer

"I would just say ML is more modern and accurate, so we should use it instead."

Strong Answer

"I would point out that hand-coding a threshold rule assumes we already know the exact pattern that predicts risk, which is rarely true and gets brittle fast as new patterns emerge. Framing it as a supervised learning problem lets the system learn that pattern from labeled examples instead, at the cost of needing labeled data and losing some of the rule's inspectability. I would also flag that a real system usually wraps the learned model in rule-based guardrails anyway, so it is not really rules versus ML, it is rules plus a learned layer where a fixed rule cannot keep up."

Check Yourself1 / 6

What is the core mental shift this chapter describes when moving from traditional software engineering to machine learning?

Discussion0

Join the Discussion

Sign in to leave comments, reply to others, or like insights.

Sign In to ScaleDojo

No comments yet. Be the first to start the thread!