Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is...

31
Knowledge Engineering Second Term Fourth Year 1

Transcript of Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is...

Page 1: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

1

Knowledge Engineering

Second Term Fourth Year

Page 2: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

2

Data, Information and Knowledge• Data:

Data is unprocessed facts and figures without any added interpretation or analysis.

• Information:Data that has been interpreted so that it has meaning for the user.

• Knowledge:Knowledge is combination of information, experience and insight

that may benefit the individual or the organization.

Data Information Knowledgeappliedfor a purpose

build andprocess

Page 3: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

3

Knowledge EngineeringDefinition: The art of bringing the principles and tools of AI

research to solve complex problems using expert’s knowledge.

Page 4: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

4

Process of Knowledge Engineering

Sources of Knowledge

Knowledge Representation

Knowledge Base

Explanation, Justification

Inferencing

Knowledge Validation

Page 5: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

5

Levels of Knowledge

• Shallow Knowledge: Shallow knowledge refers to representation of only

surface level information that can be used to deal with very specific situations.

The shallow knowledge may be presented in terms of IF-THEN rules.Example: If gasoline tank is empty car will not start

The Shallow version represents input-output relationship of a system.

It can be presented in terms of IF-THEN rules. Shallow knowledge may be insufficient in describing

complex situations.

Page 6: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

6

Levels of Knowledge• Deep Knowledge:

Deep knowledge refers to the internal and causal structure of a system and considers the interactions among the system’s components.

Human problem solving is based on deep knowledge of a situation.

Deep knowledge can be applied to different tasks and different situations.

This knowledge is difficult to computerize.

Page 7: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

7

Categories of Knowledge• Declarative Knowledge:

Declarative knowledge is a descriptive representation of knowledge.

Procedural Knowledge: Procedural knowledge considers the manner in which

things work under different set of circumstances. Semantic Knowledge:

Semantic knowledge reflects cognitive structure that involves the use of the long-term memory. words and other symbols. word symbol meanings and usage rules. word symbol referents and interrelationships. algorithms for manipulating symbols, concepts and relations.

Page 8: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

8

Categories of Knowledge

• Episodic Knowledge: Episodic knowledge is autobiographical,

experimental information organized as a case or an episode. It is thought to reside in long term memory, usually classified by time and place.

Metaknowledge: Metaknowledge means knowledge about

knowledge. In AI, meta-knowledge refers to knowledge about the operation of knowledge based systems, that is, about its reasoning capabilities.

Page 9: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

9

Knowledge Representation (KR)Assumption of (traditional) AI work is that:• Knowledge may be represented as “symbol

structures” (essentially, complex data structures) representing bits of knowledge (objects, concepts, facts, rules, strategies ...)E.g. “red”represents colour red. “Car1” represents my car. red(car1) represents fact that my car is red.

• Intelligent behaviour can be achieved through manipulation of symbol structures

Page 10: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

10

Knowledge Representation Languages• Knowledge representation languages have

been designed to facilitate this.• Rather than use general C++/Java data

structures, use special purpose formalisms.• A KR language should allow you to:

represent adequately the knowledge you need for your problem (representational adequacy).

do it in a clear, precise and natural ways. allow you to reason on that knowledge, drawing

new conclusions.

Page 11: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

11

Properties of a good knowledge based system• Representational Adequacy: the ability to represent

all kinds of knowledge that are needed in that domain.• Inferential Adequacy: the ability to manipulate the

representational structures in such a way as to derive new structures corresponding to new knowledge inferred from old.

• Inferential Efficiency: the ability to incorporate into the knowledge structure additional information that can be used to focus the attention of the inference mechanisms in the most promising directions.

• Acquisitional Efficiency: the ability to acquire new information easily.

Page 12: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

12

Main KR Approaches• Logic• Frames/Semantic Networks/Objects• Rule based systems

Page 13: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

13

Logic as a Knowledge Representation Language• A Logic is a formal language, with precisely defined

syntax and semantics, which supports sound inference. Independent of domain of application.

• Different logics exist, which allow you to represent different kinds of things, and which allow more or less efficient inference.– propositional logic, predicate logic, temporal logic,

modal logic, description logic..• But representing some thing in logic may not be

very natural, and inferences may not be efficient. More specialized languages may be better..

Page 14: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

14

Propositional Logic

• In general a logic is defined by– syntax: what expressions are allowed in the

language.– Semantics: what they mean, in terms of a

mapping to real world – proof theory: how we can draw new conclusions

from existing statements in the logic.• Propositional logic is the simplest..

Page 15: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

15

Propositional Logic• The Propositional Logic allows facts about the world

to be represented as sentences formed from:

• Propositional symbols: P, Q, R, S... • And: • Or: • Not: • Implies: • If and only if: • Wrapping parentheses: (...) • logical constants: true, false, unknown

Page 16: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

16

Example `It is humid': Q • `It is humid and hot': QP• `If it is hot and humid, then it is raining':

(PQ) R• ‘it is humid but not hot’: PQ

Page 17: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

17

Truth TablesA B ABT T TT F FF T FF F F

