Docsity

Heuristic Function - Introduction to Artificial Intelligence - Exams, Exams of Artificial Intelligence

Toggle sidebar
bg1
CS 188
Spring 2010 Introduction to
Artificial Intelligence Final Exam
INSTRUCTIONS
•You have 3 hours.
•The exam is closed book, closed notes except a two-page crib sheet.
•Please use non-programmable calculators only.
•Mark your answers ON THE EXAM ITSELF. If you are not sure of your answer you may wish to provide a
brief explanation. All short answer sections can be successfully answered in a few sentences AT MOST.
First name
Last name
SID
Login
For staff use only:
Q1. Search /14
Q2. Naive Bayes /15
Q3. Hidden Markov Models /15
Q4. Machine Learning /13
Q5. Markov Decision Processes /10
Q6. Short answer /33
Total /100
1
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Heuristic Function - Introduction to Artificial Intelligence - Exams and more Exams Artificial Intelligence in PDF only on Docsity!

CS 188

Spring 2010

Introduction to

Artificial Intelligence Final Exam

INSTRUCTIONS

  • You have 3 hours.
  • The exam is closed book, closed notes except a two-page crib sheet.
  • Please use non-programmable calculators only.
  • Mark your answers ON THE EXAM ITSELF. If you are not sure of your answer you may wish to provide a brief explanation. All short answer sections can be successfully answered in a few sentences AT MOST.

First name

Last name

SID

Login

For staff use only:

Q1. Search /

Q2. Naive Bayes /

Q3. Hidden Markov Models /

Q4. Machine Learning /

Q5. Markov Decision Processes /

Q6. Short answer /

Total /

Q1. [14 pts] Search

For the following questions, please choose the best answer (only one answer per question). Assume a finite search space.

(a) [2 pts] Depth-first search can be made to return the same solution as breadth-first search using:

(i) Iterative Deepening (ii) A closed list/list of nodes that have been expanded (iii) A heuristic function (iv) This is not possible

(b) [2 pts] A∗^ search can be made to perform a breadth-first search by setting (fill in correct values):

  1. for all nodes, heuristic =
  2. for all nodes, edgecost =

(c) [2 pts] You run A∗^ search using a heuristic function which you know to be admissible and consistent. Your friend claims he has a search algorithm that is guaranteed to not expand more nodes than your algorithm (and in fact often expands far fewer in practice). He also tells you that his algorithm is guaranteed to find the optimal path. Could the algorithm your friend claims to have exist? (circle one): yes no Explain:

(d) [2 pts] Depth first search using a closed list/list of nodes that have been expanded is:

(i) Optimal (will find a shortest path to goal) (ii) Complete (will find a path to goal if at least one exists) (iii) Both optimal and complete (iv) Neither optimal nor complete

Q2. [15 pts] Naive Bayes

Your friend claims that he can write an effective Naive Bayes spam detector with only three features: the hour of the day that the email was received (H ∈ { 1 , 2 ,... , 24 }), whether it contains the word ‘viagra’ (W ∈ {yes, no}), and whether the email address of the sender is Known in his address book, Seen before in his inbox, or Unseen before (E ∈ {K, S, U}).

(a) [3 pts] Flesh out the following information about this Bayes net:

Graph structure:

Parameters:

Size of the set of parameters:

Suppose now that you labeled three of the emails in your mailbox to test this idea:

spam or ham? H W E spam 3 yes S ham 14 no K ham 15 no K

(b) [2 pts] Use the three instances to estimate the maximum likelihood parameters.

(c) [2 pts] Using the maximum likelihood parameters, find the predicted class of a new datapoint with H = 3, W = no, E = U.

(d) [4 pts] Now use the three to estimating the parameter using Laplace smoothing and k = 2. Do not forget to smooth both the class prior parameters and the feature values parameters.

(e) [1 pt] Using the parameters obtained with Laplace smoothing, find the predicted class of a new datapoint with H = 3, W = no, E = U.

(f ) [3 pts] You observe that you tend to receive spam emails in batches. In particular, if you receive one spam message, the next message is more likely to be a spam message as well. Explain a new graphical model which most naturally captures this phenomena.

Graph structure:

Parameters:

Size of the set of parameters:

For the next two questions, use the specified sequence of random numbers {ai} generated independently and uniformly at random from [0, 1) to perform sampling. Specifically, to obtain a sample from a distribution over a variable Y ∈ { 0 , 1 } using the random number ai, pick Y = 0 if ai < Pr(Y = 0), and pick Y = 1 if ai ≥ Pr(Y = 0). Similarly, to obtain a sample from a distribution over a variable Z ∈ {A, B} using the random number ai, pick Z = A if ai < Pr(Z = A), and pick Z = B if ai ≥ Pr(Z = A). Use the random numbers {ai} in order starting from a 1 , using a new random number each time a sample needs to be obtained.

(c) [3 pts] Use likelihood-weighted sampling to obtain 2 samples from the distribution Pr(X 1 , X 2 |O 1 = A, O 2 = B), and then use these samples to estimate E[

X 1 + 3X 2 |O 1 = A, O 2 = B].

a 1 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9 a 10

  1. 134 0. 847 0. 764 0. 255 0. 495 0. 449 0. 652 0. 789 0. 094 0. 028

(d) [2 pts] [true or false] In general, particle filtering using a single particle is equivalent to rejection sampling in the case that there is no evidence. Explain your answer.

(e) [2 pts] [true or false] Performing particle filtering twice, each time with 50 particles, is equivalent to performing particle filtering once with 100 particles. Explain your answer.

