DCP 1172 Introduction to Artificial Intelligence - PowerPoint PPT Presentation

Loading...

PPT – DCP 1172 Introduction to Artificial Intelligence PowerPoint presentation | free to download - id: 27201d-ZDc1Z



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

DCP 1172 Introduction to Artificial Intelligence

Description:

We studied search because it facilitates the creation of agents ... Knowledge representation (KR) is a multi-disciplinary ... KR = Logic Ontology ... – PowerPoint PPT presentation

Number of Views:52
Avg rating:3.0/5.0
Slides: 81
Provided by: changsh
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: DCP 1172 Introduction to Artificial Intelligence


1
DCP 1172 Introduction to Artificial Intelligence
  • Lecture notes for Chap. 7 AIMA
  • Logical Agent
  • Chang-Sheng Chen

2
Knowledge and reasoning second part
  • Knowledge representation
  • Logic and representation
  • Propositional (Boolean) logic
  • Normal forms
  • Inference in propositional logic
  • Wumpus world example

3
Review
  • We studied search because it facilitates the
    creation of agents that can reason about
    hypothetical (future) states of the world.
  • But… we havent said much of anything about how
    those states should be represented.
  • Or about how these future (successor) states can
    be generated from current states

4
Typical Example of Knowledge-based Agent ?
Anti-spam Mail Filtering
  • Generic Mail Filtering Functions
  • F(n) g(n) h(n)
  • G(n) exact value known
  • H(n) Heuristic / estimate value
  • Mail Transfer Agent

Client
Generic Mail Filtering
Anti-SPAM Filtering
Fail
Reject
Mail Spool
Pass
  • Accept

5
SPAM Mail Filtering Tool - Netscape Communicator
6
SPAM Mail-20041018c(2)
7
SPAM Message-20041018c(1)
8
Knowledge-Based Agents
  • A knowledge-based agent is composed of a
    knowledge base and an inference mechanism.
  • A knowledge-base is simply a repository of
    domain-specific things (or sentences about the
    world) that you know represented in some useful
    way.
  • A knowledge-based agent operates by storing
    sentences about the world in its knowledge base,
    using the inference mechanism to infer new
    sentences, and using these sentences to decide
    what action to take.
  • The knowledge base cannot be a simple table
    because an agent should be able to conclude facts
    about the world that are not already represented
    in the knowledge base.

9
Knowledge-Based Agent
  • Agent that uses prior or acquired knowledge to
    achieve its goals
  • Can make more efficient decisions
  • Can make informed decisions
  • Knowledge Base (KB) contains a set of
    representations of facts about the Agents
    environment
  • Each representation is called a sentence
  • Use some knowledge representation language (KRL),
    to TELL it what to know e.g., (temperature 72F)
  • ASK the agent (i.e., to query) what to do
  • Agent can use inference to deduce new facts from
    TELLed facts

10
Knowledge-base Agents
  • TELL operator to add new sentences into the KB.
  • ASK operator to query what it is known in the
    KB.
  • The agent maintains a knowledge base, KB.
  • Each time the agent is called, it does two
    things.
  • First, it TELL the KB what it perceives.
  • Second, it ASKs the KB what action it should
    perform.
  • In the process of answering the query, extensive
    reasoning may be done.
  • Once the action is chosen, the agent records its
    choice with TELL and executes the action.

11
Generic knowledge-based agent
  • TELL KB what was perceived Uses a Knowledge
    Representation Language (KRL) to insert new
    sentences, representations of facts, into KB
  • ASK KB what to do. Uses logical reasoning to
    examine actions and select best.

12
Knowledge-Based Agents
  • A knowledge representation is a formal scheme
    that dictates how an agent is going to represent
    its knowledge in the knowledge base.
  • Syntax (??) Rules that determine the possible
    strings in the language.
  • Semantics(??) Rules that determine a mapping
    from sentences in the representation to
    situations in the world.
  • . Knowledge Representation Logic Ontology
    Computation

13
Knowledge Representation Logic Ontology
Computation
  • Knowledge representation (KR) is a
    multi-disciplinary subject that applies theories
    and techniques from three fields
  • Logic
  • provides the formal structure and rules of
    inference.
  • Ontology
  • defines the kinds of thins that exist in the
    application domain.
  • Computation
  • supports the applications that distinguish
    knowledge representation from pure philosophy.

