AI vs Machine Learning: Written Rules vs Learned Rules
The outer ring of the map, AI that is not machine learning, gets almost no attention today. That is a mistake. A lot of software you rely on every day is "AI" in the classic sense and does not learn anything at all.
The real line between AI in general and machine learning is simple to state: who writes the rules? In classic AI, a person does. In machine learning, the system works them out from examples. This lesson makes that line sharp, and shows why both sides still matter.
What You'll Learn
- What rules-based AI is, with everyday examples you already use
- How machine learning flips the process by learning rules from examples
- The strengths and weak spots of each approach
- Why many real products combine both
Classic AI: a person writes the rules
For decades, most AI was built by people carefully writing down how to solve a problem. The machine then follows those instructions very fast and very reliably.
Some examples you have probably used:
- GPS route planning. A search method checks possible paths through a road map and picks the fastest one. It is clever, but it does not learn. It follows a recipe people designed.
- Classic chess engines. For years, top chess programs searched ahead through millions of moves and scored positions using rules written by strong players and programmers.
- Tax and benefits software. It asks you questions and applies the tax rules exactly as written in law, branch by branch.
- Early spam filters. "If the subject contains 'FREE MONEY' and the sender is unknown, mark as spam."
These are often called rules-based, symbolic, or expert systems. They all share one pattern: human knowledge goes in as explicit instructions.
Machine learning: the system writes the rules
Machine learning flips that around. Instead of writing the rules, you give the system lots of examples with the right answers, and it finds the patterns that connect inputs to answers.
- Classic AIRules + data in, answers out
- Machine learningData + answers in, rules out
Take the spam example again. A modern filter is not given a list of banned phrases. It is shown millions of emails that people marked as "spam" or "not spam," and it works out for itself which combinations of words, senders, links, and timing tend to mean spam. Those learned patterns become its rules, even though no person ever wrote them down.
That flip is the whole difference. Everything else about machine learning, including how it trains and why it needs data, follows from it. If you want the fuller picture of how machine learning learns, including the main styles of learning, Introduction to Machine Learning (No Code) covers it in depth. For this course, the key idea is just this: learned rules instead of written rules.
Strengths and weak spots of each
Neither approach is simply "better." They are good at different things.
Written rules win on control. Learned rules win on messy real-world patterns.
| Criteria | Written rules (classic AI) | Learned rules (machine learning) |
|---|---|---|
| Needs | An expert who can state the rules | Lots of good examples |
| Predictable? | Yes, same input gives same output | Mostly, but can surprise you |
| Explainable? | Easy: point to the rule | Harder: patterns are spread across the model |
| Handles messy, fuzzy cases? | Poorly | Well, if it saw similar examples |
| Keeping it current | Someone edits the rules | Retrain on new examples |
Written rules (classic AI)
- Needs
- An expert who can state the rules
- Predictable?
- Yes, same input gives same output
- Explainable?
- Easy: point to the rule
- Handles messy, fuzzy cases?
- Poorly
- Keeping it current
- Someone edits the rules
Learned rules (machine learning)
- Needs
- Lots of good examples
- Predictable?
- Mostly, but can surprise you
- Explainable?
- Harder: patterns are spread across the model
- Handles messy, fuzzy cases?
- Well, if it saw similar examples
- Keeping it current
- Retrain on new examples
The test that tells you which to use: can a person clearly write down the rules?
- Calculating sales tax, checking whether a password has 12 characters, finding the shortest route on a known map: yes. Rules win. They are cheaper, clearer, and easier to audit.
- Recognizing a cat in a photo, deciding if a review sounds angry, guessing which product a shopper might like: no. Nobody can write the full rulebook for "what a cat looks like." Learning wins.
A good way to remember it: use written rules when you know the answer's logic, and learning when you only know the answers.
Where rules still win today
It is tempting to assume machine learning has replaced classic AI. It has not. Rules are still the right choice when:
- Mistakes are costly and must be explained, such as eligibility checks in banking, insurance, or government services. "The rule says so" is an answer an auditor accepts.
- The logic is already known exactly, such as tax law or safety interlocks in machinery.
- There is not enough data to learn from, which is common for rare events.
- Behavior must never drift. A learned system can change when it is retrained. A rule stays put until someone changes it on purpose.
Most real products mix both
In practice, the most reliable systems combine the two. Machine learning handles the fuzzy judgment, and written rules wrap around it as guardrails.
- A bank's fraud system may use a learned model to score how unusual a payment looks, then apply a written rule such as "block anything over this score and over this amount."
- A navigation app uses classic route search, but machine learning predicts traffic on each road.
- A chatbot runs on a deep learning model, but the company adds written rules about topics it must refuse or information it must never share.
So when you look at a product, the question is rarely "rules or learning?" It is "which parts are rules, and which parts are learned?"
Key Takeaways
- The line between AI in general and machine learning is who writes the rules: a person, or the system learning from examples.
- Classic, rules-based AI is still everywhere: route planning, tax software, eligibility checks, safety systems.
- Machine learning takes in examples with answers and produces the rules itself.
- Use written rules when the logic can be clearly stated and must be explainable; use learning when you have lots of examples but no clear rulebook.
- Real products usually combine both: learned models for judgment, written rules as guardrails.

