ESTA[1].ppt

download ESTA[1].ppt

of 52

Transcript of ESTA[1].ppt

  • 8/14/2019 ESTA[1].ppt

    1/52

    ESTA - OVERVIEW

    ESTAExpert System for Text Animation

    ESTA can be used to create an expert system for anysubject area by building the knowledge base in that

    domain.

    ESTA + Knowledge Base = Expert System

  • 8/14/2019 ESTA[1].ppt

    2/52

    Inference Engine

    Working memory

    Explanation FacilityKnowledge

    Base

    User InterfaceDevelopers interface

    UserKnowledge

    Engineer

    System interfaceExternal

    Programs

  • 8/14/2019 ESTA[1].ppt

    3/52

    Overview

    ESTA is a rule based system that has the facilitiesfor

    Knowledge base

    Inference engine Graphic user interface

    Graphic developer interface

    Explanation

    Uncertain reasoning Debugging

    interface to system programs

  • 8/14/2019 ESTA[1].ppt

    4/52

    Knowledge base

    The knowledge base in ESTA is represented by

    two distinct kind of objects:

    Sections

    Parameters

  • 8/14/2019 ESTA[1].ppt

    5/52

    KnowledgeBase - Sections

    Each section describes both how to decide whether

    any advice should be given to the expert system

    user, and to which section ESTA should go next. Consultation begins with the star t section.

    All knowledge bases in ESTA must begin with a

    section calledstart.

    Sections can be modified from the section tree. Updates are dynamically reflected on the section tree.

  • 8/14/2019 ESTA[1].ppt

    6/52

  • 8/14/2019 ESTA[1].ppt

    7/52

    Parameters

    Parameters are variables which determine the flow ofcontrol between the sections.

    Examplecar.kb

    section start : 'main section

    if (problem='starting_problem') dostarting_problem

    if (problem='overheating') do overheating

    if (problem='smell_of_gasoline') dosmell_of_gasoline

    if (problem='vibration') do vibration

    do other

    /* An alternative is to write : do_section_ofproblem */

  • 8/14/2019 ESTA[1].ppt

    8/52

    Parameters

    Sections and parameters within a knowledge base can be

    listed.

    Parameters that are not yet assigned a value appears with a ?Mark.

  • 8/14/2019 ESTA[1].ppt

    9/52

    Section List of car.kb

    alternative_transport : Investigation of other transport possibilities

    another_battery : start the car using another battery

    bad_idling_section : the engine idles badly

    bad_running : the engine runs badly

    battery_dead : the battery is dead

    brakes : problems with the brakes

    electrical : check the electrical system

    gasoline_help : what to do when there is no gasoline on the car

    horn_problem : problems with the horn

    lack_of_power_section: the engine feels lacking in power

    light_problem : problems with the lights

    other : other problems not dealt with in the start section

    overheating : the engine gets overheated

    push_start : push-start the car

    recharge : recharge the battery

    smell_of_gasoline : the car smells of gasoline

    start : main section

    starting_problem : starting problems

    vibration : vibrations in the car

    wet_weather: the weather is wet

    wiper_motor: problems with a wiper moto

  • 8/14/2019 ESTA[1].ppt

    10/52

    Parameter list of car.kb

    acceleration_noise : there is a noise during acceleration( ? )

    another_battery : you can use another battery( ? )

    bad_idling : the engine is idling badly( ? )

    battery_dead : the battery is dead( ? )

    brake_long_travel : the brake has a long travel( ? )

    brake_nonoperative : the brakes do not work at all( ? )

    brake_otherproblem : the brakes have unclassified problems( ? )

    brake_poor : stopping ability is poor( ? )

    brake_spongy : the brakes feel spongy( ? )

    brake_springy : the brakes feel springy( ? )

    brake_veer : car veers to one side when the brakes are applied( ? )

    car : the kind of car( ? )

    close_to_fueltank : you are close to a gasoline station( ? )

    engine_vibration : the engine vibrates excessively( ? )

    gasoline_can : you have a spare can with gasoline( ? )

    gasoline_ok : there is gasoline in the car( ? )

    horn_badnoise : the horn is not working properly( ? )

  • 8/14/2019 ESTA[1].ppt

    11/52

    Knowledge Representation

    Knowledge representation in ESTA is based on thefollowing items:

    Parameters

    Sections

    Title

  • 8/14/2019 ESTA[1].ppt

    12/52

    Knowledge Representation

    Numbers

    Numbers are either integers or decimal numbers/

    Examples:

    12 45 234.54 -898.7e3

    Strings

    Strings are a sequence of characters between two single quotes.

    This is a string.

    Symbols

    Comparison symbols: < > = =

    Arithmetic operators: * - + /

    Other symbols : () .. , . /* */

  • 8/14/2019 ESTA[1].ppt

    13/52

    Knowledge Representation

    Comments

    Comments are enclosed within /* */

    Expresions

    There are three types of expressions in ESTA

    Text expression

    Number expression

    Boolean expression

  • 8/14/2019 ESTA[1].ppt

    14/52

    Text Expressions

    Text expressions can be used in the explanation field, in the question

    field, or in the text rules of parameter declerations.

    In sections text expressions are used as advice.

    The & character can be used to insert new lines into the text.

    The text functions are:

    concat(X,Y) returns the string X concatenated with Y

    startstr(N,X) returns the first N characters from the string X

    endstr(N,X) returns the last N characters from the string X

  • 8/14/2019 ESTA[1].ppt

    15/52

    Text Expressions

    startstr(1, name_of_day) = t /* days starting with t are

    accepted*/

    The favorite food of the animal is favorite_food .

    (The above string is composed of strings and values of

    parameters.)

  • 8/14/2019 ESTA[1].ppt

    16/52

    Number Expressions

    Number expressions are used in the rule fields of a numberparameter declaration, or in boolean expressions. The usualoperators are:

    + addition

    - subtraction

    * multiplication

    / division

    Functions

    ESTA includes a full range of mathematical functions

    Examples

    Salarytax

    5 * 8 / x7 + y

    (sqrt(cos(x)*cos(x)+sin(x)*sin(x)) + 3) / 2

  • 8/14/2019 ESTA[1].ppt

    17/52

    Boolean Expressions

    Boolean expressions guide the logic of ESTAs dialog

    They consist of :

    boolean parameters

    comparisons between number expressions

    comparisons between strings

    compound boolean expressions

    A boolean parameter may evaluate to true, false orunknown

    Examples

    number_of_days_required / 7 < weeks_required

    has_retired or is_unwell

    date_of_birth < 1960 and owns_a_car

  • 8/14/2019 ESTA[1].ppt

    18/52

    Parameters

    Parameters are like variables which determine the flow

    between the sections.

    A parameter can be any of the following four types:

    boolean parameter text parameter

    number parameter

    category parameter

    Any parameter can obtain a value in one of the followingways:

    From an answer to a question

    As a result of applying some rules

    An assignment resulting from an assign action

  • 8/14/2019 ESTA[1].ppt

    19/52

    Parameters

    The Decleration Field

    parameter [:]

    The description text is used to generate replies when a user askHOW a certain value was established or WHY a certain piece ofadvice was given.

    For boolean parameters ESTA phrase is:

    THE OBJECTIVE IS TO FIND OUT WHETHER

    For number, text or catagory parameters, ESTA phrase is:

    THE OBJECTIVE IS TO ESTABLISH THE VALUE OF

  • 8/14/2019 ESTA[1].ppt

    20/52

    Parameters

    The Decleration Field

    parameter owns_car you own a cartype boolean

    ESTA will generate

    THE OBJECTIVE IS TO FIND OUT WHETHER YOU OWN A CAR

  • 8/14/2019 ESTA[1].ppt

    21/52

    Parameters

    The Explanation Field

    Text in the explanation field is reflected to the user upon explain thequestion request

    parameter marital_status the people are married

    type category

    explanation

    Marital status is determined by whether &

    there exists a marriage certificate for &name and name_of_partner or not

    options

    married,

    unmarried.

    question What is the marital status of name ?

  • 8/14/2019 ESTA[1].ppt

    22/52

    Parameters

    The Question Field

    The question field is used when the value of a parameter is to bedetermined by an answer to a question.

    If the question text is omitted, ESTA will generate a default text for thequestion, based on the description text of the decleration field and typeof the parameter.

    For boolean parameters the default question text is:

    IS IT TRUE THAT

    For text, category and number:

    WHAT IS THE VALUE OF

  • 8/14/2019 ESTA[1].ppt

    23/52

    Parameters

    The Rules Field

    The rules field is used when a parameters value should be determined

    by rules and not by a question

    Examples

    rules

    blue if frequency < 1000,

    orange if frequency >= 1000 and frequency < 2000,

    red if frequency > 2000 and frequency < 3000,invisible.

  • 8/14/2019 ESTA[1].ppt

    24/52

    Parameters

    The Picture Field

    The picture field is used to specify a picture that will be shown during the

    consultation.

    The picture can be specified by the name of the picture from the picturedatabase or the name of a parameter.

    picture cars

    /* cars is a picture name from the pictures db. */

    picture car

    /* car is a parameter name */

  • 8/14/2019 ESTA[1].ppt

    25/52

  • 8/14/2019 ESTA[1].ppt

    26/52

    Number Parameter

    parameter height_cm your height in cm

    type number

    range 100 250

    question What is your height in cm?

    ESTA verifies if the input is a number and if range is given further

    validates if the number is within the range.

  • 8/14/2019 ESTA[1].ppt

    27/52

    Text Parameter

    parameter name the name of the user

    type textquestion What is your name?

    Category Parameter

    parameter car the kind of car

    type category

    explanataion Identify your car with one of the listed types

    option

    ambulance,

    policecar,sedan,

    van.

    question Which kind of car do you have?

    picture cars

  • 8/14/2019 ESTA[1].ppt

    28/52

    Sections

    The actions that can be defined within a section are:

    advice

    assigncall

    chain

    do

    exitstop

  • 8/14/2019 ESTA[1].ppt

    29/52

    Sections

    section start : the first section to be executed

    if car_color = red

    (advice

    your car is red, try to sell it to the fire brigade,

    call sound(200, 100))

    if car_color red and car_color blue

    advice Your car is not one of our favourite colors!

    advice Thats all folks!

    parameter car_color the color of the car

    type text

    question What is the color of your car?

  • 8/14/2019 ESTA[1].ppt

    30/52

    Sections

    Assign

    The assign action is used to assign values to parameters.

    Examples

    section start a very short section to illustrate assign

    assign n := 7 + 8 / 2

    advice evaluation of 7 + 8 / 2 gives n

    assign n := (7 + 8) / 2

    advice evaluation of (7 + 8) / 2 gives n

    as / has higher priority than +. &

    Notice that the parameter changed the value

    parameter n n

    type number

  • 8/14/2019 ESTA[1].ppt

    31/52

    Sections

    Chain

    The chain action enables ESTA to consult new knowledge

    bases

    Example

    section start : 'Start section in the demo knowledge

    base'

    if esta = 'information'(call display('uk_inf.txt'),chain '')if esta = 'car' chain 'car.kb'

    if esta = 'sanocor' chain 'sanocor.kb

  • 8/14/2019 ESTA[1].ppt

    32/52

    Sections

    parameter esta : ''

    type category

    explanation 'You can choose to get information aboutESTA or to consult a knowledge base.'

    options

    information - 'Information about ESTA',

    car - 'Knowledge base about cars',

    sanocor - 'Knowledge base about health'.

    /* rules */

    question 'Choose a subject to explore.'

    picture 'estademo'

  • 8/14/2019 ESTA[1].ppt

    33/52

    Sections

    Do

    The do action transfers control to another section.

    Example

    section start : first section to be executedif answer = yes (do positive_section, do

    next_section)

    if answer = no' do negative_section

  • 8/14/2019 ESTA[1].ppt

    34/52

    SectionsDo_section_of

    section start : 'main section'

    do_section_of problem

    parameter problem : 'the problem with your car'

    type category

    explanation

    'Identify the problem with your car as closely as you can. Only those listed are dealt with in thisknowledge base.'

    options

    starting_problem - 'starting problems'

    overheating- 'the engine gets overheated'

    smell_of_gasoline - 'the car smells of gasoline'

    bad_running- 'the engine runs badly'

    brakes- 'the brakes'

    vibration- 'excessive vibrations'

    wiper_motor- 'the wiper motors'

    light_problem- 'the lights'

    horn_problem- 'a faulty horn'.

    question

    'What is the problem with your ' car ' ?'

    picture car

  • 8/14/2019 ESTA[1].ppt

    35/52

    Sections

    ExitThe exit action terminate consultation with the current knowledge base

    StopThe stop action may be used to optimize rules written in a section. Execution

    of a stop action indicates that no more actions are to be executed in the

    containing section.

  • 8/14/2019 ESTA[1].ppt

    36/52

    Sections

    CallThe call action is used to call one of the built in procedures in ESTA.

    call clear_all()clears all the parameter values in the current knowledge

    base

    call clear_value ()clears a particular parameter value in

    the current knowledge base

    display()displays the content of a text file in a window on the

    screen

    Examples

    call display(inform.txt)

    call display(c:\\info\\inform.txt)

  • 8/14/2019 ESTA[1].ppt

    37/52

    Sections

    CallHyperadviceenables to activate a specific node in a Windows helpfile.Thenode is shown as a topic in the Windows hypertext help system.

    Example

    section brakes 'problems with the brakes'

    if brake_long_travel call hyperadvice('hypercar.hlp',8)if brake_poor call hyperadvice('hypercar.hlp',13)

    if brake_veer call hyperadvice('hypercar.hlp',14)

    if brake_spongy call hyperadvice('hypercar.hlp',17)

    if brake_springy call hyperadvice('hypercar.hlp',15)

    if brake_nonoperative call hyperadvice('hypercar.hlp',16)if brake_otherproblem (advice

    'This is a difficult problem, but perhaps one of the following is the cause:

    Maybe the shoes are installed incorrectly with do to leading and trailing ends

    Broken shoe return spring. Try to find the answer in the car manual',

    call hyperadvice('hypercar.hlp',5))

  • 8/14/2019 ESTA[1].ppt

    38/52

    Sections

    CallRestore_valuesrestores the ESTA parameters to settings previously

    saved in a data file.

    This procedure is used in combination with chaining to other

    knowledge bases or communicating with external programs

    called within ESTA.Example

    call restore_values (c:\\esta\\setup.dat)

    Save_values()saves in a datafile the settings of all

    parameters currently bound to a value.

    Example

    call save_values (c:\\esta\\setup.dat)

  • 8/14/2019 ESTA[1].ppt

    39/52

    Sections

    Callshowpic() displays a picture from the picture database.

    Example

    call showpic (cars)

    sound(, ) generates a sound through the computersloud speaker lasting the given duration, and with the given frequency.

    Example

    call sound (10, 100)

    System(command_string) is used to call other applications from ESTA

    Examplecall system(myprog.exe)

  • 8/14/2019 ESTA[1].ppt

    40/52

    Title

    To represent the whole knowledge base a title can be used. The title caneither be a plain text or a picture.

    Example

    You can specify a picture as a title

    *cars*

    or

    you can specify plain text as a titleCar Knowledge Base

  • 8/14/2019 ESTA[1].ppt

    41/52

    Reasoning With Uncertainty

    Certainty Factor

    cf_and(P1, P2) -> P3

    P3 is the lowest of the P1 and P2

    cf_or (P1, P2) -> P3

    P3 is the biggest of the P1 and P2

    cf_not(P1) -> P3

    P3 is (1-P1)

    cf_add(P1, P2) -> P3

    P1+P2*(1-P1) both P1, P2 > 0

    (P1+P2)/(1- min(abs(P1), abs(P2)) one of P1 or P2

  • 8/14/2019 ESTA[1].ppt

    42/52

    Reasoning With Uncertainty

    section weather example section

    advice

    The statement it is very cold weather is true with a certaintyfactor of cold_weather_cf

    parameter cold_weather_cf certainty factor for cold weather

    type number

    range1.0 1.0

    rules

    cf_add(cold_because_of_snow, cold_because_of_ice).

    parameter cold_because_of_icetype number

    range1.0 1.0

    rules

    0.8 if ice_on_the_river,

    -1.0.

  • 8/14/2019 ESTA[1].ppt

    43/52

    Reasoning With Uncertainty

    parameter cold_because_of_snow

    type number

    range1.0 1.0

    rules

    0.7 if it_is_snowing,

    -1.0.

    parameter it_is_snowing It is snowing

    type boolean

    question Is it snowing?

    parameter ice_on_the_river there is ice on the river

    type boolean

    question Is part of the river frozen over?

  • 8/14/2019 ESTA[1].ppt

    44/52

    Reasoning With Probability

    parameter prob probability

    type number

    rules

    1 if weight_loss and appetite_loss and fever and itching,

    0.67 if weight_loss and fever and itching,

    0.75 if weight_loss and appetite_loss and fever,

    0.6 if appetite_loss and fever and itching,

    0.5 if weight_loss and fever,

    0.5 if weight_loss and appetite_loss,

    0.35 if weight_loss and itching,

    0.5 if appetite_loss and fever,0.1 if itching.

    parameter hodga hodgin a

    type boolean

    rules true if prob > 0.6.

  • 8/14/2019 ESTA[1].ppt

    45/52

    Debugging

    Log of the consultation can be taken by opening a

    dialog box before consultation begins.

    Filenew- new dialog Begin consultation

    .......

    Stop consultation

    Investigate the consultation log

    Continue consultation

  • 8/14/2019 ESTA[1].ppt

    46/52

  • 8/14/2019 ESTA[1].ppt

    47/52

    Pictures in ESTA

    Pictures are stored in PICTURES.DBA

    The ESTA system includes hotspot editor allowing the

    specification of selectable subfields in a picture

    This feature is used in conjunction with category

    parameters in which the options correspond to fields in the

    attached picture

  • 8/14/2019 ESTA[1].ppt

    48/52

    DDE Communication

    DDE (Dynamic Data Exchange) is a Windows protocol

    that lets applications talk.

    ESTA can be interfaced to all Windows applications that

    support DDE.

    You can send data to applications, you can receive

    information from the application, you can even execute

    commands in the applications.

  • 8/14/2019 ESTA[1].ppt

    49/52

    DDE Communication

    A conversation with a DDE server is created by the

    function:

    dde_initiate(Application, Topic)

    This function returns a channel number used to identify the

    conversation

    dde_execute(Channel, Command)

    Sends the commands in Command to the server for

    execution.Channel is the number returned from

    dde_initiate.

  • 8/14/2019 ESTA[1].ppt

    50/52

    DDE Communication

    dde_poke(Channel, Item, Data)

    sends data to the server. Item specifies the destination.

    dde_poke(CH, R1C1, hello) inserts hello to row1,

    column1

    dde_request(Channel, Item)

    is used to retrieve a data item from the server.

  • 8/14/2019 ESTA[1].ppt

    51/52

    DDE Communication

    Example:

    CH := dde_initiate(excel, file_a.xls)

    dde_poke_number(CH, R2C4, 546)

    dde_execute(CH, [OPEN(\034file_b.xls\034)]

    VAL := dde_request_number(CH, R1C2)

    dde_terminate(CH)

    Note: 034 is the ASCII code for . Thus the command is

    [OPEN(file_b.xls)]

  • 8/14/2019 ESTA[1].ppt

    52/52

    Homework

    Implement the following A Medical Diagnosis

    Expert Systemproblemfound on the link

    providedusing ESTA.

    http://www.comp.rgu.ac.uk/staff/khui/cm3016/cours

    ework/CM3016%20coursework%200708.pdf

    http://www.comp.rgu.ac.uk/staff/khui/cm3016/coursework/CM3016%20coursework%200708.pdfhttp://www.comp.rgu.ac.uk/staff/khui/cm3016/coursework/CM3016%20coursework%200708.pdfhttp://www.comp.rgu.ac.uk/staff/khui/cm3016/coursework/CM3016%20coursework%200708.pdfhttp://www.comp.rgu.ac.uk/staff/khui/cm3016/coursework/CM3016%20coursework%200708.pdf