Csnb234 artificial intelligence
Download
1 / 55

CSNB234 ARTIFICIAL INTELLIGENCE - PowerPoint PPT Presentation


  • 166 Views
  • Uploaded on

CSNB234 ARTIFICIAL INTELLIGENCE. Chapter 6 Knowledge Representation. (Chapter 7, pp. 223-258, Textbook) (Chapter 5, pp. 167-197, Ref. #1). Instructor: Alicia Tang Y. C. Knowledge Representation. Knowledge representation is certainly one of the most important topics

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'CSNB234 ARTIFICIAL INTELLIGENCE' - angelo


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Csnb234 artificial intelligence
CSNB234ARTIFICIAL INTELLIGENCE

Chapter 6

Knowledge Representation

(Chapter 7, pp. 223-258, Textbook)

(Chapter 5, pp. 167-197, Ref. #1)

Instructor: Alicia Tang Y. C.


Knowledge Representation

  • Knowledge representation is certainly one of the most important topics

  • Predicate logic based representations (We do this with an historical focus)

  • Schemes in an "evolutionary order" (This allows the reader to see how the strengths of one representation find their way into succeeding approaches)


Knowledge Representation

  • Representational schemes can be divided into four rough categories.

  • These categories are not intended to be definitive but rather to assist the students (you) in getting a general perspective.

  • Over the past 25 years, numerous representational schemes have been proposed and implemented, each of them having its own strengths and weaknesses.


Mylopoulos and Levesque (1984) have classified these into four categories

  • 1. Logical representation schemes.

    • This class of representations uses expressions in formal logic to represent a knowledge base. Inference rules and proof procedures apply this knowledge to problem instances.

  • 2.Network representation schemes.

    • Network representations capture knowledge as a graph in which the nodes represent objects or concepts in the problem domain and the arcs represent relations or associations between them. Semantic network and conceptual graph.


  • 3 four categories. Structured representation schemes.

    • Structured representation languages extend networks by allowing each node to be a complex data structure consisting of named slots with attached values. Scripts and frames.

  • 4. Procedural representation schemes.

    • Procedural schemes represent knowledge as a set of instructions for solving a problem. This contrasts with the declarative representations provided by logic and semantic networks.

    • A production rule system is an example of this approach.


Before we begin the four methods let s see this
Before we begin the four categoriesfour methods.. Let’s see this

  • There is a common method used for many non-AI (databases) representation, namely

    • Object-Attribute-Value (O-A-V) Triplets

      • An O-A-V is a more complex type of proposition (fact).

      • It divides statement into three (3) parts as shown:

price

shirt

RM39

attribute

value

object


There can be single or multiple attribute facts four categories

blue

color

shirt

size

XL

cost

rm39

There can also be single or multiple value facts .

e.g. Is the barometer pressure rising, falling or steady?


Semantic networks i
Semantic Networks (I) four categories

  • A semantic net has a binary relation

  • Concepts are represented by nodes

  • Links between nodes represent the relationships

  • Drawbacks:

    • Disjunctive and conjunctive information cannot be included into semantic nets

      • E.g. apple can be either green or red

      • E.g. panda has color black and white


Semantic networks ii
Semantic Networks (II) four categories

  • Examples of relationship labeled on arcs (notice that there is an underscore)

    • is_a

    • has_a

    • has_part

  • Examples of concepts (nodes)

    • bird

    • person

    • book

    • famous

    • intelligent


A semantic net that represents a bird’s property four categories

has_covering

has_property

bird

feathers

flies

is_a

size

has_color

small

blue

bluebird


Exercise: four categories

Draw a semantic network for the following description:

Lab is a room. Lab has a door. Lab has many computers.

Printer is in lab. Laser printer is a Printer.


Conceptual graphs
CONCEPTUAL GRAPHS four categories

  • Developed in 1984

  • Conceptual graphs (networks) overcome the restriction to binary relation

  • Simply makes all links unlabelled


A Disjunctive Net for four categoriesRed or Green Apple

Apple

Color

Green

Red

A Conceptual Net that represents “OR”


Conceptual Nets For four categories‘Where do Rivers Flow to’?

Sea

River

flow_to

Lake

Marsh


A Conjunctive Net for four categoriesblack and white panda

Color

WHITE

PANDA

Color

BLACK

A Conceptual Net that represents “AND”


Semantic nets
Semantic Nets four categories

  • It can capture and show inheritance

    • a very good feature (that not found in other schemes)

  • Can be used to combine with other representation methods

  • See next slide for “inheritance” power of semantic nets


Inheritance in semantics nets
Inheritance in Semantics Nets four categories

Breathe

Animal

Move

can

can

Fly

Bird

Wings

Feathers

can

has

has

Penguin

We shall see this later

can

Canary Sing

Yellow

Animal’s properties

are inherited to Bird and

Bird’s properties are

inherited to a bird

species called canary

is


Exception handling for addressing the problem caused by its inheritance property
Exception Handling four categories(for addressing the problem caused by its inheritance property)

Sometimes, inheritance may cause problems.

Penguin through inheritance gets the property “fly”.

(in practice it cannot)

To avoid this situation, all the specific properties of a node

must be attached to it through local nodes, so that when an

answer is needed, it will search all the local nodes first. If the answer is not available in the local nodes then the general nodes will be used.

For example if we ask “how does penguin travel?”

the reply will be “it walks” (supposed that already stored in local node)


Frames
Frames four categories

  • The idea behind frames is to store information in meaningful chunks.

  • This frame has 4 slots:

BOOK

Title : Qualitative Reasoning

Author : Ken D. Forbus

Publisher : Prentice-Hall

Year : 2000


Converting from Frames to Semantics Nets four categories

has_a

has_a

book

date

publisher

is_a

is_a

has_a

author

novel

encyclopedia

is_a

is_a

Forbus

has_a

editor

QPT


Frame description
Frame Description four categories

(Source: Luger’s AI book)

Hotel Room

specialisation of: room

location: the hotel

contains: bed, chair & phone

Hotel Phone

specialisation of: phone

use: calling room service

billing: through room

Hotel Bed

superclass: bed

size: king

contains: mattress, pillow, etc.

::


Frames1
Frames four categories

  • You should be able to see now :

    • that a frame describes an object by embedding all the information about that object in “slots”

    • that slots are commonly known in programming terms as fields or attributes with associated value

      • this is an advantage (discuss in later part)

    • that a frame is similar to a database record

    • that a frame describes typical instances of the concepts they represent


Scripts
SCRIPTS four categories

  • Similar to frames except that scripts describe a sequence of events rather than just an object.

  • Like frames, scripts portray a stereotyped situation.

  • Components:

    • Entry-condition

    • Results

    • Props

    • Roles

    • Scenes/episodes


Components in scripts i
Components in Scripts (I) four categories

  • Entry-conditions

    • must be true for the scripts

    • also called descriptors

  • Results

    • facts that are true once the scripts has ended

  • Props

    • things or objects that support a given script


Components in scripts ii
Components in Scripts (II) four categories

  • Roles

    • are actions (hence role) that the individual actors perform or execute

  • Scenes/episodes

    • Schank breaks a script into a series of “episodes” called scenes

      • e.g. entering, ordering, … billing, exiting (for restaurant scenario)

    • a scene is a temporal aspect of the script


Production rules i
Production Rules (I) four categories

  • Most Expert Systems are rule-based

    • i.e. the knowledge-base of the ES consists of a huge set of production rules (or just “rules”)

  • Facts, rules and inference engines are required to execute a rule-based expert system

  • Production-rules system captures knowledge in simple “if-then” format.


Production rules ii
Production Rules (II) four categories

  • The human mental process is too complex to be represented as an algorithm

  • However, most experts are capable of expressing their knowledge in the form of rules for their problem solving

  • e.g.

    • IF the traffic-light is green THEN the action is go

    • IF the traffic-light is red THEN the action is stop


Production rules iii
Production Rules (III) four categories

  • A production rule model consists of two parts:

    • the IF part, called antecedent or premise or condition, and

    • the THEN part, called consequent or conclusion or action

  • In our earlier example:

  • IF <the traffic-light is green> THEN <go>

  • IF <the traffic-light is red> THEN <stop>

condition

action


Production rules iv
Production Rules (IV) four categories

  • Multiple conditions are joined by the keywords AND (conjunction), OR (disjunction) or a combination of both.

  • Example:

IF <condition-1>

OR <condition-2>

:

OR <condition-n>

THEN <action>

IF <condition-1>

AND <condition-2>

:

AND <condition-n>

THEN <action>


Production rules v
Production Rules (V) four categories

  • Rule-based ES also use mathematical operators to define an object as numerical and assign it to the numerical value

IF Age of the student < 21

AND SPM no. of A’s >= 8

THEN Admit the student to BIT


Production rules vi
Production Rules (VI) four categories

  • Rules can represent relations, recommendations, directives and heuristics as follows:

Relations:

IF the fuel tank is empty

THEN the the car will not start

Recommendation:

IF you study hard

AND you study smart

AND you never absent

THEN you will get an “A”


Production rules vii
Production Rules (VII) four categories

Strategy:

IF the car is dead

THEN check fuel tank

step 1 is complete

IF step 1 is complete

AND the fuel tank is full

THEN check battery

step 2 is complete

IF step 2 is complete

AND the battery is replaced

THEN check electrical fuel lines

:

:

Heuristics:

IF the spill is liquid

AND the spill pH is < 6

AND the smell is vinegar

THEN the spill material is acetic acid

Directive:

IF the fuel tank is empty

THEN refuel the car


Production system model
Production System Model four categories

Short term memory

Long term memory

Facts

Production Rules

Reasoning

Conclusion

Question: why are the rules as long term memory?


Basic structure of a production system
Basic structure of a Production system four categories

Knowledge-base

Database

Facts

Production

Rules

Inference Engine

Explanation Facility

User Interface

User


Firing of rules
“Firing” of Rules four categories

  • When the condition part of a rule is satisfied, the rule is said to fire and the action part is executed.

  • The inference engine carries out the reasoning whereby the expert system reaches a solution. It links the rules given in the knowledge base with the facts provided in the database.

  • The explanation facility enables the user to ask questions such as “why” & “how”.


Reasoning methods in production rule systems
Reasoning Methods in four categoriesProduction Rule Systems

(the design of the reference engine)

  • There are two reasoning methods often use in rule-based ES:

    (1) Forward chaining

    (2) Backward chaining


Forward chaining
Forward Chaining four categories

  • This is the data-driven reasoning.

  • The reasoning starts from the known fact or data and proceeds forward with the data.

  • Each time only the topmost rule is executed.

  • When fired, the rule adds a new fact in the database.

  • Any rule can be executed only once.

  • The match-fire cycle stops when no further rules can be fired.

Powerful

mechanism


Rule based system forward reasoning example
Rule-based system four categories(Forward reasoning example)

Rule 1: IF Y is true

AND D is true

THEN Z is true

Rule 2: IF X is true

AND B is true

AND E is true

THEN Y is true

Rule 3: IF A is true

THEN X is true

A

X

B

Y

Z

E

D


Question 1 four categories

Or,

Fact 1: A

Fact 2: B

Fact 3: E

  • Given the facts that

    • A, B and E are true

  • In a Forward Chaining system

    • what type of answer/conclusion the system will return?

    • How do you justify it?


Question 2

Question 2 four categories

What if ‘D’ is also true?

(i.e. as a fact in the KB)

Give the conclusion of the reasoning process.


Backward chaining i
Backward Chaining (I) four categories

  • Backward chaining is the goal-driven

  • In this reasoning method, the expert system is trying to satisfy a goal (i.e. there is a hypothetical solution) and the inference engine move attempts to find the evidence to prove it.

  • If evidences are found, the goal is proved.

  • If not, backtracking is initiated.


Backward chaining ii
Backward Chaining (II) four categories

  • Thus the inference engine puts the rule it is working with (the rule is said to stack on) and sets up a new goal (i.e. subgoal), to prove the IF-part of this rule.

  • Then the knowledge base is searched again for rules that can prove the subgoal.

  • The inference engine repeats the process of stacking the rules until no rules are found in the knowledge base to prove the current subgoal.

Backtracking

is done here


Backward chaining iii
Backward Chaining (III) four categories

  • In the simplest sense, in backward chaining, to prove a goal G, it is to check:

    • If G is a fact then it is proven & stop.

    • Otherwise, find a rule which can be used to conclude G.

      • In proving G, try to prove each premise (preconditions) of the rule that infers G.

      • G is said to be proven (i.e. it is TRUE) if all the premises are true (valid/hold).



Formal Logic four categories

  • Advantages

    • Facts asserted independently of use

    • completeness

  • Disadvantages

    • Separation of representation and processing

    • Inefficient with large data sets

    • Very slow with large knowledge bases


Production rules

Advantages four categories

Simple syntax

Easy to understand

Simple interpreter

Flexible (easy to add or modify)

Disadvantages

Hard to follow hierarchies

Poor at representing structured descriptive knowledge

Ineffective search strategy

Not all knowledge can be expressed as rules

Production Rules


Semantic Networks four categories

  • Advantages

    • Easy to follow hierarchy

    • Easy to trace association

    • flexible

  • Disadvantages

    • Meaning attached to nodes might be ambiguous

    • Exception handling is difficult

    • Difficult to program


Frames four categories

  • Advantages

    • Expressive power

    • Easy to set up slots for new properties and relations

    • Easy to include default information

  • Disadvantages

    • Difficult to program

    • Difficult for inference

    • Lack of inexpensive software


Homework 1
Homework #1 four categories

Name some Issues in Knowledge Representation.

Explain your answer.


Homework 2
Homework #2 four categories

Give Two advantages and Two disadvantages of Rule-based ES that are NOT listed in this handouts


SUPPLEMENTARY SLIDES four categories


Conflict Resolution four categories

  • Earlier we saw two rules for crossing the road. Let’s add another rule to the knowledge base

  • Rule 1:

  • IF the traffic-light is greenTHEN the action is go

  • Rule 2:

  • IFthe traffic-light is red THEN the action is stop

  • Rule 3:

  • IFthe traffic-light is red THEN the action is go

  • New rule


    • Now, we have 2 rules, rule 2 and rule 3, with the same IF-part. Thus both of them can be set to fire when the condition part is satisfied.

    • These rules represent a conflict set.

    • The I. E must determine which rule to fire from such a set.

    • A method for choosing a rule to fire when more than one rule can be fired is called conflict resolution.


    How do we deal with it? IF-part. Thus both of them can be set to fire when the condition part is satisfied.

    • In forward chaining, both rules would be fired.

    • Rule 2 is fired first as the topmost one, as a result, its THEN-part is executed. Value stop is returned.

    • However, Rule 3 is also fired because the condition part of this rule matches the fact ‘traffic light is red’, which is still in the database. As a result the object action takes new value go.


    Methods Used for Conflict Resolution IF-part. Thus both of them can be set to fire when the condition part is satisfied.

    • 1) Fire rule with highest priority

      • Rule that attached with highest probability (confident value)

  • 2) Longest matching strategy

    • one that will process and provide more information

  • 3) Data that entered most recently

    • most updated piece of information