42
1 Intelligent Systems Lecture 4 Rohan Sinclair

1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Embed Size (px)

Citation preview

Page 1: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

1

Intelligent Systems

Lecture 4Rohan Sinclair

Page 2: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

2

• Knowledge Representation

Page 3: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Terms

• knowledge representation : the study of how knowledge about the world can be represented and what kinds of reasoning can be done with that knowledge

• knowledge representation language : Formalism used to represent knowledge. Also known as knowledge representation formalism.

• knowledge base: The collection of knowledge used by the system

Page 4: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Where is it used?

• medical informatics, • decision support systems, • medical vocabularies, • data coding and transfer, • guidelines and protocols

development, • database design and • electronic patient records.

Page 5: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Knowledge Representation Language

• A knowledge representation language has two aspects, namely syntactic and inferential aspect.

• The syntactic or notational aspect concerns the way in which one stores information in an explicit format.

• The inferential aspect concerns the way in which the explicitly stored information can be used to derive information that is implicit in it.

Page 6: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Knowledge Representation Language

A knowledge representation language has four levels, namely:

• implementational, • logical, • epistemological and • conceptual level.The most popular include production rules,

scripts, semantic networks and frames.

Page 7: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Semantic Nets

• The major idea is that the meaning of a concept comes from its relationship to other concepts, and that the information is stored by interconnecting nodes with labelled arcs.

Page 8: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Semantic Networks

• A semantic network is a simple representation scheme that uses a graph of labeled nodes and labeled, directed arcs to encode knowledge.– Usually used to represent static,

taxonomic, concept dictionaries• Semantic networks are typically used with

a special set of accessing procedures that perform “reasoning”– e.g., inheritance of values and

relationships

Page 9: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Semantic Networks

• Semantic networks were very popular in the ‘60s and ‘70s but are less frequently used today.– Often much less expressive than

other KR formalisms• The graphical depiction

associated with a semantic network is a significant reason for their popularity.

Page 10: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Nodes and Arcs

• Arcs define binary relationships that hold between objects denoted by the nodes.

john 5Sue

age

mother

mother(john,sue)age(john,5)wife(sue,max)age(max,34)...

34

age

father

Max

wifehusband

age

Page 11: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Semantic Networks• The ISA (is-a) or AKO

(a-kind-of) relation is often used to link instances to classes, classes to superclasses

• Some links (e.g. hasPart) are inherited along ISA paths.

• The semantics of a semantic net can be relatively informal or very formal– often defined at the

implementation level

isa

isa

isaisa

Robin

Bird

Animal

RedRusty

hasPart

Wing

Page 12: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Reification

give

mary book32

john

recipient

giver

object

• Non-binary relationships can be represented by “turning the relationship into an object”

• This is an example of what logicians call “reification”– reify v : consider an abstract concept to be

real • We might want to represent the generic give

event as a relation involving three things: a giver, a recipient and an object, give(john,mary,book32)

Page 13: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Representation in a Semantic Net

Page 14: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Representation in a Semantic Net

• These values can also be represented in logic as: isa(person, mammal), instance(Mike-Hall, person) team(Mike-Hall, Cardiff)

Page 15: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Representation in a Semantic Net

• We have already seen how conventional predicates such as lecturer(dave) can be written as instance (dave, lecturer) Recall that isa and instance represent inheritance and are popular in many knowledge representation schemes. But we have a problem: How we can have more than 2 place predicates in semantic nets? E.g. score(Cardiff, Llanelli, 23-6)

Page 16: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Representation in a Semantic Net

• Solution: • Create new nodes to represent

new objects either contained or alluded to in the knowledge, game and fixture in the current example.

• Relate information to nodes and fill up slots (see figure below).

Page 17: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Representation in a Semantic Net

Page 18: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Representation in a Semantic Net

• As a more complex example consider the sentence: John gave Mary the book. Here we have several aspects of an event.

Person

instance

instance

Page 19: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

EXAMPLE

• Bilbo, the hobbit, found the magic ring in Gollum’s cave. Hobbits are little people with large, hairy feet.

Page 20: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Example

• Five cars are currently placed at the yard of Mack D Auto Sales. Three of the dealer’s cars are Japanese makes and the other two European. The Japanese models are Toyota Corolla (2.5L Automatic PJ6127 Brown), Honda Civic (1.3L Manual MN2323 Red) and Nissan Bluebird Sylphy (2.0L Automatic YK1234 Green) respectively whereas the European models are BMW S-1 (3.0L Automatic MN3456 Blue) and Jaguar (1.3L Manual TR2317 Red). The four pieces of data within the brackets are engine size, mode of transmission, registration number and color respectively.

Page 21: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Solution

Page 22: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Frames

• Frames are structures that represent knowledge about a limited aspect of the world. Like the concepts in many of the semantic network representations, frames are descriptions of objects. The descriptions in a frame are called slots.

Page 23: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Frames

• Frames implement semantic networks.• They add procedural attachment• A frame has slots and slots have values• A frame may be generic i.e. it describes

a class of objects• A frame may be an instance• Frames can inherit properties from

generic frames

Page 24: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Example

Page 25: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Propositional Logics

• Terms to be discussed– Consistency– Validity– Problem Solving using Semantic

Tableaux (Truth Trees, truth tables)

Page 26: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Logics• A logic statement is one that can only be

expressed as True or False.• Expressed as an Inference that can only be

