Inferences The Reasoning Power of Expert Systems Aims • Discuss – strategies that can be used to guide a KBS in using the stored knowledge – how the knowledge is communicated with the user – how to make inferences from the stored knowledge • Once the knowledge is acquired and stored (represented) the knowledge base is complete • This must be then be processed (reasoned with) • A computer program is required to access the knowledge for making inferences • This program is an algorithm that controls a reasoning process • Usually called the inference engine • In a rule based system it is called the rule interpreter Inference Engine • Directs the search through the KB • Dictates which rule to “fire” • Most popular techniques for searching through rule based systems are – forward chaining – backward chaining Logical Process of reasoning • information is acquired about problem premises – it is raining • This is used by the logical process to create the output - conclusions called inferences – IF it is raining THEN bring an umbrella • Facts that are known to be true can be used to derive new facts that also must be true Inferencing with rules • Rule 1 – IF it is sunny, THEN we will go to the beach • Lets say it is sunny. This means that the premise (IF side) of the rule is true. • Using a technique known as “reasoning with logic” indicates that the conclusion is also true • We say that Rule 1 fires • Firing a rile occurs only when all of the rules hypotheses (the IF parts) are satisfied (being either true or false) • When a rule is fired a conclusion is drawn and stored in the assertion base • We will go to the beach is stored in the assertion base • It could be use to satisfy the premise of other rules e.g. • RULE 2 – If we go to the beach THEN bring bucket and spade • The true or false values can be obtained by – querying the user – checking other rules Inferencing with rules • Every rule in the KB can be checked to see whether its premise can be satisfied by previously made assertions • This process may be done in two directions • will continue until – no more rules can fire – until a goal is achieved Chaining - Example • Suppose you want to fly from Belfast to Lima but there are no direct flights • Therefore you try to find a chain of connecting flights • Two basic ways of searching – start with all flights arriving at Lima and find the city where they originated – Continue the process until you find Belfast – because you are working backwards from your goal, the process is known as backward Forward Chaining – List all the flights leaving Belfast and mark their destinations - Forward Chaining • The search process goes through a set of knowledge rules. After determining which rules are true and which are false, the search ends with a finding Backward Chaining • Start from a goal to be verified as either true or false • Then looks for a rule that has that goal in its conclusion • Then checks the premise of that rule in an attempt to satisfy that rule • Checks the assertion base first. If the search fails there, the ES looks for another rule whose conclusion is the same as the premise of the previous rule Should we buy a house or not? • RI – IF inflation is low THEN interest rates are low – ELSE interest rates are high • R2 – IF interest rates are high THEN housing prices are high • R3 – IF housing prices are high THEN do not buy a house, – ELSE buy it Run a backward chaining with a high inflation rate as given • Starting point – look at the rule which includes the goal in its conclusion - Rule3 • Step 1 – try to ascertain the outcome of the rule. At present all we have in the ascertain base is that inflation rate is high • Step 2 – ascertain if the premise of Rule 3 is correct – I.e. IF housing prices are high – Note that this premise is the conclusion of rule 2. Therefore to verify if this premise is true or false we must look to the conclusion or Rule 2 • Step 3 – To ascertain the outcome of Rule 2 we must establish if the premise is true or false I.e. • IF interest rates are high – Remember, At present all we have in the asertion base is that inflation rate is high • Step 4 – The premise of Rule 2 is the conclusion of Rule 1. We have enough information in the assertion base too establish the outcome of Rule 1 Backward Chaining • Step 5 – Computer has enough information at last to establish that the right decision is not to buy a house Forward Chaining • Start from the available information as it becomes available, then try to draw conclusions. • These conclusions are entered into the assertion base • When conclusions are drawn the computer attempts to solve other rules whose premises can be solved from information in the assertion base Example • Start – As it is known that inflation rate is high, Rule 1 can be evaluated and the conclusion entered into the assertion base • Interest rates are high • Step 1 – The premise of Rule 2 depends on the outcome of Rule 1. As this is known the conclusion of Rule 2 can be determined and entered into the assertion base • Housing prices are high Example • Step 3 – The premise of Rule 3 depends on the outcome of Rule 2. As this is known the conclusion of Rule 3 can be determined and entered into the assertion base • No not buy house • Step 4 – As this was the original goal the chaining stops • Another example is given in section 15.3 The Inference Tree • Provides a schematic view of the inference process (similar to a decision tree) • Each rule is composed of a premise and a conclusion • In the diagram each of these is represented by a node • Branches connect the premises and conclusions • The operators AND and OR are used to reflect the structure of the rules • A form of Knowledge Representation The Inference Tree • By using the tree, we can visualise the process of inference and movement along the branches of the tree • This is called tree traversal • Various strategies for this • To traverse an OR node, it is sufficient to traverse just one of the nodes below • To traverse an AND node, we must traverse all the nodes below it Diagram • Rule 1 – IF it is likely to rain THEN take an umbrella • Rule 2 – IF it is cloudy THEN it is likely to rain • Rule 3 – IF the forecast is bad THEN it is likely to rain Model-Based Reasoning • Depends on knowledge of the structure and behaviour of a device, rather than relying on production rules that represent expertise • Study section 15.6 Case-based Reasoning (CBR) • Adapt solutions that were used to solve old problems • Use them to solve new problems • Study section 15.7