Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSNB234 ARTIFICIAL INTELLIGENCE

Similar presentations


Presentation on theme: "CSNB234 ARTIFICIAL INTELLIGENCE"— Presentation transcript:

1 CSNB234 ARTIFICIAL INTELLIGENCE
Chapter 6 Knowledge Representation (Chapter 7, pp , Textbook) (Chapter 5, pp , Ref. #1) Instructor: Alicia Tang Y. C.

2 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)

3 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.

4 1. Logical representation schemes.
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.

5 3. 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.

6 Before we begin the four 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

7 There can be single or multiple attribute facts
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?

8 Semantic Networks (I) 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

9 Semantic Networks (II)
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

10 A semantic net that represents a bird’s property
has_covering has_property bird feathers flies is_a size has_color small blue bluebird

11 Draw a semantic network for the following description:
Exercise: 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.

12 CONCEPTUAL GRAPHS Developed in 1984
Conceptual graphs (networks) overcome the restriction to binary relation Simply makes all links unlabelled

13 A Disjunctive Net for Red or Green Apple
Color Green Red A Conceptual Net that represents “OR”

14 Conceptual Nets For ‘Where do Rivers Flow to’?
Sea River flow_to Lake Marsh

15 A Conjunctive Net for black and white panda
Color WHITE PANDA Color BLACK A Conceptual Net that represents “AND”

16 Semantic Nets 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

17 Inheritance in Semantics Nets
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

18 Exception Handling (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)

19 Frames 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

20 Converting from Frames to Semantics Nets
has_a book has_a date publisher is_a is_a has_a author novel encyclopedia is_a is_a Forbus editor has_a QPT

21 Frame Description (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. ::

22 Frames 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

23 SCRIPTS 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

24 Components in Scripts (I)
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

25 Components in Scripts (II)
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

26 Production Rules (I) 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.

27 Production Rules (II) 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

28 Production Rules (III)
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

29 Production Rules (IV) 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>

30 Production Rules (V) 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

31 Production Rules (VI) 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”

32 Production Rules (VII)
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

33 Production System Model
Long term memory Short term memory Production Rules Facts Reasoning Conclusion Question: why are the rules as long term memory?

34 Basic structure of a Production system
Knowledge-base Database Production Rules Facts Inference Engine Explanation Facility User Interface User

35 “Firing” of Rules 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”.

36 Reasoning Methods in Production 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

37 Forward Chaining 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

38 Rule-based system (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

39 Question 1 Given the facts that In a Forward Chaining system
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?

40 Give the conclusion of the reasoning process.
Question 2 What if ‘D’ is also true? (i.e. as a fact in the KB) Give the conclusion of the reasoning process.

41 Backward Chaining (I) 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.

42 Backward Chaining (II)
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

43 Backward Chaining (III)
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).

44 Figure: Backward Chaining Example

45 Formal Logic Advantages Disadvantages
Facts asserted independently of use completeness Disadvantages Separation of representation and processing Inefficient with large data sets Very slow with large knowledge bases

46 Production Rules Advantages Disadvantages 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

47 Semantic Networks Advantages Disadvantages Easy to follow hierarchy
Easy to trace association flexible Disadvantages Meaning attached to nodes might be ambiguous Exception handling is difficult Difficult to program

48 Frames 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

49 Name some Issues in Knowledge Representation.
Homework #1 Name some Issues in Knowledge Representation. Explain your answer.

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

51 SUPPLEMENTARY SLIDES

52 Conflict Resolution 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 green THEN the action is go Rule 2: IF the traffic-light is red THEN the action is stop Rule 3: IF the traffic-light is red THEN the action is go New rule

53 Now, we have 2 rules, rule 2 and rule 3, with the same IF-part
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.

54 How do we deal with it? 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.

55 Methods Used for Conflict Resolution
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


Download ppt "CSNB234 ARTIFICIAL INTELLIGENCE"

Similar presentations


Ads by Google