There are two ways to train a machine. The first is to train it to recognize objects by teaching it rules. The second is to train it to recognize objects by giving it examples. The first modality is called the rules-based approach. The second is called the machine learning (ML) system.
You want a machine to produce certain wheels, identifiable by their company logos, rims, spokes, center caps, sizes, and other qualities. You feed the system data and rules so that it will produce these wheels, and no others. The problem with this approach is that a rule-heavy system becomes too challenging for you to maintain and too frustrating for the computer to remember.
If you use the ML system, you can feed the computer examples of wheels with the correct logo, patterned center cap, number of spokes, size, and etc. The computer learns to produce the desired wheels through trial and error.
Rule-based systems have four basic components:
Facts, or domain of knowledge
An inference engine, which interprets the facts and takes appropriate actions through rules that include probabilistic, associative, or “If-Then” reasoning (“IF A happens THEN do B”).
A temporary working memory for briefly “remembering” those rules.
A user interface that allows developers to add, subtract, or change input and output signals.
The number of rules depends on the number of actions you want the system to handle, so 20 actions would require manually writing and coding at least 20 rules; the system is locked into following these rules.
ML is modeled after human intelligence, with the assumption that machine systems can learn from experience and improve their performance accordingly. ML is achieved through:
Supervised learning, whereby developers use labeled input and output data to train the system.
Unsupervised learning, whereby systems draw their own conclusions from unlabeled data.
Semi-supervised learning, which blends supervised and unsupervised learning.
Reinforcement learning, whereby the system learns through trial and error.
In short, ML gives systems the ability to forage outside the box, adapt their “thinking,” and expand their capabilities.
When do you use ML? When do you use rules?
Each situation is different. In short: rules and ML are both easily interpretable. ML gives more accurate results (since it requires a lot of data) and is easier to maintain than a rule-based system. Rule-based training is faster, easier, and cheaper to execute. Execution again depends on the model. If you have a system with a large number of actions, then you will want to use ML for faster, cheaper, and more effective results.
Use a rules-based approach when:
There is a small or fixed number of outcomes. For example, an “Add to Cart” button can either be clicked or not.
There is a risk of false positives. Only rules, with their 100% certainty, can prevent these from occurring.
Your employer/team has neither the knowledge nor the resources for ML.
Use ML when:
The system calls for a more unpredictable approach––the task is too complex or uncertain for rigid rules.
Situations, data and events are changing faster than the ability to constantly write new rules.
Linguistic nuances cannot be encapsulated by rigid rules. When you’re working on tasks that call for an understanding of language, you will want to use the adaptive capabilities of ML.
Google Cloud helps you build, deploy, and scale ML models faster, with pre-trained and custom tooling within its unified AI platform.