midterm review dr. bernard chen ph.d. university of central arkansas spring 2011
TRANSCRIPT
![Page 1: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/1.jpg)
Midterm Review
Dr. Bernard Chen Ph.D.University of Central Arkansas
Spring 2011
![Page 2: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/2.jpg)
Outline
Ch3 Structures and Strategies for State Space Search
Ch4 Heuristic Search Ch5 Stochastic Search
![Page 3: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/3.jpg)
Introduction to Representation The representation function is to
capture the critical features of a problem and make that information accessible to a problem solving procedure
Expressiveness (the result of the feature abstracted) and efficiency (the computational complexity) are major dimensions for evaluating knowledge representation
![Page 4: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/4.jpg)
Introduction to Search Given a representation, the second
component of intelligent problem solving is search
Human generally consider a number of alternatives strategies on their way to solve a problem Such as chess Player reviews alternative moves, select the
“best” move A player can also consider a short term gain
![Page 5: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/5.jpg)
Introduction to Search We can represent this collection of
possible moves by regarding each board as a state in a graph
The link of the graph represent legal move
The resulting structure is a state space graph
![Page 6: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/6.jpg)
“tic-tac-toe” state space graph
![Page 7: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/7.jpg)
State Space Representation
State space search characterizes problem solving as the process of finding a solution path form the start state to a goal
A goal may describe a state, such as winning board in tic-tac-toe
![Page 8: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/8.jpg)
State Space Representation
A goal in configuration in the 8-puzzle
![Page 9: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/9.jpg)
State Space Representation
The Traveling salesperson problem Suppose a salesperson has five cities to visit and
then must return home The goal of the problem is to find the shortest path
for the salesperson to travel
![Page 10: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/10.jpg)
State Space Representation
![Page 11: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/11.jpg)
BFS and DFS In addition to specifying a search
direction (data-driven or goal-driven), a search algorithm must determine the order in which states are examined in the graph
Two possibilities: Depth-first search Breadth-first search
![Page 12: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/12.jpg)
8-puzzle BFS
![Page 13: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/13.jpg)
8-puzzle DFS
![Page 14: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/14.jpg)
Outline
Ch3 Structures and Strategies for State Space Search
Ch4 Heuristic Search Ch5 Stochastic Search
![Page 15: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/15.jpg)
Introduction George Polya defines heuristic as:“the study of the methods and rules of discovery and
invention”
This meaning can be traced to the term’s Greek root, the verb eurisco, which means “I discover”
When Archimedes emerged from his famous bath clutching the golden crown, he shouted “Eureka!!”, meaning I have found it
IN AI, heuristics are formalized as Rules for choosing those branches in a state space that are most likely to lead to an acceptable problem solution
![Page 16: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/16.jpg)
Introduction Consider heuristic in the game of tic-tac-
toe A simple analysis put the total number of
states for 9! Symmetry reduction decrease the
search space Thus, there are not 9 but 3 initial moves:
to a corner to the center of a side to the center of the grid
![Page 17: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/17.jpg)
Introduction
![Page 18: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/18.jpg)
Introduction Use of symmetry on the second level
further reduces the number of path to 3* 12 * 7!
A simple heuristic, can almost eliminate search entirely: we may move to the state in which X has the most winning opportunity
In this case, X takes the center of the grid as the first step
![Page 19: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/19.jpg)
Introduction
![Page 20: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/20.jpg)
Introduction
![Page 21: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/21.jpg)
Hill-Climbing The simplest way to implement
heuristic search is through a procedure called hill-climbing
It expend the current state of the search and evaluate its children
The Best child is selected for further expansion
Neither it sibling nor its parent are retained
Tic-Tac-Toe we just saw is an example
![Page 22: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/22.jpg)
Dynamic Programming (DP) DP keeps track of and reuses of multiple
interacting and interrelated subproblems
An example might be reuse the subseries solutions within the solution of the Fibonacci series
The technique of subproblem caching for reuse is sometimes called memorizing partial subgoal solutions
![Page 23: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/23.jpg)
Dynamic Programming (DP)
_ B A A D D C A B D D A
_ 0 1 2 3 4 5 6 7 8 9 10 11
B 1 0 1 2 3 4 5 6 7 8 9 10
B 2 1 2 3 4 5 6 7 6 7 8 9
A 3 2 1 2 3 4 5 6 7 8 9 8
D 4 3 2 3 2 3 4 5 6 7 8 9
C 5 4 3 4 3 4 3 4 5 6 7 8
B 6 5 4 5 4 5 4 5 4 5 6 7
A 7 6 5 4 5 6 5 4 5 6 7 6
![Page 24: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/24.jpg)
Dynamic Programming (DP)
BAADDCABDDABBA_DC_B_ _A
![Page 25: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/25.jpg)
Best First Search
For the 8-puzzle game, we may add 3 different types of information into the code: The simplest heuristic counts the tiles
out of space in each state A “better” heuristic would sum all the
distances by which the tiles are out of space
![Page 26: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/26.jpg)
Best First Search
![Page 27: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/27.jpg)
Best First Search
![Page 28: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/28.jpg)
![Page 29: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/29.jpg)
Minimax Procedure on Exhaustively Search Graphs Let’s consider a variant of the game nim
To play this game, a number of tokens are placed on a table between the two players
At each move, the player must divide a pile of tokens into two nonempty piles of different sizes
Thus, 6 tokens my be divided into piles of 5&1 or 4&2 but not 3&3
The first player who can no longer make a move loses the game
![Page 30: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/30.jpg)
Minimax Procedure on Exhaustively Search Graphs
State space for a variant of nim. Each state partitions the seven matches into one or more piles.
![Page 31: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/31.jpg)
Minimax Procedure on Exhaustively Search Graphs
![Page 32: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/32.jpg)
Minimax Procedure on Exhaustively Search Graphs
Minimax propagates these values up the graph through successive parent nodes according to the rule: If the parent is a MAX node, give it
the maximum value among its children
If the parent is a MIN node, give it the minimum value among its children
![Page 33: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/33.jpg)
Minimax Procedure on Exhaustively Search Graphs
![Page 34: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/34.jpg)
Exercises
Perform MINIMAX on the tree shown in Figure 4.30.
![Page 35: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/35.jpg)
Exercises
![Page 36: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/36.jpg)
Exercises
Consider 3D tic-tac-toe. How to represent state search space? Analysis the complexity of the state
space? Propose a heuristic for playing this
game
![Page 37: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/37.jpg)
Outline
Ch3 Structures and Strategies for State Space Search
Ch4 Heuristic Search Ch5 Stochastic Search
![Page 38: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/38.jpg)
Bayes’ Theorem
P(A), P(B) is the prior probability P(A|B) is the conditional probability of A,
given B. P(B|A) is the conditional probability of B,
given A.
![Page 39: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/39.jpg)
Exercises Suppose an automobile insurance company classifies a
driver as good, average, or bad.
Of all their insured drivers, 25% are classified good, 50% are average, and 25% are bad.
Suppose for the coming year, a good driver has a 5% chance of having an accident, and average driver has 15% chance of having an accident, and a bad driver has a 25% chance.
If John had an accident in the past year what is the probability that John are a good driver?
![Page 40: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/40.jpg)
Exercises
![Page 41: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/41.jpg)
Naïve Bayesian Classifier: Training Dataset
Class:C1:buys_computer = ‘yes’C2:buys_computer = ‘no’
Data sample X = (age <=30,Income = medium,Student = yesCredit_rating = Fair)
age income studentcredit_ratingbuys_computer<=30 high no fair no<=30 high no excellent no31…40 high no fair yes>40 medium no fair yes>40 low yes fair yes>40 low yes excellent no31…40 low yes excellent yes<=30 medium no fair no<=30 low yes fair yes>40 medium yes fair yes<=30 medium yes excellent yes31…40 medium no excellent yes31…40 high yes fair yes>40 medium no excellent no
![Page 42: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/42.jpg)
Naïve Bayesian Classifier: An Example P(Ci): P(buys_computer = “yes”) = 9/14 = 0.643 P(buys_computer = “no”) = 5/14= 0.357
Compute P(X|Ci) for each class P(age = “<=30” | buys_computer = “yes”) = 2/9 = 0.222 P(age = “<= 30” | buys_computer = “no”) = 3/5 = 0.6 P(income = “medium” | buys_computer = “yes”) = 4/9 =
0.444 P(income = “medium” | buys_computer = “no”) = 2/5 = 0.4 P(student = “yes” | buys_computer = “yes) = 6/9 = 0.667 P(student = “yes” | buys_computer = “no”) = 1/5 = 0.2 P(credit_rating = “fair” | buys_computer = “yes”) = 6/9 =
0.667 P(credit_rating = “fair” | buys_computer = “no”) = 2/5 = 0.4
![Page 43: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/43.jpg)
Naïve Bayesian Classifier: An Example X = (age <= 30 , income = medium, student = yes,
credit_rating = fair)
P(X|Ci) :
P(X|buys_computer = “yes”) = 0.222 x 0.444 x 0.667 x 0.667 = 0.044 P(X|buys_computer = “no”) = 0.6 x 0.4 x 0.2 x 0.4 = 0.019
P(X|Ci)*P(Ci) : P(X|buys_computer = “yes”) * P(buys_computer = “yes”) = 0.028
P(X|buys_computer = “no”) * P(buys_computer = “no”) = 0.007
Therefore, X belongs to class (“buys_computer = yes”)
![Page 44: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/44.jpg)
Naïve Bayesian Classifier: An Example
Test on the following example:
X = (age > 30, Income = Low, Student = yes Credit_rating = Excellent)
![Page 45: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/45.jpg)
So how is “Tomato” pronounced
A probabilistic finite state acceptor for the pronunciation of “tomato”, adapted from Jurafsky and Martin (2000).
![Page 46: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/46.jpg)
Outline
Expert System introduction Rule-Based Expert System
Goal Driven Approach Data Driven Approach
Model-Based Expert System
![Page 47: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/47.jpg)
The Design of Rule-Based Expert System
• architecture of a typical expert system for a particular problem domain.
![Page 48: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/48.jpg)
Strategies for state space search In data driven search, also called forward
chaining, the problem solver begins with the given facts of the problem and set of legal moves for changing state
This process continues until (we hope!!) it generates a path that satisfies the goal condition
![Page 49: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/49.jpg)
Strategies for state space search An alternative approach (Goal Driven) is start with the
goal that we want to solve See what rules can generate this goal and determine
what conditions must be true to use them These conditions become the new goals Working backward through successive subgoals until
(we hope again!) it work back to
![Page 50: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/50.jpg)
A unreal Expert System Example Rule 1: if
the engine is getting gas, andthe engine will turn over,thenthe problem is spark plugs.
Rule 2: ifthe engine does not turn over, andthe lights do not come onthenthe problem is battery or cables.
Rule 3: ifthe engine does not turn over, andthe lights do come onthen the problem is the starter motor.
Rule 4: ifthere is gas in the fuel tank, andthere is gas in the carburetorthenthe engine is getting gas.
![Page 51: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/51.jpg)
The production system at the start of a consultation in the car diagnostic example.
![Page 52: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/52.jpg)
The production system after Rule 1 has fired.
![Page 53: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/53.jpg)
The system after Rule 4 has fired. Note the stack-based approach to goal reduction.
![Page 54: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/54.jpg)
The and/or graph searched in the car diagnosis example, with the conclusion of Rule 4 matching the first premise of Rule 1.
![Page 55: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/55.jpg)
Data-Driven Reasoning
![Page 56: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/56.jpg)
The production system after evaluating the first premise of Rule 2, which then fails.
![Page 57: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/57.jpg)
The data-driven production system after considering Rule 4, beginning its second pass through the rules.
![Page 58: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/58.jpg)
Model-Based Expert System A more robust, deeply explanatory
approach would begin with a detailed model of the physical structure of the circuit and equations describing the expected behavior of each component and their interactions.
A knowledge based reasoner whose analysis is founded directly on the specification and functionality of a physical system is called a MODEL-BASED System
![Page 59: Midterm Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011](https://reader030.vdocuments.us/reader030/viewer/2022033103/56649ccf5503460f9499a590/html5/thumbnails/59.jpg)
NASA Example