rulebase forward and backwardcahning digram

Upload: shaniaamir

Post on 10-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    1/20

    1

    Basic Architecture of an Expert System

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    2/20

    2

    Knowledge base - contains the domain specific problem-solving

    knowledge.

    Facts - represent what we know at any time about the problem

    we are working at.

    Rules - represent relationships between the facts.

    Inference engine - is a general program that activates the knowledgein the knowledge base.

    Interface enables the user to communicate with the expert system.

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    3/20

    3

    Rule-Based Expert Systems

    Based on the production system concept.

    Rules

    IF the engine is getting gas

    AND the engine will turn over

    THEN the problem is spark plugs

    Facts

    The engine is getting gas

    Conclusion: action

    employ a particular model

    execute a procedure

    display a report

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    4/20

    4

    Inference Engine

    (1) Selection of rule candidates: pattern matching

    (2) Choice of one rule: conflict resolution

    (3) Execution: deduction

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    5/20

    5

    Backward chaining (goal driven): the inference engine works

    backward from a conclusion to be proven to determine if there

    are data in the workspace to prove the truth of the conclusion.

    Example.

    Rule base Workspace

    R1: IF A AND B THEN DA,B

    R2: IF B THEN C

    R3: IF C AND D THEN E

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    6/20

    6

    Example. Expert system for diagnosing car problems.

    Rule 1: IF the engine is getting gasAND the engine will turn over

    THEN the problem is spark plugs

    Rule 2: IF the engine does not turn over

    AND the lights do not come onTHEN the problem is battery or cables.

    Rule 3: IF the engine does not turn over

    AND the lights do come on

    THEN the problem is the starter motor.

    Rule 4: IF there is gas in the fuel tank

    AND there is gas in the carburettor

    THEN the engine is getting gas

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    7/20

    7

    The problem is X

    Rule 1

    Rule 2

    Rule 3

    Rule 4

    the engine is

    getting gas

    the engine willturn over

    the problem is

    spark plugs

    Rule 1

    Rule 2

    Rule 3Rule 4

    Working space

    Working space

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    8/20

    8

    gas in fuel tank

    gas in carburettor

    the engine is

    getting gas

    the engine will

    turn over

    the problem is

    spark plugs

    Rule 1Rule 2

    Rule 3

    Rule 4

    Working space

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    9/20

    9

    Explanation in Backward Chaining

    Why?

    gas in fuel tank?

    yes

    gas in carburettor?

    yes

    engine will turn over?

    why

    It has been established that:

    1. the engine is getting gas,

    therefore if2. the engine will turn over,

    then the problem is spark plugs

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    10/20

    10

    How?

    how the engine is getting gas

    This follows from rule 4:

    IF there is gas in the fuel tank

    AND there is gas in the carburettorTHEN the engine is getting gas

    gas in fuel tank was given by the user

    gas in carburettor was given by the user

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    11/20

    11

    Exercise.

    Rule 1 IF blood pressure is likely to be high

    THEN risk of heart failure is high

    Rule 2 IF blood pressure is likely to be lowTHEN risk of heart failure is low

    Rule 3 IF alcohol consumption is high

    AND patient salt intake is high

    THEN blood pressure is likely to be high

    Rul

    e 4 IF alcohol consumption is lowAND patient salt intake is low

    THEN blood pressure is likely to be low

    Rule 5 IF units of alcohol per week are > 30

    THEN alcohol consumption is high

    Rule 6 IF units of alcohol per week are < 20

    THEN alcohol consumption is lowRule 7 IF units of alcohol per week are >= 20 AND

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    12/20

    12

    Forward chaining (data driven): the inference engine works from

    the initial content of the workspace towards the final conclusion.

    Example.

    Rule base Workspace

    R1: IF A AND B THEN DA,B

    R2: IF B THEN C

    R3: IF C AND D THEN E

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    13/20

    13

    Rule 1

    Rule 2

    Rule 3Rule 4

    the engine

    turns over

    Rule 1

    Rule 2

    Rule 3

    Rule 4

    Working space

    Working space

    Example. Expert system for diagnosing car problems.

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    14/20

    14

    The engine is

    getting gas

    There is gas

    in the fuel tank

    There is gas

    in the carburettor

    The engine

    turns over

    Rule 1Rule 2

    Rule 3

    Rule 4

    Working space

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    15/20

    15

    Explanation in Forward Chaining

    Why?

    The current rule under consideration is presented.

    How?

    More difficult than in backward chaining.

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    16/20

    16

    ExampleR1: IF management competence is good

    AND External credit rating is fair

    AND Bank's credit rating is marginalTHEN Loan is rejected

    R2: IF Loan type is seasonal

    AND Profitability rating is high

    AND Solvency rating is low

    THEN Bank's credit rating is marginal

    R3: IF Cash/current liabilities > 0.1

    AND Tentative solvency rating is low

    THEN Solvency rating is low

    Bank's credit rating UNKNOWN

    Cash/current liabilities 0.18

    External credit rating FAIR Loan SEASONAL

    Loan type UNKNOWN

    Management competence UNKNOWN

    Profitability rating HIGH

    Solvency rating UNKNOWN

    Tentative solvency rating LOW

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    17/20

    17

    Choosing between backward and forward chaining.

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    18/20

    18

    Hybrid Expert System Architecture

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    19/20

    19

    Example 1.

    IF WEIGHT of MY-FORD > 3,000 pounds

    THEN set DETOUR AROUND RICKETY BRIDGE

    Example 2.

    IF ?VEHICLE is instance-of AUTOMOBILES

    AND ?VEHICLE has-a ?ENGINEAND ?ENGINE is instance-of DIESEL

    THEN set REFUEL of?VEHICLE to TRUCKSTOP

  • 8/8/2019 Rulebase Forward and Backwardcahning Digram

    20/20

    20

    SUMMARY

    The major components of an expert system are the knowledge base,inference engine, and user interface.

    Rule-based expert systems are introduced.

    There are two approaches for controlling inference in rule-basedexpert systems: forward chaining and backward chaining.