Introduction to Forward and Backward Chaining
Forward and Backward Chaining are the modes used by the Inference Engine to deduce new information from the knowledge base. Inference Engine is one of the major components of the intelligent system in Artificial Intelligence that applies a set of logical rules to the existing information (Knowledge Base) to deduce new information from the already known fact. Forward and Backward Chaining are the two modes by which Inference engine deduce new information. Forward and Backward Propagation are exactly opposite of each other in the manner they deduce new information from the known facts.
How Forward Propagation Works?
Forward Chaining known by some as forward reasoning or forward deduction starts with the known fact or atomic sentence in the knowledge base and gradually inference rules are applied to the already known facts till we reach the goal state. In a nutshell, forward chaining makes a decision or reach the goal state based on the available data.
Properties of Forward Chaining
- It follows a bottom-up approach i.e. the reasoning deduction moves from bottom to the top
- It is also called a Data-driven approach as it relies on existing data to reach the goal state
- It is conclusion driven i.e. its objective is to reach the conclusion from the initial state
- It is widely used in the Expert System like CLIPS and Production rule system
Let’s look at an example to understand how Forward Chaining works in practice
Rule 1: IF A is human THEN A is mammal
Rule 2: IF A is a mammal THEN A is a living form
Rule 3: IF A is a living form THEN A is mortal
4.7 (4,405 ratings)
Fact: Shyam is human
From these inference rules, we have to reach the Goal
Goal: Is Shyam a mortal?
- Start with the Known fact. We know that Shyam is human (From the Fact statement).
- Using R1 we can infer that Shyam is a mammal. Since it is not a Goal Statement so continue.
- Then jump to Rule 2: if Shyam is a mammal then it as a living form so we can say that Murat is a living form. Since it is not a Goal Statement so continue
- Using R3, Since Shyam is a life form so it must be Mortal. Since it is the goal statement so Exit
Advantages of Forward Chaining
- Forward Chaining works great when the available information can be used to reach the goal state
- Forward Chaining has the ability to provide lots of data from the limited initial data
- Forward Chaining is best suited for Expert system application that requires more control, planning, and monitoring
- Forward Chaining should be applied when there are a limited number of initial states or facts
Disadvantages of Forward Chaining
- The inference engine will generate new information without knowing which information will be relevant in reaching the goal state
- The user might have to enter a lot of information initially without knowing which information will be used to reach the goal state
- Inference Engine may fire many rules which don’t contribute toward reaching the goal state
- It might give different conclusion which may result in the high cost of the chaining process
How Backward Propagation works?
Backward Chaining or Backward Propagation is the reverse of Forward Chaining. It starts from the goal state and propagates backwards using inference rules so as to find out the facts that can support the goal. It is also called as Goal-Driven reasoning. It starts from the given goal, searches for the THEN part of the rule (action part) if the rule is found and its IF part matches the Inference Rule then the rule is executed other Inference Engine set it as a new subgoal.
Rule 1: IF A AND B THEN C
Rule 2: IF C THEN E
Rule 3: IF A AND E THEN H
Facts: A, B
Goal: Prove H
Step 1: At first system looks for the statement that has goal on the R.H.S i.e. R3 then look for the L.H.S of the rule to check if it contains the fact. It contains A and E but we need B also
Step 2: Now it will have E as the sub goal which is proved by Rule 2. Now look at its L.H.S i.e. C
Step 3: C can be proved by Rule 1 which has A & B as the L.H.S
Step 4: Since we got bot the facts A&B from the goal so the Algorithm end here
Step 5: Stop
Properties of Backward Chaining
- Backward Chaining is a top-down approach where we start from the goal state and works backwards to find the required facts that support the goal statement
- It is known as Goal-driven approach as we start from the goal and then divide into sub-goal to extract the facts
- It applies the Depth-First search strategy
- It can only generate a limited number of conclusions
- It only tests for few of the required rules
Advantages of Backward Chaining
- The search in backward chaining is directed so the processing terminates when the fact is verified
- Backward Chaining consider only relevant parts of knowledge base so it never performs unnecessary inferences
- Unlike Forward Chaining, here only a few data points are needed but rules are searched exhaustively
- It is very efficient for problems like diagnosing and debugging
- Since backward chaining is goal-driven, so the goal must be known beforehand to perform backward chaining
- It is difficult to implement backward chaining
Conclusion – Forward and Backward Chaining
Rule-Based System is pertinent to human’s daily life so it is imperative to have understanding of these system. Both the modes involved in Rule-based systems come with its own sets of advantages and disadvantage. The selection of the approach depends on the nature of the problem.
This has been a guide to Forward and Backward Chaining. Here we discuss the properties, examples, advantages, and disadvantages of forward and backward chaining. You may also have a look at the following articles to learn more –