one of two values.• Critical to the ability of a computer to reason.• Eg. The Wumpus is dead• The Wumpus is not dead• Statements can be a conjunction of many

statements.• Logics consists of Syntax

– Describes how to make statements• Semantics

– Specify the constraints on how statements relates to each other

• Proof Theory– Set of rules for evaluating the outcome of a set of

statements.

Page 27: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Propositional Logics

• The term proposition is synonymous with statement.

• also known as sentential logic and Statement Logic.

• studies ways of combining proposition to form more complicated proposition

• Eg. Paris is the capital of France • Paris has a population of over two

million. • Paris is the capital of France and Paris

has a population of over two million.• Use uppercase symbols to represent

proposition, facts etc, which may be either true or false.

Page 28: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

• Language Syntax• The logical signs

• ‘^’ - And,

• 'v‘ - Or,• '→‘ – Implies, (If…. Then…)• '↔‘ – equivalent (Biconditional, If and only if),• '¬' - Not• Paris is the capital of France and Paris has a population

of over two million.

• Can be written as C ^ P

• The order of precedence in propositional logic is (from highest to lowest): ¬ , And, V, →, and ↔.

• Hence ¬P V Q ^ R → S is equivalent to

((¬ P) V (Q ^ R)) → S.

Page 29: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

• Eg represent in Propositional Logic statements.

• If the violinist plays the concerto then crowds will come if prices are not too high. If the violinist plays the concerto the prices will not be too high. Therefore if the violinist plays the concerto crowds will come.

• P = “The violinist plays the piano”• C = “Crowds will come”• H = “Prices are too high”

Page 30: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Language Semantics

• Truth Table• Describe the meanings of the symbols used in the

language.

• P Q ¬P P and Q P V Q P → Q P ↔ Q F F T F F T T F T T F T T F T F F F T F F T T F T T T T

• Truth tables define the semantics of the PL sentences.

• propositional logic does not require any relation of causation or relevance between sentences P andQ.

Page 31: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Consistency• A collection of statements is considered

consistent if the statements can all be true simultaneously.

• Anding all statements results in a true outcome.

• Eg. Prove if consistent• If the violinist plays the concerto then

crowds will come if prices are not too high. If the violinist plays the concerto the prices will not be too high. Therefore if the violinist plays the concerto crowds will come.

Page 32: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Consistency

• Eg. Prove if consistent• Sales of houses fall off if interest

rates rise. Auctioneers are not happy if sales of houses fall off. Interest rates are rising. Auctioneers are happy.

Page 33: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

• Soln.• S = “Sales of houses fall off• R = “Interest Rates rise• H = “Auctioneer are happy”• R -> S, S -> -H, R, H• To see if the statements are

consistent, we check if the conjunction results in true.

Page 34: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Validity

• Statements are valid if the conjunction (AND) of the statements implies the conclusion.

• Can the conclusion follows logically from the statements.

• Different methods of proving Validity.

• Truth Tree• Refutation Strategy• CounterModel Approach

Page 35: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Validity• How to check

– Use Truth table

• Eg prove validity of the following statements:

• P V H, -H, =>P

Page 36: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Refutation Strategy

• To check whether an argument is valid we need to find if the negation (opposite) of the conclusion is incompatible with the premises using a truth table.

• Ie, does the conjunction of the negated conclusion and the premise results in a false

Page 37: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Example 1

• If the violinist plays the concerto then crowds will come if prices are not too high. If the violinist plays the concerto the prices will not be too high. Therefore if the violinist plays the concerto crowds will come.

• Statements are :– P -> (-H -> C)– P -> -H– P -> C (Conclusion)

• Negate conclusion and test if conjunction of all three results in a false

Page 38: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Example 2

• IF the Reggae Boyz win the match then their supporters will be happy. The supporters will drink too much if they are not happy. Therefore if the supporters do not drink too much the Reggae Boyz will win the match.

• Prove Consistency and Validity

Page 39: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

• R = “Reggae Boyz will win the match”

• H = “The supporters will be happy”• D = “The supporters will drink too

much”• Statements would be:• W -> H• -H -> D• Therefore –D -> W

Page 40: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Exercise 5

• If Jamaica reached the World Cup Finals then either Brazil slipped up o France played very well. Brazil did not slip up unless Jamaica reached the World Cup Finals. France did not play very well. Therefore Jamaica reached the World Cup Finals if and only if Brazil slipped up.

Page 41: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Exercise 4• Convert the following sentences in propositional logic

and determine whether or not the conclusions are valid by the use of a truth tree

• “If Alice wins the nomination, she will be happy. If she is happy, she is not a good campaigner. But if she loses the nomination, she will lose the confidence of the party. She is not a good campaigner if she loses the confidence of the party. If she is not a good campaigner, then she should resign from the party. Therefore, she should resign from the party.”

• Using the following propositional symbols N;H;C; P;R). N - Alice wins the nomination; H - Alice is happy; C - Alice is a good campaigner; P - Alice loses the confidence of the party; R - Alice should resign.

Page 42: 1 Intelligent Systems Lecture 4 Rohan Sinclair. 2 Knowledge Representation

Example 5

• If the teller had pushed the alarm button, the vault would have locked automatically and the police would have arrived within three minutes. Had the police arrived within three minutes, the robbers' car would have been overtaken. But the robbers' car was not overtaken. Therefore the teller did not push the alarm button.