Top Banner
LeongHW, SoC, NUS (UIT2201: AI) Page 1 © Leong Hon Wai, 2003-2013 Artificial Intelligence Reading Materials: Ch 14 of [SG] Also Section 9.4.2 Logic Programming Contents: Different Types of Tasks Knowledge Representation Recognition Tasks Reasoning Tasks
79

Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

Oct 10, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 1

© Leong Hon Wai, 2003-2013

Artificial Intelligence q Reading Materials:

v  Ch 14 of [SG] v  Also Section 9.4.2 Logic Programming

q Contents: v  Different Types of Tasks v  Knowledge Representation v  Recognition Tasks v  Reasoning Tasks

Page 2: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 2

© Leong Hon Wai, 2003-2013

For Fall 2013 semester q Will only cover:

v  Turing Test, Eliza v  Division of Labour in AI v  Formal Language for Knowledge Representation v  Reasoning: Intelligent Search, Expert Systems

q Parts of Ch. 14 covered v  Ch. 14.1 Introduction v  Ch. 14.2 Division of Labour v  Ch. 14.3 Only Formal Language (Predicates) v  Ch. 14.5 Reasoning Tasks

q Will not cover v  Knowledge Representation (except Formal Lang) v  Recognition Tasks (Ch 14.4) v  Robotics (Ch 14.6)

Page 3: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 3

© Leong Hon Wai, 2003-2013

Artificial Intelligence… q  Context so far…

v  Use algorithm to solve problem v  Database used to organize massive data v  Algorithms implemented using hardware v  Computers linked in a network

Educational Goals for this Chapter: q  The computer as a tool for

v  Solving more human-like tasks v  Build systems that “think” independently v  Can “intelligence” be encoded as an algorithm?

Page 4: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 4

© Leong Hon Wai, 2003-2013

Introduction

q Artificial intelligence (AI) v  Explores techniques for incorporating aspects

of “intelligence” into computer systems

q Turing Test (Alan Turing, 1950) v  A test for intelligent behavior of machines

Page 5: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 5

© Leong Hon Wai, 2003-2013

If the interrogator is unable to determine which entity is the human and which is the machine, then the machine has passed the Turing Test

The Turing Test (Alan Turing, 1950)

Page 6: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 6

© Leong Hon Wai, 2003-2013

Introduction (continued)

q Artificial intelligence can be thought of as constructing computer models of human intelligence

q Early attempt: Eliza (see notes, website)

Page 7: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 7

© Leong Hon Wai, 2003-2013

Page 8: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 8

© Leong Hon Wai, 2003-2013

A Typical Conversation with Eliza

Page 9: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 9

© Leong Hon Wai, 2003-2013

Is Eliza really “intelligent”?

q How Eliza does it…

Page 10: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 10

© Leong Hon Wai, 2003-2013

Eliza Conversation revisited

Encouragement

Encouragement

simple inversion

template “I am ..”

template “do you…”

template “what …”

template “tell me…”

template “who else…”

Finish the rest yourself

Page 11: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 11

© Leong Hon Wai, 2003-2013

What’s YOUR verdict?

Does Eliza pass the Turing Test?

YES?

NO? How would you “break” it?

Page 12: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 12

© Leong Hon Wai, 2003-2013

Eliza, Chatterbots, & applications…

Many Eliza-like programs on the Web: Also called “chatterbots”

v  http://nlp-addiction.com/eliza/ v  http://www.manifestation.com/neurotoys/

eliza.php3 v  http://www.chatbots.org/chatbot/eliza/ v  http://en.wikipedia.org/wiki/ELIZA

Found applications in Answer services, Automated Call Centers.

Page 13: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 13

© Leong Hon Wai, 2003-2013

Recent news (NUS-USP-UIT2201 FB Gp)

Page 14: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 14

© Leong Hon Wai, 2003-2013

Headline on “Mashable” (28-Oct-2013)

http://mashable.com/2013/10/28/captcha-defeated/

