ML vs Traditional Programming
Traditional programming
In traditional programming, you create explicit rules.
- Input data + your rules → output
false
flowchart LR I[Input] --> R[Rules (code)] --> O[Output]
false
Example: a tax calculator.
- You have a written policy.
- You implement the policy in code.
Machine learning
In ML, the “rules” are learned from data.
- Input data + output labels → learning algorithm → model
- Later: input data + model → predicted output
false
flowchart LR
subgraph Training
D[Training Data (X)] --> A[Learning Algorithm]
L[Labels (y)] --> A
A --> M[Model]
end
subgraph Inference
N[New Input (X_new)] --> M --> P[Prediction]
end
false
What changes in your workflow?
Traditional programming focus:
- getting the logic right
- writing tests for rule correctness
ML engineering focus:
- getting training data right
- choosing features
- preventing leakage and overfitting
- measuring with the right metrics
A simple example
Traditional approach (rule-based spam)
Rule-based spam (oversimplified)
def is_spam(email_text: str) -> bool:
keywords = ["free", "winner", "click here"]
text = email_text.lower()
return any(k in text for k in keywords)Rule-based spam (oversimplified)
def is_spam(email_text: str) -> bool:
keywords = ["free", "winner", "click here"]
text = email_text.lower()
return any(k in text for k in keywords)ML approach
You collect labeled examples:
- email text → spam / not spam
Then train a model on those examples.
Key takeaway
- Traditional programming is rules-first.
- ML is data-first.
If you don’t have good data (or enough), ML usually disappoints.
If this helped you, consider buying me a coffee ☕
Buy me a coffeeWas this page helpful?
Let us know how we did