A B ABT T TT F TF T TF F F

A B ABF F TF T TT F FT T T

A AFalse True

True False

A B ABF F TF T FT F FT T T

Page 18: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

18

Some IdentitiesFor Propositional Expressions P, Q and R:• (P) P• (PQ) (PQ)• The Contrapositive Law: (PQ) (QP)• de Morgan’s Laws: (a) (PQ) (PQ) and

(b) (PQ) (PQ)• The Commutative Laws: (PQ) (QR) and (PQ) (QR)• The Associative Laws: ((PQ)R) (P(QR))

((PQ)R) (P(QR))• The Distributive Laws: P(QR)) (PQ) (PR) P(QR)) (PQ) (PR)

Page 19: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

19

Example

(i) Show that (PQ) (PQ)Proof: P Q PQ P (PQ)

T T T F TT F T F TF T T T TF F F T F

Page 20: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

20

Example

(ii) Show that (PQ) (PQ) Proof:

P Q P Q (PQ) (PQ) PQ

T T F F T F FT F F T F T TF T T F F T TF F T T F T T

Page 21: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

21

Sentences• An expression that is always true (under any

interpretation is called a tautology.• If A is tautology, we write A╞ A logical expression that is a tautology is often

described as being VALID. Examples: Ali lives in Karachi Ali lives in Pakistan, A man is mortal, a lion is an animal.

• If an expression is false in any interpretation, it is described as being CONTRADICTORY:A¬ AExample: I study in MUET I am not student of

MUET.

Page 22: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

22

Sentences• A sentence is SATISFIABLE, if and only if there is

some interpretation in some world for which it is true.

• Some expressions are SATISFIABLE, but not valid. They are true under some interpretation but not under all interpretations. teacher not a student intelligent student position holder I live in Sindh I live in Karachi

A contradictory expression is clearly not satisfiable so is described as being UNSATISFIABLE.

Page 23: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

23

Show that the following formula is valid:((PH)H) PProof:

Since formula is true for all possible combinations of truth values, the formula is valid.

Example

P H PH H ((PH)H) ((PH)H) P

T T T F F TT F T T T TF T T F F TF F F T F T

Page 24: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

24

ExampleFor each of the following sentences, decide whether it is valid,

satisfiable, unsatisfiable or neither.(a) Smoke Smoke

Answer: Valid(b) Smoke Fire

Answer: Satisfiable(c) (Smoke Fire)(Smoke Fire)

Answer: Satisfiable(d) Smoke Fire Fire

Answer: Valid(e) ((Smoke heat)Fire) ((SmokeFire)(HeatFire)

Answer: Valid(f) (Smoke Fire)((Smoke heat)Fire)

Answer: ValidH.W.: show the validity of (d), (e) and (f) using truth tables.

Page 25: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

25

Inference• Inference is the process of deriving new

sentences from old ones.• Inference Rules are patterns of sound

inference that can be used to find proofs.

Page 26: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

26

Rules of Inference for Propositional Logic• Let B can be derived from A by inference. This is written as

• Some Popular Inference Rules(i) Modus Ponens or Implication Elimination:If A is true and A=> B is true, then conclude B is true.

(ii) And Elimination: (From a conjuction, you can infer any of the conjuctants.

BA

BBA,A

i

n21A

A...AA

Page 27: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

27

Rules of Inference for Propositional Logic(iii) And Induction: (From a list of sentences, you can infer their

conjuction)

(iv) Or-Induction: (From a sentence, you can infer its disjuction with anything else at all).

(v) Double-Negation Elimination: (From a doubly negated sentence, you can infer a positive sentence.)

n321

1A...AAA

A

n21

n21A...AA

A,...,A,A

AA

Page 28: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

28

Rules of Inference for Propositional Logic

(vi) Unit Resolution: (From a disjunction, if one of the disjuncts is false, then you can infer the other one is true.

(vii) Resolution:

or equivalently,

AB,BA

CACB,BA

CACB,BA

Page 29: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

29

Truth table demonstrating the soundness of the resolution inference rule

A B C AB BC ACF F F F T FF F T F T TF T F T F FF T T T T TT F F T T TT F T T T TT T F T F TT T T T T T

Page 30: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

30

The Predicate Calculus• In propositional calculus, each atomic sentence (P, Q etc.)

denotes a proposition of some complexity. There is no way to access the components of an individual assertion. Predicate calculus provides this ability.

• Example:In Propositional logic, we may write the entire sentence:P = “It rained on Tuesday”

In Predicate Calculus, we may create a predicate weather that describes a relationship between a date/day and weather:weather (Tuesday, rain)

Through inference rules, we can manipulate predicate calculus expressions, accessing their individual components and inferring new sentences.

Page 31: Knowledge Engineering Second Term Fourth Year 1. Data, Information and Knowledge Data: Data is unprocessed facts and figures without any added interpretation.

31

Predicate Calculus• Predicate calculus allows expressions to contain

variables.• Variables let us create general assertions about

classes of entities:Example: we could state that for all values of X, where X

is a day of the week, the statement weather(X, rain) is true; i.e. It rains everyday.