Page 15: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 15

© Leong Hon Wai, 2003-2013

What is a Captcha? … is a program that can generate and

grade tests that humans can pass but current computer programs cannot.

… in other words, to tell Humans and Computers Apart Automatically

Page 16: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 16

© Leong Hon Wai, 2003-2013

Headline on “Mashable” (28-Oct-2013)

http://mashable.com/2013/10/28/captcha-defeated/

So, does this computer pass the Turing Test?

…major web services of Google, Yahoo, Paypal.

…up to 90% of the time,

Page 17: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 17

© Leong Hon Wai, 2003-2013

A Division of Labor

q  Categories of “human-like” tasks v  Computational tasks v  Recognition tasks v  Reasoning tasks

Page 18: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 18

© Leong Hon Wai, 2003-2013

A Division of Labor (continued) q Computational tasks

v  Tasks for which algorithmic solutions exist v  Computers are better (faster and more

accurate) than humans

q Recognition tasks v  Sensory/recognition/motor-skills tasks v  Humans are better than computers

q Reasoning tasks v  Require a large amount of knowledge v  Humans are far better than computers

Page 19: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 19

© Leong Hon Wai, 2003-2013

Figure 14.2: Human and Computer Capabilities

Page 20: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 20

© Leong Hon Wai, 2003-2013

Artificial Intelligence Contents:

v  Different Types of Tasks v  Knowledge Representation v Recognition Tasks

◆  Modeling of Human Brain ◆  Artificial Neural Networks

v  Reasoning Tasks

Skipped in Spring 2014

Skip Forward:

Page 21: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 21

© Leong Hon Wai, 2003-2013

Recognition Tasks: Human

q Neuron – a cell in human brain; capable of: v  Receiving stimuli from other neurons

through its dendrites v  Sending stimuli to other neurons thru’ its axon

A Neuron

Skipped in Spring 2014

Page 22: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 22

© Leong Hon Wai, 2003-2013

Human Neurons: How they work

q Each neuron v  Sums up activating and inhibiting stimuli

it received – call the sum V v  If the sum V equals or exceeds its

“threshold” value, then neuron sends out its own signal (through its axon) [fires]

q Each neuron can be thought out as an extremely simple computational device with a single on/off output;

Skipped in Spring 2013

Page 23: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 23

© Leong Hon Wai, 2003-2013

Recognition Tasks (continued)

q Human brain: a connectionist architecture

v  A large number of simple “processors” with multiple interconnections

q Von Neumann architecture

v  A small number (maybe only one) of very powerful processors with a limited number of interconnections between them

Skipped in Spring 2013

Page 24: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 24

© Leong Hon Wai, 2003-2013

Recognition Tasks (continued)

q Artificial neural networks (neural networks) v  Simulate individual neurons in hardware v  Connect them in a massively parallel network

of simple devices that act somewhat like biological neurons

q The effect of a neural network may be simulated in software on a sequential-processing computer

Skipped in Spring 2013

Page 25: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 25

© Leong Hon Wai, 2003-2013

Modeling a single neuron

q An artificial neuron v  Each neuron has a threshold value v  Input lines carry weights that represent stimuli v  The neuron fires when the sum of the incoming

weights equals or exceeds its threshold value

Skipped in Spring 2013

Page 26: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 26

© Leong Hon Wai, 2003-2013

Figure 14.5: One Neuron with Three Inputs

q When can the output be 1? (neuron “fire”) q Can you modify the network and keep the

same functionality?

Operation of 1 neuron. Skipped in Spring 2013

Page 27: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 27

© Leong Hon Wai, 2003-2013

q When can the output be 1? (neuron “fire”) q Can you draw a table for “x1 x2 Output”

An OR gate (using ANN)

Figure 14.7 A simple neural network

Skipped in Spring 2013

Page 28: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 28

© Leong Hon Wai, 2003-2013

Figure 14.8. The Truth Table for XOR

