Why Do We Need Machine Learning?
Computers are excellent at following instructions. But some real-world problems are difficult to solve by writing every possible rule manually.
Of course it can.
The real question is: "Can we write all the useful rules?"Some Problems Are Easy to Solve With Rules
Consider a simple problem: we want to know whether a number is even or odd.
We can write a clear rule:
if number % 2 == 0:
result = "Even"
else:
result = "Odd"
There is no need for Machine Learning here.
The rule is simple, clear, and reliable.
But Some Problems Are Much More Complicated
Now imagine that we want a computer to identify whether an email is spam.
We might start with rules such as:
If the email contains "FREE", mark it as spam.
If the email contains many links, mark it as spam.
If the sender is unknown, mark it as spam.
But these rules create problems.
A legitimate email can contain the word "FREE". A real company can send an email containing many links. And an important email can come from someone we have never contacted before.
We would need to keep adding more and more rules.
Real-World Problems Keep Changing
There is another problem with manually written rules: real-world data changes.
Imagine a spam filter that was created using rules written five years ago.
Spammers can change:
- The words they use.
- The links they send.
- The way they format messages.
- The addresses they use.
If the system depends entirely on manually written rules, programmers may have to keep updating those rules whenever the behavior changes.
Instead of manually describing every possible pattern, we can provide examples and allow an algorithm to learn useful patterns from the data.
Example: Recognizing Objects in Images
Consider another problem:
We could try.
We might say a cat has:
- Two eyes.
- Two ears.
- Fur.
- A particular body shape.
But photographs can look very different.
A cat can be sitting, standing, lying down, partially hidden, far away, in darkness, or viewed from a completely different angle.
Trying to write a rule for every possible image quickly becomes impractical.
Write the Rules
Humans try to describe every important situation with explicit instructions.
Learn From Examples
Give the system many examples and let an algorithm find useful patterns in the data.
What Changes With Machine Learning?
In traditional programming, humans explicitly write the rules.
With Machine Learning, the approach changes.
The important change is that we are no longer trying to manually write every rule.
When Is Machine Learning Useful?
Machine Learning becomes useful when the problem has patterns that are difficult to describe with fixed rules.
There may be too many combinations for humans to describe manually.
Several pieces of information may interact in ways that are difficult to express as rules.
A system can learn from large collections of examples.
The patterns in the real world may change over time.
Machine Learning Does Not Magically Solve the Problem
This is an important point for beginners.
Machine Learning does not mean we give a computer completely random data and it automatically understands everything.
We still need humans to decide:
- What problem are we trying to solve?
- What data should we collect?
- What information is useful?
- What should the model predict?
- How will we know whether the prediction is good?
A model can only learn useful patterns from the information and examples we provide.
Do We Always Need Machine Learning?
No.
This is something beginners often misunderstand. Machine Learning is not automatically better than traditional programming.
Now Let's Use a Simple Real-World Problem
We now understand why Machine Learning can be useful.
But we need to see the idea in action.
So let's take a problem that is easy enough to understand but realistic enough to demonstrate the basic Machine Learning idea.
We need Machine Learning when writing all the rules manually becomes difficult.
Traditional programming is excellent when the rules are clear and manageable. Machine Learning becomes useful when a problem contains complex or changing patterns that are difficult to describe with fixed instructions.