14
KR Logic Ontology Computation (cont.)
  • Knowledge representation is the application of
    logic and ontology to the task of constructing
    computable models for some domain.
  • Without logic, a knowledge representation is
    vague, with no criteria for determining whether
    statements are redundant or contradictory.
  • Without ontology, the terms and symbols are
    ill-defined, confused, and confusing.
  • Without computable models, the logic and ontology
    cannot be implemented in a computer program.

15
Wumpus world example
16
Wumpus world characterization
  • Deterministic? Yes outcome exactly specified.
  • Fully Observable? No only local perception.
  • Static? Yes Wumpus and pits do not move.
  • Discrete? Yes
  • Episodic? (Yes) because static.

17
Exploring a Wumpus world
A Agent B Breeze S Smell P Pit W Wumpus OK
Safe V Visited G Glitter
18
Exploring a Wumpus world
A Agent B Breeze S Smell P Pit W Wumpus OK
Safe V Visited G Glitter
19
Exploring a Wumpus world
A Agent B Breeze S Smell P Pit W Wumpus OK
Safe V Visited G Glitter
20
Exploring a Wumpus world
A Agent B Breeze S Smell P Pit W Wumpus OK
Safe V Visited G Glitter
21
Exploring a Wumpus world
A Agent B Breeze S Smell P Pit W Wumpus OK
Safe V Visited G Glitter
22
Exploring a Wumpus world
A Agent B Breeze S Smell P Pit W Wumpus OK
Safe V Visited G Glitter
23
Exploring a Wumpus world
A Agent B Breeze S Smell P Pit W Wumpus OK
Safe V Visited G Glitter
24
Exploring a Wumpus world
A Agent B Breeze S Smell P Pit W Wumpus OK
Safe V Visited G Glitter
25
Other tight spots
26
Another example solution
  • B in 2,1 ? P in 2,2 or 3,1 ?
  • 1,1 V ? no P in 1,1
  • Move to 1,2 (only option)
  • No perception ? 1,2 and 2,1 OK
  • Move to 2,1

27
Example solution
  • S in 1,2 and No S when in 2,1 ? 1,3 or
    1,2 has W
  • 1,2 OK ? W in 1,3
  • No B in 1,2 ? 2,2 OK P in 3,1

28
Representation and Mappings
  • Two different kinds of entities are usually
    mentioned in the discussions about AI programs
  • Facts truths in some relevant world (e.g.,
    including each agents behavior and goals, etc.).
  • There is a pit in 3,1 (proposition true or
    false)
  • Representation of facts in some chosen formalism.
  • These are the things that we will actually be
    able to manipulate.
  • P3,1 there is a pit in 3,1 (true or false)

29
Mapping between Facts and Representations
Reasoning Programs

Internal Representations
Facts

Natural Language generation
Natural Language understanding
Natural Language Representation (e.g., English,
Chinese, etc.)
30
Logic in general
31
Types of logic
32
Overview of Proposition Logic
  • Proposition logic is a very simple language that
    consists of proposition symbols and logical
    connectives.
  • Proposition symbols P1, P2, Q, etc.
  • Logical connectives ,,V,?,? , etc
  • Proposition logic can handle propositions that
    are known true, known false, or completely
    unknown.
  • Proposition X is a rose

33
First-order logic (FOL)
  • Ontological commitments
  • Objects wheel, door, body, engine, seat, car,
    passenger, driver
  • Relations Inside(car, passenger),
    Beside(driver, passenger)
  • Functions ColorOf(car)
  • Properties Color(car), IsOpen(door),
    IsOn(engine)
  • Functions are relations with single value for
    each object

34
Semantics
  • there is a correspondence between
  • functions, which return values
  • predicates, which are true or false
  • Function FatherOf(Mary) Bill
  • Predicate FatherOf(Mary, Bill)