q Question: Can a simple NN be built to represent the XOR gate?

What about XOR gate? Skipped in Spring 2013

Page 29: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 29

© Leong Hon Wai, 2003-2013

More Simple Neural Networks

Your HW: Give the “truth table” for these NN;

Skipped in Spring 2013

Page 30: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 30

© Leong Hon Wai, 2003-2013

Recognition Tasks (continued) q ANN (sample)

Skipped in Spring 2013

Page 31: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 31

© Leong Hon Wai, 2003-2013

Neural Network – with Learning

Real Neural Networks: •  Uses back-propagation technique to

train the NN;

•  After training, NN used for character recognition;

•  Read [SG] for more details.

Skipped in Spring 2013

Page 32: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 32

© Leong Hon Wai, 2003-2013

NN (continued)

Some Success stories…

q NN successfully used for small-scale license plate recognition – of trucks at PSA gates;

q Between 2003-2006, NN also used for recognizing license plates at NUS carpark entrances.

Skipped in Spring 2013

Page 33: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 33

© Leong Hon Wai, 2003-2013

Recognition Tasks (summary)

q Neural network

v  Both the knowledge representation and “programming” are stored as weights of the connections and thresholds of the neurons

v  The network can learn from experience by modifying the weights on its connections

Skipped in Spring 2013

Page 34: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 34

© Leong Hon Wai, 2003-2013

Artificial Intelligence Contents:

v  Different Types of Tasks v  Knowledge Representation v  Recognition Tasks v Reasoning Tasks

◆  Intelligent Search ◆  Intelligent Agents ◆  Knowledge-Based Systems

Page 35: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 35

© Leong Hon Wai, 2003-2013

Reasoning Tasks

q Human reasoning requires the ability to draw on a large body of facts and past experience to come to a conclusion

q Artificial intelligence specialists try to get computers to emulate this characteristic

Related Story: Bill Gates and Pancake Flipping

Page 36: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 36

© Leong Hon Wai, 2003-2013

Intelligent Search Example (Ch. 14.5.1)

q Solving a Puzzle (the 9-Puzzle) q Involves

v  Planning v  Learning from past experience

q Simulated/Modelling by v  Searching a State-graph

q State Graph can be Very BIG v  Searching for “Goal State” v  How to guide the search to make it more

efficient.

Page 37: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 37

© Leong Hon Wai, 2003-2013

State Graph for 8-Puzzle

Page 38: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 38

© Leong Hon Wai, 2003-2013

Intelligent Searching q State-space graph:

v  After any one node has been searched, there are a huge number of next choices to try

v  There is no algorithm to dictate the next choice

q State-space search v  Finds a solution path through a state-space

graph

Page 39: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 39

© Leong Hon Wai, 2003-2013

The Search Tree for the 9-Puzzle

Page 40: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 40

© Leong Hon Wai, 2003-2013

Search Strategy for 9-Puzzle

Page 41: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 41

© Leong Hon Wai, 2003-2013

Figure 14.12 A State-Space Graph with Exponential Growth

Page 42: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 42

© Leong Hon Wai, 2003-2013

AI in Game Playing

Page 43: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 43

© Leong Hon Wai, 2003-2013

Intelligent Searching (continued)

q Each node represents a problem state q Goal state: the state we are trying to reach q  Intelligent searching applies some heuristic (or

an educated guess) to: v  Evaluate the differences between the present

state and the goal state v  Move to a new state that minimizes those

differences

Page 44: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 44

© Leong Hon Wai, 2003-2013

Intelligent State Space search…

q See notes (pdf) for concrete example

Some Success stories… q AI in chess playing – Deep Blue (1997)

v  Deep Blue evaluate 200M positions/sec, or 50B positions in 3min

q Other games: Othello, checkers, etc

Page 45: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 45

© Leong Hon Wai, 2003-2013

Swarm Intelligence (Ch. 14.5.2)

q Swarm intelligence v  Models the behavior of a colony of ants

