Are Rule-Based Systems Still Relevant Today?

Written by on December 8, 2022 in Knowledge Representation, Programming with 1 Comment

Before Machine Learning came into the mainstream, Rule-based systems were being used actively to solve complex decision making problems. In fact, Rule engines were considered to be an exotic component of Artificial Intelligence and the systems built using these rule engines were called Expert Systems.

I still remember learning to use OPS5 a few decades ago as part of my course work. It was an enriching experience to represent domain-specific knowledge in a specialized “if-then-else” format!

Rule-based systems are a good choice when the domain knowledge can be explicitly captured and can be modeled based on a manageable number of parameters. For example, when a customer applies to a bank for getting a loan, the bank will probably consider the following parameters:

(1) Salary
(2) Other incomes – from movable and immovable assets
(3) Age
(4) How long he has been with the bank
(5) Existing loans, if any
(6) Loan amount

There will probably be a few more parameters, but the list is definitely manageable. Given these parameters, it is possible to come up with a finite number of “rules” to unambiguously determine whether a customer can be sanctioned the loan he is applying for. Health care is another domain where rule-based systems are used.

Two main advantages of rule-based systems are Transparency and Explainability. The system is Transparent because the rules are all hand-crafted by the knowledge engineer(s) in consultation with domain experts and in the process the mapping of rules to the corresponding domain knowledge is precisely documented. This also helps in Explainability since the system, when asked by the user to explain its reasoning, can describe the steps it is following. This is very important in building user confidence.

To give an example, I had included a Therapeutics module in my iCure software to recommend a suitable homeopathic remedy for patients suffering from common cold. This module interacts with the user by asking certain questions regarding the prevailing symptoms. Based on the answers provided, it would then consult its Knowledge base and recommend a remedy. Here are some sample screenshots:

Gathering Symptom Information

Gathering Symptom Information

At this point, the user can ask the system as to why this question is being asked, by clicking the Why button. The system will respond appropriately.

Explanation by the System

Explanation by the System

The user selects his answer from the given list and continues. The system then asks another question based on his earlier reply.

Another Question from the System

Another Question from the System

As earlier, if the user wants, he can ask for the reason and the system will respond.

Explanation

Explanation

This interaction will continue till the system has gathered adequate information pertaining to the illness, in this case common cold. Finally, it will present its remedy choice.

Suggested Remedy

Suggested Remedy

The system also creates a log of the questions and answers for later review.

Log of the Interaction

Log of the Interaction

As the above shows, many of the rule-based systems work in an interactive Question-Answer mode when solving a problem. It is almost like the users are interacting with a human expert.

A major challenge In building a large rule-based system is to maintain and enhance the system’s knowledge-base periodically. When a new piece of knowledge needs to be included, sufficient care has to be taken to ensure that the new rules are consistent with existing rules. It is also likely that rules may have to be refactored to facilitate efficient inferencing. The process is not very different from the standard software development cycle. In my experience, I have noticed that any such system with more than a couple of hundred rules is quite difficult to maintain. Of course, proper tooling can mitigate the problems to some extent.

What are some popular rule engines in use today? Drools is a Java-based engine. Clips is a C-based public domain software. My favourite is KnowledgeWorks from LispWorks. It is Lisp-based and quite expressive and powerful! I have used it in a couple of projects and I am very pleased with its capabilities. Of course, there are several more engines out there.

For those who have a data set that contains input-output relationship and would like to model this as a set of “rules”, there are Rule Induction tools available. This does not mean that it is better to convert all data sets into rules. In fact, some problems are better solved by Machine Learning/Deep Learning. Image recognition is one such example.

In a nutshell, Rule-based systems are relevant and even preferred if the domain knowledge can be represented conveniently in the form of if-then-else rules and when the number of variables/parameters is not too large. The main advantage is explainability. A lot of research is being done in introducing explainability in ML/Deep Learning systems, but as of now rule-based systems perform better in this area.

Have a nice weekend!

Tags: , , , , ,

About the Author

About the Author: .

Subscribe

If you enjoyed this article, subscribe now to receive more just like it.

Subscribe via RSS Feed

1 Reader Comment

Trackback URL Comments RSS Feed

  1. T Ashok says:

    Indeed explainability it is for rule based systems. Curious to know if this is not deemed as necessary anymore and hence throw in a lot of data and figure it out via ML. If there is a lot of data, then feeding it seems easier rather than careful rule enhancement/addition? So is ML the fast food of AI?

Leave a Reply

Your email address will not be published. Required fields are marked *

Top