C.W.K.
Stream
Lesson 02 of 10 · published

Rules, Heuristics, Statistics, and ML

~28 min · framing, rules, statistics

Level 0Scout
0 XP0/48 lessons0/11 achievements
0/120 XP to next level120 XP to go0% complete

Four overlapping tools

Rules encode known logic that almost always holds. Heuristics encode useful shortcuts that work most of the time. Statistics estimates relationships and uncertainty under modeling assumptions. Machine learning fits parameters that minimize a measured prediction loss. They overlap, but they are not interchangeable, and reaching for ML when a rule would do is a common professional mistake.

ToolBest fitRisk
RuleStable known logic, audit requiredBrittle on rare exceptions
HeuristicFast approximation, low stakesSilent bias accumulates
StatisticsInference and uncertaintyWrong causal story
MLPrediction from labeled examplesLeakage and drift

Choosing the right one

Pick the simplest tool that absorbs the variation in the problem. If the rule is stable and inspectable, do not replace it with a model just to feel modern. If business stakeholders cannot define the target without a long meeting, no model will rescue them.

Combining them

Real systems mix all four. A fraud system might use rules for known patterns, a heuristic threshold for high-velocity accounts, a statistical baseline for expected behavior, and an ML model for the unknown unknowns. The interesting design question is which layer owns which case.

Code

Decision boundary: when does ML earn its keep?·python
def choose_tool(problem):
    if problem.rule_is_stable and problem.exceptions_are_rare:
        return "rule"
    if problem.needs_uncertainty and problem.sample_size_is_small:
        return "statistics"
    if problem.labels_exist and problem.mistakes_are_measurable:
        return "ml"
    return "clarify_problem_before_modeling"
Rule + ML hybrid: rule wins, ML covers the long tail·python
def predict(row, rule_fn, model):
    rule_decision = rule_fn(row)
    if rule_decision is not None:
        return rule_decision  # auditable path
    return model.predict_proba([row.features])[0, 1] >= 0.42

External links

Exercise

Take one automation idea from your backlog. Write a one-paragraph case for solving it as a rule, as statistics, and as ML. Pick the winner and justify why the other two are worse for this specific decision.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.