What is a rule-based system in AI?
A rule-based system in AI is a system that applies human-made rules to store, sort and manipulate data. In doing so, it mimics human intelligence.
Rule based system in AI require a set of facts or source of data, and a set of rules for manipulating that data. These rules are sometimes referred to as ‘If statements’ as they tend to follow the line of ‘IF X happens THEN do Y’.
The steps can be simplified to:
- First comes the data or new business event
- Then comes the analysis: the part where the system conditionally processes the data against its rules
- Then comes any subsequent automated follow-up actions
Some of the important elements of rule-based system in AI include:
A set of facts
These facts are assertions or anything that is relevant to the beginning state of the system.
Set of Rules
This set contains all the actions that should be performed within the scope of a problem and defines how to act on the assertion set. In the set of rules facts are represented in an IF-THEN form.
Termination Criteria or Interpreter
This determines whether a solution exists or not and figures out when the process should be terminated.
What are the characteristics of rule-based systems?
Some of the features of rule-based systems are:
- They are made up of the combined knowledge of human experts in the problem domain.
- They represent knowledge in a very declarative manner.
- They make it possible to use various knowledge representations paradigms.
- They support the implementation of non-deterministic search and control strategies.
- They help in describing fragmentary, ill-structured, heuristic, judgemental knowledge.
- They are robust and have the ability to operate using uncertain or incomplete knowledge.
- They can help with rule based decision making.
How does a rule based system in AI work?
Rule-based systems in AI outlines triggers & the actions that should follow (or are triggered). For example, a trigger might be an email containing the word “invoice”. An action might then be to forward the email to the finance team.
These rules most often take the form of "if" statements. "IF" outlines the trigger, "THEN" specifies the action to complete. So, if you want to create a rule-based system capable of handling 100 different actions, you’d have to write 100 different rules. If you want to then update the system and add actions, then you would need to write new rules.
In short, you use rules to tell a machine what to do, and the machine will do exactly as you tell it. From there, rule-based systems will execute the actions until you tell it to stop.
But remember: if you tell it to do something incorrectly, it will do it incorrectly.
What are the main components of a rules-based system?
A typical rule-based system has seven basic components:
The knowledge base
It holds the domain knowledge that is necessary for problem solving. In a rules-based system, the knowledge gets represented as a set of rules. Every rule specifies a relation, recommendation, directive, strategy or heuristic and has the IF (condition) THEN (action) structure. As soon as the condition part of the rule is satisfied, the rule gets triggered and the action part gets executed.
The database
In a rule based based approach the database has a set of facts that are used to compare against the IF (condition) part of the rules that are held in the knowledge base.
The inference engine
The inference engine is used to perform the reasoning through which the expert system comes to a solution. The job of the inference engine is to link the rules that are defined in the knowledge base with the facts that are stored in the database. The inference engine is also known as the semantic reasoner. It infers information or performs required actions on the basis of input and the rule base that's present in the knowledge base. The semantic reasoner involves a match-resolve-act cycle that works like this:
- Match - A section of the production rule system gets matched with the contents of the working memory to gain a conflict, where there are several instances of the satisfied productions.
- Conflict-Resolution - After the production system is matched, one of the production instances in the conflict is selected for execution for the purpose of determining the progress of the process.
- Act - The production instance selected in the previous stage is s executed, impacting the contents of the working memory.
Explanation facilities
The explanantion facilities make it possible for the user to ask the expert system how a specific conclusion was reached and why a specific fact is required. The expert system needs to be able to explain its reasoning and justify its advice, analysis, or conclusion.
User interface
In a rule based approach the user interface is the means through which the user seeking a solution to a problem communicates with the expert system. The communication should be as meaningful and friendly as possible and the user interface should be as intuitive as possible.
These five elements are critical for any rule-based system. They are the core components of the rule-based system. But the system might have some additional components as well. A couple of these components could be the external interface and the working memory.
External interface
The external interface enables an expert system to work with external data files and programs that are written in conventional programming languages like C, Pascal, FORTRAN and Basic.
Working memory
The working memory stores temporary information and data.
How are rules-based systems different from learning-based systems?
In contrast to Rule-Based Systems, Learning Systems observe data and continuously learn from it.
That is, while Rules Based Systems quickly become out of date, Learning Systems automatically improve over time. And Learning Systems improve without the massive expense of having people maintain complex rules.
Learning systems find patterns and treat similar things similarly. Think of how Netflix or Hulu keep track and learn from what you watch, and then compare it to what people like you watch to make recommendations and keep you binge-watching. There is some complexity in execution, but it's a much simpler concept. And a concept more in line with how humans also learn.
Finally, Learning Systems' results are necessarily more measurable. It's the only way they can improve over time; because if they cannot measure results, they could not learn what actions are better and what actions are worse.
Construction of rule-based systems
Data-based construction follows a machine learning method, which is in general domain-independent. Machine learning techniques can be categorized into two sub-types: supervised learning and unsupervised learning.
Supervised learning means learning with assistance. This is because all instances from a data set are labeled. This type of learning aims to predict attribute values for unknown instances by using the known data instances. The predicted value of an attribute may be either discrete or continuous in the construction. Therefore, supervised learning could be involved in both classification and regression tasks that can be used for categorical prediction and numerical prediction respectively.
On the other hand, unsupervised learning means learning without any assistance. This is because all instances from a data set are unlabeled. This type of learning aims to find earlier unknown patterns from data sets. It includes association, which aims to find relationships among attributes about their values, and clustering, which aims to find a group of objects that are similar from data sets.
In general, all three types of rule-based systems can be constructed with the following steps: Data collection->Data pre-processing->Learning from data->Testing. However, there are different requirements for different learning tasks.
In other words, to build a high-quality model by using machine learning techniques, it is important to find algorithms that are suitable for the chosen data sets concerning the characteristics of data. From this point of view, data preprocessing may not be necessary if the chosen algorithms are good fits. In addition, different types of dimensionality reduction techniques (such as feature selection), a type of data preprocessing, may be required for different tasks. If it is a classification or regression task, supervised feature selection techniques may be required in general.
What are advantages of the rule-based system in AI?
- A rule-based system is generally cost-efficient and accurate in terms of its results.
- The outputs generated by the system are dependent on rules so the output responses are stable and not random.
- The coverage for different circumstances is less, whatever scenarios are covered by the Rule Based system will provide high accuracy. The error rate goes down because of the predefined rules.
- It's feasible to reduce the amount of risk in terms of system accuracy.
- Optimizing the speed of the system is easier as you know all the parts. So providing instant outputs, is not a big issue.
What are the disadvantages of the rule-based system in AI?
- A rule-based system is built upon a lot of data, deep knowledge of the domain, and a lot of manual work.
- Writing and generating rules for a complex system is quite challenging and time-consuming.
- The self-learning capacity in a rule-based system is less as it generates the result as per the rules.
- Complex pattern identification is a challenging task in the Rule Based method as it takes a lot of time and analysis.