q  Model with simple agents that: v  Operate independently v  Can sense certain aspects of their environment v  Can change their environment v  May “evolve” and acquire additional capabilities

over time

Skipped in Spring 2013

Page 46: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 46

© Leong Hon Wai, 2003-2013

Intelligent Agents (Ch. 14.5.3)

q An intelligent agent: software that interacts collaboratively with a user

q  Initially, an intelligent agent v  simply follows user commands

q Over time, the intelligent agent v  initiates communication, takes action, and performs

tasks on its own v  using its knowledge of the user’s needs and preferences

Skipped in Spring 2013

Page 47: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 47

© Leong Hon Wai, 2003-2013

Intelligent Agents (where used)

q Wizards (assistants) for Office Software q Personalized Web Search Engines

v  Push info, news, advertisements etc

Skipped in Spring 2013

Page 48: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 48

© Leong Hon Wai, 2003-2013

Expert Systems (Ch. 14.5.4)

q Rule-based systems v  Also called expert systems or knowledge-

based systems

v  Attempt to mimic the human ability to engage pertinent facts and combine them in a logical way to reach some conclusion

q Read also Sect 9.4.2 of [SG2/3] (Logic Programming)

Page 49: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 49

© Leong Hon Wai, 2003-2013

Expert Systems (continued) q A rule-based system must contain

v  A knowledge base: set of facts about subject matter

v  An inference engine: mechanism for selecting relevant facts and for reasoning from them in a logical way

q Many rule-based systems also contain v  An explanation facility: allows user to see

assertions and rules used in arriving at a conclusion

Page 50: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 50

© Leong Hon Wai, 2003-2013

Expert Systems (continued)

q A fact can be

v  A simple assertion

v  A rule: a statement of the form if . . . then . . .

q Modus ponens (method of assertion)

v  The reasoning process used by the inference engine

Page 51: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 51

© Leong Hon Wai, 2003-2013

Knowledge Based System:

Page 52: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 52

© Leong Hon Wai, 2003-2013

Knowledge-Based System…

Page 53: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 53

© Leong Hon Wai, 2003-2013

Expert Systems (continued) q  Inference engines can proceed through

v  Forward chaining

v  Backward chaining

q Forward chaining

v  Begins with assertions and tries to match those assertions to “if” clauses of rules, thereby generating new assertions

Page 54: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 54

© Leong Hon Wai, 2003-2013

Expert Systems (continued) q Backward chaining

v  Begins with a proposed conclusion

◆ Tries to match it with the “then” clauses of rules

v  Then looks at the corresponding “if” clauses

◆ Tries to match those with assertions, or with the “then” clauses of other rules

Page 55: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 55

© Leong Hon Wai, 2003-2013

Expert Systems (continued) q A rule-based system is built through a

process called knowledge engineering

v  Builder of system acquires information for knowledge base from experts in the domain

Page 56: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 56

© Leong Hon Wai, 2003-2013

Expert Systems: Structure

Page 57: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 57

© Leong Hon Wai, 2003-2013

Expert Systems: Rules

Page 58: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 58

© Leong Hon Wai, 2003-2013

Summary q Artificial intelligence explores techniques

for incorporating aspects of intelligence into computer systems

q Categories of tasks: computational tasks, recognition tasks, reasoning tasks

q Neural networks simulate individual neurons in hardware and connect them in a massively parallel network

Page 59: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 59

© Leong Hon Wai, 2003-2013

Summary q Swarm intelligence models the behavior of

a colony of ants

q An intelligent agent interacts collaboratively with a user

q Rule-based systems attempt to mimic the human ability to engage pertinent facts and combine them in a logical way to reach some conclusion

Page 60: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

LeongHW, SoC, NUS (UIT2201: AI) Page 60

© Leong Hon Wai, 2003-2013

Page 61: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

61

Did you know that …

Bill Gates [比尔 盖茨] , Microsoft

I used to flip

pancakes.

