Rule-Based System

Table of contents

Automate your business at $5/day with Engati

REQUEST A DEMO
Rule-Based System

What is a rule-based system in AI?

A rule-based system is a system that applies human-made rules to store, sort and manipulate data. In doing so, it mimics human intelligence.

To work, rule-based systems 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 systems 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.


rule based system
Source: Science Direct

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 work?

Rule-based systems, unsurprisingly, work based on rules. These rules outline triggers and 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?

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 sovling. 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

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 which 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 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 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

The user interface is the means through which the user seeking a solution to a problem communicates with the expert system. The communicate should be as 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 componets 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 Rules-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. The step for learning from the data mentioned above may also need to be broken down in some special cases. 

 

What are advantages of the rule-based system? 

  1. A rule-based system is generally cost-efficient and accurate in terms of its results.
  2. The outputs generated by the system are dependent on rules so the output responses are stable and not random.  
  3. The coverage for different circumstances is less, whatever scenarios are covered by the RB system will provide high accuracy. The error rate goes down because of the predefined rules.
  4. It's feasible to reduce the amount of risk in terms of system accuracy. 
  5. 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? 

  1. A rule-based system is built upon a lot of data and deep knowledge of the domain as well as a lot of manual work. 
  2. Writing and generating rules for a complex system is quite challenging and time-consuming. 
  3. The self-learning capacity of the is less in a rule-based system as it generates the result as per the rules.  
  4. Complex pattern identification is a challenging task in the RB method, as it takes a lot of time and analysis. 


Close Icon

Request a Demo!

Get started on Engati with the help of a personalised demo.

Thanks for the information.
We will be shortly getting in touch with you.
Please enter a valid email address.
For any other query reach out to us on contact@engati.com
Close Icon

Contact Us

Please fill in your details and we will contact you shortly.

Thanks for the information.
We will be shortly getting in touch with you.
Oops! Looks like there is a problem.
Never mind, drop us a mail at contact@engati.com

<script type="application/ld+json">
{
 "@context": "https://schema.org",
 "@type": "FAQPage",
 "mainEntity": [{
   "@type": "Question",
   "name": "What is a rule-based system?",
   "acceptedAnswer": {
     "@type": "Answer",
     "text": "A rule-based system is a system that applies human-made rules to store, sort and manipulate data. In doing so, it mimics human intelligence."
   }
 },{
   "@type": "Question",
   "name": "How does a rule-based system work?",
   "acceptedAnswer": {
     "@type": "Answer",
     "text": "Rule-based systems, unsurprisingly, work based on rules. These rules outline triggers and 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."
   }
 },{
   "@type": "Question",
   "name": "What are the components of a rules-based system?",
   "acceptedAnswer": {
     "@type": "Answer",
     "text": "A typical rule-based system has four basic components:
1. A list of rules or rule base, which is a specific type of knowledge base.
2. An inference engine or semantic reasoner, which infers information or takes action based on the interaction of input and the rule base. 
3. Temporary working memory.
4. A user interface or other connection to the outside world through which input and output signals are received and sent."
   }
 },{
   "@type": "Question",
   "name": "How are rules-based systems different from learning-based systems?",
   "acceptedAnswer": {
     "@type": "Answer",
     "text": "In contrast to Rules-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."
   }
 }]
}
</script>