Advanced Higher Computing Based on Heriot-Watt University Scholar Materials Rule Based Systems Alford Academy Business Education and Computing Alford Academy Business Education and Computing 1 1
Lesson Objectives Expert Systems If .. Then Rules Inferencing in Rule Based Systems Certainty Factors Alford Academy Business Education and Computing Alford Academy Business Education and Computing 2 2
Expert Systems An expert system has 3 components: Often built using an expert system shell Expert system shell has no knowledge base Alford Academy Business Education and Computing Alford Academy Business Education and Computing 3
Stages of Creating an Expert System 1. knowledge acquisition 2. knowledge representation 3. system validation Alford Academy Business Education and Computing
Knowledge acquisition Domain expert: personal experience of problems to be solved personal expertise in how to solve the problems personal knowledge of the reasons for selecting certain methods. Knowledge engineer: no specialist knowledge of the domain need to learn from the domain experts, prior to the start of the project and during the acquisition of knowledge. Alford Academy Business Education and Computing
Alford Academy Business Education and Computing Difficulties Sort the 9 difficulties on pages 92 and 93 of the Scholar notes in order of negative impact on knowledge acquisition: Let 1 = least impact and 9 = most impact Alford Academy Business Education and Computing
Knowledge Representation Use an expert system shell Use a declarative language (Prolog) Use a procedural language – need to program all parts of the system Alford Academy Business Education and Computing
Alford Academy Business Education and Computing System Validation System tests that compare the advice of the expert system with that of the domain expert. Possible errors include: Incomplete knowledge or incorrect representation Misunderstanding of knowledge engineer with information provided by domain expert Knowledge not being processed correctly Alford Academy Business Education and Computing
Alford Academy Business Education and Computing If .. Then Rules Consider the following knowledge base Can use forward or backward rules Alford Academy Business Education and Computing
Alford Academy Business Education and Computing Forward Rules Of the form IF condition(s) THEN conclusion If colour = bronze AND size (mm) = 18 AND shape = round AND symbol = fish Then value = 1H. Alford Academy Business Education and Computing
Alford Academy Business Education and Computing Backward Rules Of the form conclusion IF condition(s) value = 1H If colour = bronze AND size (mm) = 18 AND shape = round AND symbol = fish. Alford Academy Business Education and Computing
Alford Academy Business Education and Computing Visual Comparison Alford Academy Business Education and Computing
Alford Academy Business Education and Computing Practical Activity Do Task 5.4.3 on page 98 of Scholar notes. Alford Academy Business Education and Computing
Justification and Explanation it helps the enquirer to understand the subject better; it means that the enquirer can learn how the expert thinks; it gives the enquirer more confidence in the advice given. Alford Academy Business Education and Computing
Investigation Do Task Exploring Justification Features on page 99 of Scholar notes. Alford Academy Business Education and Computing
How an Expert System reaches its conclusion Essentially, the inference engine uses a search algorithm to search through the rules in a similar fashion to the evaluation of a query in Prolog (see Topic 4). The rules can be represented as a decision tree: The tree can be searched either breadth-first or depth-first. The inference engine can also be classified as either forward chaining or backward chaining. Alford Academy Business Education and Computing
Alford Academy Business Education and Computing Practical Activity Read notes on page 100 – do activity Examining the behaviour of an inference engine Alford Academy Business Education and Computing
Advantages and Disadvantages of Forward Chaining Alford Academy Business Education and Computing
Advantages and Disadvantages of Backward Chaining Many Expert Systems use a combination of backward and forward chaining Alford Academy Business Education and Computing
Rules, facts and working memory Backward chaining systems tend to use depth-first search with backtracking, in a similar way to Prolog. This is completely predictable in operation, following a clear strategy to reach a conclusion. For example, suppose a medical expert systems had the following facts in working memory: Body temperature is 39.5ÆC Patient’s skin colour is red Patient has pains in stomach and legs Age of patient is 63 Gender of patient is female Condition has occurred before One of the rules in the system is: IF body temperature 38 AND patient’s skin colour is red THEN patient has fever This rule could be fired, and would add the fact: Patient has fever to the working memory. As a result, another rule: IF patient has fever AND patient has pains in stomach and legs THEN patient may have influenza. could be fired, leading to a diagnosis / conclusion. Alford Academy Business Education and Computing
Alford Academy Business Education and Computing Conflict resolution At any time, there may be hundreds of different rules that could be fired by the known facts. The inference engine must decide which of the possible rules should be fired next The set of possible rules which could be fired at any particular time is known as the conflict set The inference engine must use some form of conflict resolution to decide which rule from the conflict set to fire next Many different conflict resolution strategies can be used, either separately or in combination Alford Academy Business Education and Computing
Conflict resolution strategies Alford Academy Business Education and Computing
Alford Academy Business Education and Computing Certainty factors a consultation with a doctor may lead to a less clear-cut diagnosis. The doctor may conclude that your headache is probably just a hangover, but it might be the start of flu, and there is a very slim chance that it could be a brain tumour or some other serious disease. domains can contain inexact conclusions like this, and expert systems must be able to deal with this kind of knowledge. This involves using certainty factors The number is called a certainty factor. It is added to the end of a fact or rule using the abbreviation CF. Alford Academy Business Education and Computing
Examples of using certainty factors Practical Activity – Do weather forecast expert system task on page 104 Alford Academy Business Education and Computing
Calculating certainty factors - complex Example 1 IF the sky was red this morning (CF 60) AND it rained yesterday (CF 75) THEN it will rain today (CF 50). CF = MIN(60%,75%) x 50% = 30% CF = 30 Example 2 IF the sky is blue (CF 90) AND people around are speaking French (CF 40) AND there are lots of Renault cars (CF 60) THEN you are in France (CF 80) CF = MIN(90%,40%,60%) x 80% = 32% CF = 32 Alford Academy Business Education and Computing