5.Decision Diagram

  • Upload
    john808

  • View
    217

  • Download
    0

Embed Size (px)

Citation preview

  • 7/24/2019 5.Decision Diagram

    1/12

    1

    1

    Modeling Rule Systems

    Overview:

    Decision tables

    ! Literature:

    !

    chapter 2

    2

    Development of Rule based systems

    ! Target a decision to prototype

    ! Create decision tables

    ! Implement using XS shell (CLIPS)

    ! Decide on strategy (backward vs. forward chaining)

  • 7/24/2019 5.Decision Diagram

    2/12

    2

    3

    Decision Tables

    ! What is a decision table ?

    ! Table representing complete set of conditional expressions

    ! where expressions are mutually exclusive

    ! in a predefined area

    4

    Example decision table

  • 7/24/2019 5.Decision Diagram

    3/12

    3

    5

    Decision Tables

    ! Consists of three parts! Condition rows (stubs)

    Lists condition relevant to decision

    ! Action rows (stubs) Actions that result from a given set of conditions

    ! Rules

    Specify which actions are to be followed for a given set of conditions

    6

    What kinds of knowledge ?

    ! Regulations, legislation,

    ! Business rules, corporate policy, ...

    ! accept/refuse orders

    ! discounts

    !

    ! Expertise

    !

    Classification knowledge

    ! types of customers

    ! risk categories

    !

  • 7/24/2019 5.Decision Diagram

    4/12

  • 7/24/2019 5.Decision Diagram

    5/12

    5

    9

    Scenario

    ! A company wants to unify the way orders are handled:

    ! All orders of non star-clients with bad credit should berejected.

    ! If there is enough product in stock, orders should be accepted;otherwise order is put in waiting list

    10

    Decision diagram

    ! Which conditions (variables) influence decision?

    ! What are the values of those conditions?

    ! How to find out/calculate?

    ! What are the relationships between conditions?

  • 7/24/2019 5.Decision Diagram

    6/12

    6

    11

    Scenario:conditions and actions

    ! A company wants to unify the way ordersare handled:

    ! All ordersof nonstar-clientswith badcreditshould berejected.

    ! If there is enoughproduct in stock, ordersshould be accepted;otherwise order is put in waiting list

    12

    Decision diagram example

    ! Determine maximum number of rules! Number of rules = values(cond1)**values(condN)

    ! Rules = 2 * 2 * 2 = 8

    Handle

    order

    Star-client stockCredit

    (good, bad) (yes, no) (sufficient, insufficient)

    (accept, reject, waiting-list)

    Conditions:

    Actions:

  • 7/24/2019 5.Decision Diagram

    7/12

    7

    13

    Decision table

    credit

    star-client

    Stock

    Orderhandling

    8 rows = max number of different rules

    14

    Decision table

    credit good good good good bad bad bad bad

    star-client Yes Yes No No Yes Yes No No

    Stock Suf Insuf Suf Insuf Suf Insuf Suf Insuf

    Order

    handling

  • 7/24/2019 5.Decision Diagram

    8/12

    8

    15

    Decision table

    credit good good good good bad bad bad bad

    star-

    client

    Yes Yes No No Yes Yes No No

    Stock Suf Insuf Suf Insuf Suf Insuf Suf Insuf

    Orderhandling

    Accept Wait Accept Wait Accept Wait Reject Reject

    ! Verify table with experts!

    ! All conditions?

    ! All values?

    ! Correct decisions?

    16

    Simplification

    ! Redundant rules?

    Type of client does not matter stock does not matter

    credit good good good good bad bad bad bad

    star-

    client

    Yes Yes No No Yes Yes No No

    Stock Suf Insuf Suf Insuf Suf Insuf Suf Insuf

    Orderhandling

    Accept Wait Accept Wait Accept Wait Reject Reject

  • 7/24/2019 5.Decision Diagram

    9/12

    9

    17

    Decision table simplified

    credit good bad bad

    star-client - Yes No

    Stock Suf Insuf Suf Insuf -

    Orderhandling

    Accept Wait Accept Wait Reject

    18

    From decision tables to rules

    R1: IF credit = good AND stock = suf THENhandling = accept

    R2: IF credit = good AND stock = insuf THENhandling = waiting-list

    R3: IF credit = bad AND star-client = yes AND stock = suf THENhandling = accept

    R4: IF credit = bad AND star-client = yes AND stock = insuf THENhandling = waiting-list

    R5: IF credit = bad AND star-client = no THENhandling = reject

    credit good bad bad

    star-client - Yes No

    Stock Suf Insuf Suf Insuf -

    Order

    handling

    Accept Wait Accept Wait Reject

  • 7/24/2019 5.Decision Diagram

    10/12

    10

    19

    Rules to CLIPS

    ! R1: IF credit = good AND stock = suf THEN

    handling = accept

    (defrule credit_rule

    (credit good)

    (stock suf)

    =>

    (assert (handling accept)))

    ! Syntax!!

    20

    Combining decision tables

    ! Not all values are directly determined, some times decision

    is needed.

    ! Scenario revisited:

    ! When is a client a star-client?

    ! How to calculate if stock is sufficient?

    ! How to know quality of credit?

    !

    ! Ex:

    Star clients have account age of more than 2 years, or have anaverage order amount higher than 5K

    Stock is sufficient if requested product is availablein thestorehouse in a higher quantity than ordered

  • 7/24/2019 5.Decision Diagram

    11/12

    11

    21

    Extending decision diagram

    Handle

    order

    Star-client stockCredit

    Account age avg-amount product quantity

    (good, bad)

    (yes, no)

    (sufficient, insufficient)

    (accept, reject, waiting-list)

    (yes, no) (yes, no)(=5K)(=2)

    22

    Combining decision tables

    credit good bad

    star-client - Yes No

    Stock Suf Insuf Suf Insuf -

    Order handling Accept Wait Accept Wait Reject

    Account age >=2

  • 7/24/2019 5.Decision Diagram

    12/12

    12

    23

    Next lecture: 29 September

    Frames/ontologies