35
The Semantic Wall - Truth Depends on
Interpretation
Physical Symbol System World
BLOCKA BLOCKB BLOCKC P1(IS_ON BLOCKA
BLOCKB) P2((IS_RED BLOCKA)
36
Truth Depends on Interpretation (e.g., Anti-spam
or anti-virus mail filtering)
  • MTA0

Filtering with H1(msg)
Mail Spool
Accept
  • MTA1 (or MUA1)

Filtering With H2(msg)
Discard
  • MTA Mail Transfer Agent
  • MUA Mail User Agent
  • MTA2 (or MUA1)

37
Logical entailment (??, ??) between sentences
  • Logical entailment between sentences (i.e., in
    mathematical term, we write a ? ß ) the idea
    that a sentence following logically from another
    sentence. For example,
  • Proposition a Bill is the father of Mary.
  • Proposition ß Mary is a child of Bill.
  • The formal definition of entailment is this
  • a ? ß , if and only if, in every model in which
    a is true, then ß is true.

38
Reasoning - Logic as a representation of the World
  • The proposition X is rose entails the proposition
    X is a follower
  • because all roses are followers.

39
Entailment (??, ??)
.
  • Question is a ? ß ?
  • Proposition a X is the Child of Y.
  • Proposition ß Y is the Mother of X

40
Models
41
Inference
  • Notice that inference is not directly related to
    truth
  • i.e. we can infer a sentence provided we have
    rules of inference that produce the sentence from
    the original sentences.
  • However, if rules of inference are to be useful
    we wish them to be related to entailment. Ideally
    we would like
  • p ? q if and only if p ? q

42
Inference (cont.)
  • Ideally we would like
  • p ? q (inference) if and only if p ? q
    (entailment)
  • But this equivalence may fail in two ways
  • p ? q but p ? q
  • We have inferred by applying rules of inference
    to , but there is some model in which p holds
    but q does not hold. In this case the rules of
    inference have inferred too much''.
  • p ? q but p ? q
  • q is a sentence which holds in all models in
    which p holds, but we cannot find rules of
    inference that will infer from . In this case
    the rules of inference are insufficient to infer
    the things we want to be able to infer.

43
Inference (cont.)
A sound inference procedure infers things that
are valid consequences''
  • A complete inference procedure is able to infer
    anything that is that is a valid consequence''
  • The best'' inference procedures are both sound
    and complete, but gaining completeness is often
    computationally expensive. Notice that even if
    inference is not complete it is desirable that it
    is sound.

44
Entailment vs. Inference
  • Entailment is different from inference
  • Entailment KB a if and only if a is true in
    all worlds where KB is true. That is, M(KB) ?
    M(a).
  • Inference KB i a, sentence a can be derived
    from KB using procedure i
  • Sound whenever KB i a then KB a is true
  • Complete whenever KB a then KB i a is also
    true.

45
Basic symbols of proposition logic
  • Propositions (expressions) only evaluate to
    either true or false.
  • Basic Operations
  • P P is true
  • Negation P, P is false
  • Disjunction P V Q, either P is true or Q is
    true or both
  • Conjunction P Q, both P and Q are true
  • Implication P gt Q, if P is true, the Q is
    true
  • Equivalence P ? Q , P and Q are either both
    true or both false

46
Propositional logic syntax
47
Propositional logic semantics
48
Truth tables
  • Truth value whether a statement is true or
    false.
  • Truth table complete list of truth values for a
    statement given all possible values of the
    individual atomic expressions.
  • Example
  • P Q P V Q
  • T T T
  • T F T
  • F T T
  • F F F

49
Truth tables for basic connectives
  • P Q P Q P V Q P Q PgtQ P?Q
  • T T F F T T T T
  • T F F T T F F F
  • F T T F T F T F
  • F F T T F F T T

50
Propositional logic basic manipulation rules
  • (A) A Double negation
  • (A B) (A) V (B) Negated and
  • (A V B) (A) (B) Negated or
  • A (B V C) (A B) V (A C) Distributivity of
    on V
  • A gt B (A) V B by definition
  • (A gt B) A (B) using negated or
  • A ? B (A gt B) (B gt A) by definition
  • (A ? B) (A (B))V(B (A)) using negated
    and or
  • …

51
Propositional inference enumeration method
true
52
Enumeration Solution
53
Propositional inference normal forms
product of sums of simple variables or negated
simple variables
sum of products of simple variables or negated
simple variables
54
Deriving expressions from functions
  • Given a boolean function in truth table form,
    find a propositional logic expression for it that
    uses only V, and .
  • Idea We can easily do it by disjoining the T
    rows of the truth table.
  • Example XOR function
  • P Q RESULT
  • T T F
  • T F T P (Q)
  • F T T (P) Q
  • F F F
  • RESULT (P (Q)) V ((P) Q)

55
A more formal approach
  • To construct a logical expression in disjunctive
    normal form from a truth table
  • Build a minterm for each row of the table,
    where
  • - For each variable whose value is T in that
    row, include
  • the variable in the minterm
  • - For each variable whose value is F in that
    row, include
  • the negation of the variable in the minterm
  • - Link variables in minterm by conjunctions
  • The expression consists of the disjunction of all
    minterms.

56
Example adder with carry
  • Takes 3 variables in x, y and ci (carry-in)
    yields 2 results sum (s) and carry-out (co). To
    get you used to other notations, here we assume T
    1, F 0, V OR, AND, NOT.

co is
s is
57
Tautologies
  • Logical expressions that are always true. Can be
    simplified out.
  • Examples
  • T
  • T V A
  • A V (A)
  • (A (A))
  • A ? A
  • ((P V Q) ? P) V (P Q)
  • (P ? Q) gt (P gt Q)

58
Validity and satisfiability
Theorem
59
Proof methods
60
Inference Rules
61
Inference Rules
62
Wumpus world example
  • Facts Percepts inject (TELL) facts into the KB
  • stench at 1,1 and 2,1 ? S1,1 S2,1
  • Rules if square has no stench then neither the
    square nor adjacent square contain the wumpus
  • R1 !S1,1 ?!W1,1 ? !W1,2 ? !W2,1
  • R2 !S2,1 ?!W1,1 ?!W2,1 ? !W2,2 ? !W3,1
  • …
  • Inference
  • KB contains !S1,1 then using Modus Ponens we
    infer !W1,1 ? !W1,2 ? !W2,1
  • Using And-Elimination we get !W1,1 !W1,2
    !W2,1
  • …

63
Limitations of Propositional Logic
  • 1. It is too weak, i.e., has very limited
    expressiveness
  • Each rule has to be represented for each
    situation e.g., dont go forward if the wumpus
    is in front of you takes 64 rules
  • 2. It cannot keep track of changes
  • If one needs to track changes, e.g., where the
    agent has been before then we need a
    timed-version of each rule. To track 100 steps
    well then need 6400 rules for the previous
    example.
  • Its hard to write and maintain such a huge
    rule-base
  • Inference becomes intractable

64
Summary
65
Principles of Knowledge Representation - Randall
Devis, Howard Schrobe, Peter Szolovits, 1993
  • Five basic principles of KR
  • A knowledge representation is a surrogate.
  • A knowledge representation is a set of
    ontological commitments.
  • A knowledge representation is a fragmentary
    theory of intelligent reasoning.
  • A knowledge representation is a medium for
    efficient computation.
  • A knowledge representation is a medium of human
    expression.

66
A knowledge representation is a surrogate
  • Physical objects, events, and relationships,
    which cannot be stored directly in a computer,
    are represented by symbols that are surrogated
    (??, ??) for the external things.
  • The symbols and the links between them form a
    model of the external system.
  • By manipulating the internal surrogates, a
    computer program can simulate the external system
    or reason about it.

67
Representation of Facts
Desired real reasoning
Initial facts
Final facts
Backward representation mapping
Forward representation mapping


Internal representation of initial facts
Internal representation of final facts
Operation of program
68
Generic Mail Filtering (cont)
Client
(1)
Generic Mail Filtering
White List
Pass
(2)
Reject
Black List
Fail
(3)
  • Accept

Grey List
Mail Spool
Fail temporarily
(4)
Automatic SPAM Learning
Fail
Update
Pass
69
A knowledge representation is a set of
ontological commitments.
  • Ontology is the study of existence.
  • For database or knowledge base, ontology
    determines the categories of things that exist or
    may exist in an application domain.
  • Those categories represent the ontological
    commitments of the designer or knowledge
    engineers.

70
What is an ontology
  • The word ontology comes from the Greek ontos for
    being and logos for word.
  • An ontology is
  • a unifying framework for different viewpoints
    and serves as the basis for enabling
    communication (between people, between people and
    systems, between systems)
  • a logical theory which gives an explicit, partial
    account of a conceptualization Guarino and
    Giaretta, 1995

71
What are the Components of an Ontology ?
  • Concepts (broad sense) Anything about which
    something is said
  • Mail User agent (e.g., outlook express, etc),
    Mail Transfer agent (e.g., sendmail, etc.),
    blacklist, sender address, etc.
  • Relations interaction between concepts of the
    domain
  • E.g., SubsetOf, MemberOf, PartOf, etc.
  • MUA (client) MTA (server), etc.
  • Axioms to model sentences that are always true
  • Any mail with invalid recipient address will be
    bounced back.
  • Any sender address within the blacklist of the
    MTA will be rejected.
  • …more
  • Instances
  • Used to represent elements

72
Mail Ontology
73
Candidate Features for Filtering with Heuristics
  • Envelop address (EnvFrom, EnvRcpt)
  • Relay (Helo, rDNS, IP address range, etc.)
  • SMTP Peak Connection Ratio (8.13)
  • Header Address (HdrFrom, HdrRcpt, etc)
  • Body Content
  • URL

74
A knowledge representation is a fragmentary
theory of intelligent reasoning.
  • To support reasoning about the things in a
    domain, a knowledge representation must also
    describe their behavior and interactions.
  • The descriptions constitutes a theory of the
    application domains.
  • The theory may be stated in explicit axioms, or
    it may be compiled into executable programs.

75
KR and Heuristics for e-mail filtering
  • Ra-1, Mailformed HiNet sender address
  • reject "Rejected, Malformed MAIL FROM (Ra-1) "
  • envfrom /lta-z._at_ms(a1-91-90-9)\.hinet\.
    netgt/ei
  • envfrom /lta-z._at_hinet\.netgt/I
  • Rb-1, Invlaid sender address
  • reject "Rejected, SPAM from TwIspBL (Rb-1)!"
  • connect /.dynamic\..(EBTnetHiNetttn)\.net/ei
    /./I
  • connect /.dynamic\..(netcom)\.tw/ei
    /./i
  • … more

76
A knowledge representation is a medium for
efficient computation
  • Besides representing knowledge, an AI system must
    encode knowledge in a form that can be processed
    efficiently on the available computing
    equipments.
  • New developments in computer hardware and
    programming theory have had a major influence on
    the design and use of knowledge representation
    languages.

77
Sample KR - Greylist for E-mail filtering
  • greylisted tuples
  • -------------------------------------------------
    ---------------------------------------
  • Sender IP Sender e-mail Recipient e-mail
    Time accepted
  • 202.53.72.110 ltvjxgtcfn_at_yahoo.comgt
    ltlh15_at_mail.nctu.edu.twgt 1099474741 2004-11-03
    173901
  • 202.53.72.110 ltvjxgtcfn_at_yahoo.comgt
    ltlimintsai_at_mail.nctu.edu.twgt 1099474742
    2004-11-03 173902
  • 202.53.72.110 ltvjxgtcfn_at_yahoo.comgt
    ltlindajmm_at_mail.nctu.edu.twgt 1099474743
    2004-11-03 173903

78
Sample KR - Greylist for E-mail filtering (cont.)
  • Auto-whitelisted tuples
  • Sender IP Sender e-mail Recipient e-mail
    Expire
  • 210.58.229.92 ltepaper_at_eslite.com.twgt
    ltysm_at_cc.nctu.edu.twgt 1100042183 AUTO
    2004-11-10 071623
  • 210.58.229.92 ltepaper_at_eslite.com.twgt
    ltyytzou_at_cc.nctu.edu.twgt 1100042354 AUTO
    2004-11-10 071914
  • 210.58.229.92 ltepaper_at_eslite.com.twgt
    ltwsfu_at_cc.nctu.edu.twgt 1100041397 AUTO
    2004-11-10 070317
  • … more

79
A knowledge representation is a medium of human
expression.
  • A good knowledge representation should facilitate
    the communication between the knowledge engineers
    who understands AI and the domain experts who
    understand the applications.
  • Although the knowledge engineers may write the
    definitions and the rules, the domain experts
    should be able to read and verify whether they
    represent a realistic theory of the domain.

80
Ontology, Domain Expert and Knowledge Engineer
About PowerShow.com