Lect Topic2 Sem1 0910

  • Upload
    na2ry

  • View
    222

  • Download
    0

Embed Size (px)

Citation preview

  • 8/9/2019 Lect Topic2 Sem1 0910

    1/35

    CSC 3301CSC 3301 -- Principles Of Artificial IntelligencePrinciples Of Artificial Intelligence

    KNOWLEDGE REPRESENTATIONKNOWLEDGE REPRESENTATION

    Assoc. Prof. Dr. Normaziah Abdul Aziz

    Semester 1 2009/2010

  • 8/9/2019 Lect Topic2 Sem1 0910

    2/35

    Knowledge facts, information and rules that are known

    in a particular field(s) that can also be used for

    contextualisation on a given situation or events related.

    [Please note that this definition of knowledge is from the perspective ofinformation fed and used in the machine / computer, nor that of the human

    intellectual capacity.The definition of Knowledge (ilm) in Islam is the arrival (husul) in the soul of the

    meaning of a thing or an object of knowledge. Refer Syed Muhammad Naquib

    Al-Attas, The Concept of Education in Islam, pp 17]

    Representation a collection of objects that can be referred to for other

    symbols or physical objects. We need representation of an object or situationwhen we cant access the real thing or situation itself.

    to capture critical features of a problem

    What is Knowledge Representation (KR)?

  • 8/9/2019 Lect Topic2 Sem1 0910

    3/35

    Representation that is used to represent a problem isimportant.

    The way the computer represent a problem, the variables it

    uses, the operators it applies to those variables.

    All the above will make a difference between an efficient

    algorithm and an algorithm that doesnt work.

    The Need for a Good Representation

    Examples of data representationExamples of data representation

    Array, Lists, Stacks of data (text, numerical, etc)

    Picture point (pixel) represent an image intensity or gray level

  • 8/9/2019 Lect Topic2 Sem1 0910

    4/35

    Example A scenario where you dropped your contact-

    lens at the football field of IIUM stadium. How can you find it?

    What does it take for you to locate it?

  • 8/9/2019 Lect Topic2 Sem1 0910

    5/35

    1st representation

  • 8/9/2019 Lect Topic2 Sem1 0910

    6/35

    2nd representation

  • 8/9/2019 Lect Topic2 Sem1 0910

    7/35

    3rd representation

    Same representation but different level

    of granularity or refinement

    Useful, efficient and meaningful representation is

    essential.

    The representation

    relate to the problembeing solved, avoid

    pointless computation.

  • 8/9/2019 Lect Topic2 Sem1 0910

    8/35

    A Quick look of Examples of KR in AI

    Semantic netshumanhuman

    aliali kittykittyahmedahmed

    catcat

    is_a is_a is_a

    ownshas_friend

    Ahmed has a friend named Ali, and a cat called Kitty.Ahmed has a friend named Ali, and a cat called Kitty.

    If-then Rules

    IF there are 6 flat surfaces

    AND the size and shape of each surfaces is the same

    THEN the object has a cubic shape

  • 8/9/2019 Lect Topic2 Sem1 0910

    9/35

    is_a (kitty, cat)owns (ahmed, kitty)

    friend_of (ali, ahmed)

    is_a (ahmed, human)

    is_a (ali, human)

    Frames

    AhmedAhmed

    is_a Humanis_a Human

    owns Kittyowns Kittyfriend Alifriend Ali

    KittyKitty

    is_a Catis_a Cat

    owned by Ahmedowned by Ahmed

    HumanHuman

    has_num_leg 2has_num_leg 2

    has_brain truehas_brain true

    AliAli

    is_a Humanis_a Human

    friend_of Ahmedfriend_of Ahmed

    Logic

    A Quick look of Examples of KR in AI

  • 8/9/2019 Lect Topic2 Sem1 0910

    10/35

    The Knowledge Representation

    The knowledge-based system

    a model of something in the real world

    designed by modeling the knowledge and reasoning mechanism

    usually encoded by a human expert

    The Representation (Knowledge Base)

    Syntax (structure of the elements)

    Semantics (meaning of the elements)

    The Inference Engine

    The ability to find implicit knowledge by reasoning over the explicit

    Knowledge Base

    Inference system

    Knowledge Based system

  • 8/9/2019 Lect Topic2 Sem1 0910

    11/35

    The Representation

    A Knowledge Representation language is a system for

    encoding knowledge.

    It is defined by a syntax and semantics.The representation limits what kind of knowledge can be

    represented and reasoned about.

    Syntax

    The notational aspects.

    How to encode knowledge explicitly.

    Grammatical rules the symbols to use and the way to

    combine them.

    Similar to natural language, where correct sentence structure(e.g. subject-verb-object)

    Example of different syntax expressing same content:

    (green my-car)

    green(my-car)

    my-car.green = true

  • 8/9/2019 Lect Topic2 Sem1 0910

    12/35

    Semantics

    Concerns the meaning of symbols.

    What does symbol represent?

    Example

    If a system knows that green(my-car), it knows that

    some property (green) is true about somesymbol(mycar), but what does my-car and green

    mean?

    The representation limits what kind of knowledge can be

    represented and reasoned about.

    Example

    The system knows that all cars have engines and a

    Toyota is a car. Will it be able to infer that Toyota has an

    engine?

  • 8/9/2019 Lect Topic2 Sem1 0910

    13/35

    Knowledge and Inference

    Inference - The ability to find implicit knowledge by reasoning

    over the explicit knowledge

    A Knowledge Representation must not be seen in isolation from

    its inference capabilities.

    Realised through a set of algorithm the inference engine.

    An inference engine implements a set of inference rules.

    The inference engine infers implicit knowledge.

    The inference rules are abstract rules that can be applied in

    various domains (domain independent)

  • 8/9/2019 Lect Topic2 Sem1 0910

    14/35

    Example of Knowledge & Inference - Inheritance

    Inference in Semantic Nets.

    Property of superclass is inherited to subclass

    Example:

    The computer can infer that Tweety moves by flying

    birdbird

    tweetytweety flyingflying

    is_a moves_by

  • 8/9/2019 Lect Topic2 Sem1 0910

    15/35

    Example Modus Ponens

    Reasoning mechanism in Logic.

    Says that some proposition always follow from another.

    Example

    The computer can infer that Tweety moves by flying

    is_a(tweety, bird).

    moves_by(y, flying) :- is_a(y, bird).

  • 8/9/2019 Lect Topic2 Sem1 0910

    16/35

    What makes a good representation?

    Completeness we can express what we want to

    express.

    Conciseness we can do so without ambiguities.

    Transparency It is easy to understand, common

    understanding between human and computer.

    Computational efficiency the inference engine is

    efficient

    Note: There is tradeoff between these criteria.

  • 8/9/2019 Lect Topic2 Sem1 0910

    17/35

    Types of Knowledge RepresentationTypes of Knowledge Representation

    often usedoften used

  • 8/9/2019 Lect Topic2 Sem1 0910

    18/35

    if-then Rules or Production Rules

    if-then rules is also referred to as Production rules

    By far, the most popular formalism for representing

    knowledge

    Rules are conditional statements but they can have various

    interpretations that we can define:

    ifprecondition Pthen conclusion C

    ifsituation S then action A

    ifconditions C1 and C2 hold then condition C does not

    hold

    Rules can represent relations, recommendations, directives,

    strategies and heuristics

  • 8/9/2019 Lect Topic2 Sem1 0910

    19/35

    RelationIF the fuel tank is empty

    THEN the car engine cant be started

    Recommendation

    IF the season is autumn

    AND the sky is cloudy

    AND the forecasted weather is drizzle

    THEN the advice is take along an umbrella

    Directive

    IF the car is dead

    AND the fuel tank is empty

    THEN the action is refuel the car

    Some examples of Production Rules

  • 8/9/2019 Lect Topic2 Sem1 0910

    20/35

    StrategyIF the car is dead

    THEN the action is check the fuel tank;

    step 1 is complete

    IF step 1 is completeAND the fuel tank is not empty

    THEN the action is check battery;

    step 2 is complete

    Heuristic

    IF the spill is liquid

    AND the spill pH is < 6

    AND the spill smells vinegar

    THEN the spill material is acetic acid

    Some examples of Production Rules

  • 8/9/2019 Lect Topic2 Sem1 0910

    21/35

    The components of a rule-based system have the form:

    if < condition > then < conclusion > or

    if < antecedent > then < consequent >

    A rule can have more than 1 antecendents and more than1 consequents

    Rules can be evaluated by:

    backward chaining

    forward chaining

    if-then Rules or Production Rules

  • 8/9/2019 Lect Topic2 Sem1 0910

    22/35

    if-then rules turn out to be a natural form of expressingknowledge, and have the following features:

    modularity each rule defines a small, relatively

    independent piece of knowledge

    incrementability - new rules can be added to theknowledge base relatively independent of other rules

    modifiability (as a consequence of modularity) old

    rules can be changed relatively independent of other

    rules

    support systems transparency

    if-then Rules or Production Rules

  • 8/9/2019 Lect Topic2 Sem1 0910

    23/35

    if-then rules also support knowledge that has probabilityof truth value (i.e. for knowledge that is not absolutely true

    for all conditions)

    In such cases, we modify the rules by adding likelihood

    qualifications to their logical interpretation, as example:ifcondition A then conclusion B follows with certainty

    value F

    IF

    1 condition is primary bacteremia, and

    2 the site of the culture is one of the sterilesites, and

    3 the sustected portal of entry of the organism is the gastrointestinal tract

    THEN

    there is suggestive evidence (0.7) that the identity of the organism is

    bacteroides.

    Sample rule extracted from Mycin Expert system.

    if-then Rules or Production Rules

  • 8/9/2019 Lect Topic2 Sem1 0910

    24/35

    Forward Chaining in Production Rules

    Given some facts, work forward through inference net.

    Discovers what conclusions can be derived from data.

    Inference begins here

  • 8/9/2019 Lect Topic2 Sem1 0910

    25/35

    Backward Chaining in Production Rules

    To determine if a decision should be made, work backwards

    looking for justifications for the decision. Eventually, a decision must be justified by facts.

    Inference begins here

  • 8/9/2019 Lect Topic2 Sem1 0910

    26/35

    A semantic network is a directed graph consisting of nodesA semantic network is a directed graph consisting of nodes

    (also termed points or vertices) which represent(also termed points or vertices) which represent conceptsconcepts andand

    edges (also termed lines or arcs) which representedges (also termed lines or arcs) which represent semanticsemantic

    relationsrelations between the concepts.between the concepts.

    Semantic network problem can be transformed to logicSemantic network problem can be transformed to logic

    As example:As example:

    A graph with 6 vertices (concepts) and 7

    edges (semantic relations).

    Semantic Network (SN)

    camelmammal

    brown

    is-a

    colour

    ( x) (camel(x) -> mammal(x))

    colour(camel, brown)

  • 8/9/2019 Lect Topic2 Sem1 0910

    27/35

    Antonymy: Opposite meaning. Example: Cold is the opposite of warm

    Synonymy: Equivalent meaning. Example: Cheap is synonym to inexpensive.

    Causal relation: A is the cause of B. Example: Scurvy is caused by lack of vitamin C.

    Homonym . Two concepts,A and B, are expressed by the same symbol.Example:Both a financial institution and a edge of a riverare expressed by the word bank (the word has two

    senses).

    Active relation: A semantic relation between two concepts, one of which

    expresses the performance of an operation or process affecting the

    other. Example: The room temperature is high and the ice cubes melt.

    Temporal relation: A semantic relation in which a concept indicates a time or

    period of an event designated by another concept. Example: Second World War, 1939-1945.

    Some Semantic Relations in SN

  • 8/9/2019 Lect Topic2 Sem1 0910

    28/35

    Some Semantic Link terms

    Is-a

    A-kind-of

    Type-kind

    Whole-part

    Part-of

    Instance-of Attribute-of

    Has-parts

    Connected-to

    Made-of Has-attribute

    Object-property

    Object-action

    Action-result Object-example

  • 8/9/2019 Lect Topic2 Sem1 0910

    29/35

    State: I own a tan leather chair.

    Example of Semantic Network

  • 8/9/2019 Lect Topic2 Sem1 0910

    30/35

    Event: John gives the book to Mary.

    Example of Semantic Network

  • 8/9/2019 Lect Topic2 Sem1 0910

    31/35

    Frames

    A network representation, as semantic nets

    Frames have links between concepts, but each conceptcontains more knowledge

    Frames represent a concept either a class or individual

    The concept of a Frame is defined by a collection ofSlots

    Each frames have a number of slots

    Slots are pairsA value can be set of values, any primitive data-types, a

    pointer to another frame or a function (procedure

    attachment)

    Reasoning in Frames

    can be done by MatchingorInheritance

    < works-as Computer Scientist>

    >

    Example a person description Frame

  • 8/9/2019 Lect Topic2 Sem1 0910

    32/35

    More on Knowledge Representation (KR)

    Awell referred paper on Knowledge Representation:

    Randall Davis, Howard Shrobe and PeterSzolovits,

    What is a Knowledge Representation?,

    AAAI,S

    pring1993.

  • 8/9/2019 Lect Topic2 Sem1 0910

    33/35

    Roles if KR (as discussed in the paper)

    Role 1: A KR is a surrogate

    How close is a representation to the real thing? What kind

    of simplifying assumptions are made?

    Role 2: A KR is a set of Ontological Commitments

    What kind if Ontological commitments does thisrepresentation force on you?

    Role 3: A KR is a Fragmentary Theory of Intelligent Reasoning

    What are the sanctioned and recommended inferences?

    Role 4: A KR is a medium for efficient computation

    Role 5: A KR is a medium of human expression

  • 8/9/2019 Lect Topic2 Sem1 0910

    34/35

    Given the following information:

    A bird is a kind of animal. Flying is the normal movingmethod for birds. Birds are active during daylight.

    An albatross is a bird. Albatross is black and white in

    colour.

    Albert is an albatross, and so is Ross.

    Kiwi is a bird that moves by walking.

    Kiwi is active at night and brown in colour.Kim is a Kiwi.

    Convert the statements above in any of the 2

    representation schemas below: Semantic net

    Rule-based

    Frame.

  • 8/9/2019 Lect Topic2 Sem1 0910

    35/35

    BathBath--

    roomroomHallHall

    KitchenKitchen

    WindowWindow

    A toy knowledge base

    Diagnosing the problem of water leaking in an apartment.

    A problem can arise either in the bathroom or in the

    kitchen. In either case, the leakage also causes a problem

    (water on the floor) in the hall.

    Try diagnose the possible causes of water leaking in

    the apartment, when the:

    a) Hall is wet

    b) Kitchen is wet