(f ) [2 pts] [true or false] Variable elimination is generally more accurate than the Forward algorithm. Explain your answer.

Q4. [13 pts] Machine Learning

(a) [4 pts] Indicate which, if any, of the statements are correct, and explain your answer. Naive Bayes trained using maximum-likelihood parameter estimation

(i) is guaranteed not to perform worse if more features are added. (ii) generally performs better on the training set if add-k smoothing is used.

(b) [2 pts] For data points that are not normalized (normalized means that for all data vectors x, ||x|| = 1), we can implement nearest neighbor classification using the distance metric ||x − y|| defined between two data vectors x and y to determine the nearest neighbor of each test point. Given a kernel function K(x, y), describe how to implement a kernelized version of this algorithm. Hint: For a pair of vectors a and b, ||a − b||^2 = (a − b) · (a − b).

Q5. [10 pts] Markov Decision Processes

(a) In the standard MDP formulation, we define the utility of a state-action sequence to be the sum of discounted rewards obtained from that sequence, i.e.

U+(s 0 , a 0 , s 1 ,... , an, sn) =

n∑− 1

i=

γiR(si, ai, si+1),

and the goal is to obtain a policy that maximizes the expected utility of the resultant state sequence. Under this utility function, the optimal policy depends only on the current state and not on any previous states or actions. Suppose that we redefine the utility of a state-action sequence to be the maximum reward obtained from that sequence, i.e. Umax(s 0 , a 0 , s 1 ,... , an, sn) = n− 1 max i= R(si, ai, si+1).

We still wish to obtain a policy that maximizes the expected utility of the resultant state sequence. (i) [3 pts] Show by way of a counter-example that with this modified utility function, the optimal policy does not depend only on the current state.

(ii) [7 pts] Suppose you are given an arbitrary MDP M = (S, A, T, R) with the modified utility function Umax, where S denotes the state set, A denotes the action set, T (s, a, s′) denotes the transition probability function, and R(s, a, s′) denotes the reward function. Define a corresponding MDP M ′^ = (S′, A′, T ′, R′, γ′) with the property that the optimal policy for M ′^ under the standard utility function U+ specifies the optimal policy for M under the modified utility function Umax. S′^ =

A′^ =

Transition function:

Reward function:

γ′^ =

Q6. [33 pts] Short answer

Each true/false question is worth 1 point. Leaving a question blank is worth 0 points. Answering incorrectly is worth − 1 point.

(a) For a search problem, the path returned by uniform cost search may change if we (i) [true or false] rescale all step costs by a scalar α: 0 < α < 1. (ii) [true or false] rescale all step costs by a scalar α: 1 < α < 2. (iii) [true or false] add a positive constant C to every step cost.

(b) Assume we are running A∗^ graph search with a consistent heuristic h. Let p be the node in the fringe about to be expanded in the search. When expanding p, we find that exactly one of its children is the goal state G and the cost of the found path through p to G is K. Let pathcost(p) denote the cost of the path to p that led to p being inserted in the queue. Then we have that (i) [true or false] the found path through p to the goal is a shortest path. (ii) [true or false] the found path through p to the goal is guaranteed to be at most K − pathcost(p) longer than the shortest path. (iii) [true or false] the found path through p to the goal is guaranteed to be at most K − pathcost(p) − h(p) longer than the shortest path. (iv) [true or false] the found path through p to the goal is guaranteed to be the shortest path going through p to the goal state.

(c) Consider a zero-sum game adversarial game. The minimizer is played by a computer program that is fast enough to perform min-max search all the way to the end of the game and it plays according to the thus-found moves. It is the minimizer’s turn to play, and the minimizer’s computer program returns a win of some positive value for the minimizer. Then we have that (i) [true or false] the minimizer is guaranteed to win the game only if the maximizer also plays the min-max strategy. (ii) [true or false] the minimizer is guaranteed to win the game only if the maximizer plays a deterministic strategy. (iii) [true or false] if the minimizer were to use alpha-beta instead of min-max search then the game could still end up in a tie. (iv) [true or false] if the maximizer is known to make moves uniformly at random every other turn, then the minimizer is not necessarily maximizing pay-off.

(d) Jeremy, Jie, Woody and Alex all get to act in an MDP (S, A, T, γ, R, s 0 ). Jeremy runs value iteration until he finds V ∗^ which satisfies ∀s ∈ S : V ∗(s) = maxa∈A

s′^ T^ (s, a, s

′)(R(s, a, s′) + γV ∗(s′)) and acts according to πJeremy = arg maxa∈A

s′^ T^ (s, a, s

′)(R(s, a, s′) + γV ∗(s′)). Jie acts according to an arbitrary policy πJie. Woody takes Jie’s policy πJie and runs one round of policy iteration to find his policy πWoody. Alex takes Jeremy’s policy and runs one round of policy iteration to find his policy πAlex. Then we have that (i) [true or false] there are MDP’s in which Jie would outperform Woody. (ii) [true or false] there are MDP’s in which Woody would outperform Alex. (iii) [true or false] there are MDP’s in which Alex would outperform Jeremy. (iv) [true or false] there are MDP’s in which Jeremy would outperform Alex. (v) [true or false] there are MDP’s in which Jie would outperform Jeremy.

(e) Bob notices value iteration converges more quickly with smaller γ and rather than using the true discount factor γ, he decides to use a discount factor of αγ with 0 < α < 1when running value iteration. Then we have that (i) [true or false] while Bob will not find the optimal value function, he could simply rescale the values he finds by 11 −−αγ to find the optimal value function.