560 likes | 783 Views
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
E N D
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. 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 • 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 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) • 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) • 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 has_covering has_property bird feathers flies is_a size has_color small blue bluebird
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.
CONCEPTUAL GRAPHS • Developed in 1984 • Conceptual graphs (networks) overcome the restriction to binary relation • Simply makes all links unlabelled
A Disjunctive Net for Red or Green Apple Apple Color Green Red A Conceptual Net that represents “OR”
Conceptual Nets For ‘Where do Rivers Flow to’? Sea River flow_to Lake Marsh
A Conjunctive Net for black and white panda Color WHITE PANDA Color BLACK A Conceptual Net that represents “AND”
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
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
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)
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
Converting from Frames to Semantics Nets 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 (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. ::
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
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
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
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
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.
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
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
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>
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
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”
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
Production System Model 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 Knowledge-base Database Facts Production Rules Inference Engine Explanation Facility User Interface User
“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”.
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
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
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
Question 1 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 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 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) • 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) • 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 • Advantages • Facts asserted independently of use • completeness • Disadvantages • Separation of representation and processing • Inefficient with large data sets • Very slow with large knowledge bases
Advantages 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 • 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 • 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 Name some Issues in Knowledge Representation. Explain your answer.
Homework #2 Give Two advantages and Two disadvantages of Rule-based ES that are NOT listed in this handouts