Page 62: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

62

Did Bill Gates really flip pancakes? Given an initial pancake configuration... You want to get a “sorted” configuration … Constraints: can only flip … (using a spatula)

Example …

Bill Gates & Christos Papadimitriou:, “Bounds For Sorting By Prefix Reversal.” Discrete Mathematics, Vol 27, pp 47-57, 1979.

Source: Neil Jones and Pavel Pevzner, 2004 “Introduction to BioInformatics Algorithms”.

Page 63: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

Pancake Flipping Problem…

Listen to the Story… (as told on NPR National Public

Radio)

http://www.npr.org/templates/story/story.php?storyId=92236781

Page 64: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

64

More pancake-flipping examples…

Abstraction skills, Problem Solving skills

2 flips

3 flips

? flips

Need a systematic approach…

an algorithm!

Page 65: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

65

Unsorted

Sorted

Largest unsorted

An Initial Algorithm (Greedy)

Simple Idea: “Sort” the biggest unsorted pancake first…

Greedy Algorithm: Repeatedly “sort” the biggest pancake;

5 flips

Page 66: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

Pancake Flipping Problem…

Lets have some FUN doing

pancake flipping

http://www.cut-the-knot.org/SimpleGames/Flipper.shtml

Page 67: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

67

A Counter Example: Greedy method [5 flips]

Better way [3 flips]

Is Greedy “the best” possible? Answer: NO

Question: Design an algorithm that solve the pancake flipping Problems using the minimum number of flips.

Page 68: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

Pancake Flipping Problem…

Sometimes, it is good to look from another perspective!

Page 69: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

69

A Different Perspective: The Solution Space…

Pertinent Question: How many different configurations are there? Answer:

Page 70: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

70

A Different Perspective: The Solution Space…

Connect two configurations iff reachable via one flip

Page 71: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

71

A Search Tree Method: (systematically search the search space)

Want a smart method (algorithm) to search this space to find the optimal flipping solution.

Page 72: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

Pancake Flipping Problem…

What do we now know about

Pancake Flipping?

Page 73: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

Pancake Flipping Problem: Known Results

•  Greedy Algorithm uses at most 2n-3 flips

•  For n pancakes, at most 5n/3 flips are needed [Bill Gates and Papadimitriou, 1979] ~1.666n

•  2008 (almost 30 years later), at most 18n/11 needed [a team from UT-Dallas, 2008] ~1.6363n

73

Page 74: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

More on Pancake Flipping

Have some fun with pancake flipping: http://www.cut-the-knot.org/SimpleGames/Flipper.shtml Listen to the story: http://www.npr.org/templates/story/story.php?storyId=92236781

Search more with your “private investigator”:

74

Page 75: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

Pancake Flipping Problem…

Why do we study Pancake Flipping?

Page 76: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

76

Why study pancake flipping

•  Mathematics – Study its properties –  define f(n) to be the min. of number of flip for n pancakes

•  Computing – Want an algorithm to solve it –  solve it with minimum number of flips

•  Applications

–  sorting by prefix reversal –  used to study evolution of species in biology

Page 77: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

77

Application of Sorting by Reversals

Important Application in Computational Biology: Used to study the evolution from one species to another.

Page 78: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

78

Sorting by Reversals used here…

Question: Is human closer to mouse or rat?

Page 79: Artificial Intelligenceleonghw/uit2201/Fa... · " Reasoning: Intelligent Search, Expert Systems ! Parts of Ch. 14 covered ... State-space search " Finds a solution path through a

79

Relevant Skills and Courses

•  Pancake flipping is a model for –  sorting by prefix-reversals

•  Many CS problems are model in similar ways –  sending files over internet (routing problems) –  time table scheduling (graph colouring, 图着⾊色问题)

•  Courses to learn these things –  CS1231 (Discrete Mathematics, 离散数学) [Blogs: 1, 2,] –  CS3230 (Analysis of Algorithms, 算法设计与分析)