Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

CS: Introduction to Artificial Intelligence - Russell and Norvig Solutions, Exams of Artificial Intelligence

The solutions to various problems in the 'introduction to artificial intelligence' book by stuart russell and peter norvig. Topics covered include logic, planning and mdps, probabilistic inference, vision, robotics, and learning.

Typology: Exams

2012/2013

Uploaded on 04/02/2013

shalin_p01ic
shalin_p01ic 🇮🇳

4

(7)

86 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 188 Introduction to AI
Fall 1999 Stuart Russell
Final solutions
1. (10 pts.) True/False
(a) (2) False; a feedforward network has no internal state and hence no memory.
(b) (2) True; both return the \leftmost" among the shallowest solutions.
(c) (2) True; although the solution to an MDP is a policy rather than just the solution path returned by A*, the
rest of the policy besides the solution path is irrelevant b ecause those states are never reached.
(d) (2) True; a neural net with enough hidden nodes can represent any Boolean function.
(e) (2) False; the entailment is the other way.
2. (18 pts.) Logic
True/false
:
(a) (3) True; otherwise we can assign each distinct literal to be false and falsify the clause.
(b) (3) False;
Q
(
w; A
) could only resolve against the negative literal
:
Q
(
x; F
(
x
)), leaving a positive literal.
(c) (4) True;
C
1
j
=
C
1
for any
; if
C
1
C
2
then
C
1
j
=
C
2
, by the semantics of disjunction.
(d) (4) False; the dreaded
9
:::
)
:::
.
(e) (4) True; the search tree is linear and nite, and resolution is complete.
3. (14 pts.) Planning and MDPs
(a) (2)
Op
(
Action:
T urnOn
(
b
)
;
Precond:
Of f
(
b
)
;
Effect:
On
(
b
)
Op
(
Action:
T urnOff
(
b
)
;
Precond:
On
(
b
)
;
Effect:
Of f
(
b
)
(b) (2) Start with postconditions
Of f
(1),
Of f
(2),
Of f
(3) and End with preconditions
On
(2) and
On
(3).
(c) (5) The open conditions are
On
(2) and
On
(3). These are not achieved by Start so a new step must be added.
T urnOn
(2) and
T urnOn
(3) are added with preconditions
Of f
(2) and
Of f
(3). These are achieved by causal
links from Start.
(d) (4) An MDP requires the following:
states
are all 8 settings of the three bits;
actions
are all applicable
T urnOn
and
T urnOff
actions in each state (3 actions per state but the 2 goal states are absorbing);
rewards
are +ve (say +1) for goal states, -ve for others to ensure shortest solution;
transition model
is deterministic:
T urnon
(
b
) turns the bit
b
on with probability 1 where applicable.
(e) (1) Just need to remember a p olicy for
all
states: if bit 2 is o, turn it on; if bit 3 is o, turn it on.
4. (16 pts.) Probabilistic inference
(a) (3) (ii) is asserted, by the local semantics of BNs: a no de is conditionally independent of its nondescendants
given its parents. (i) is not asserted since H and S are linked by an arc. (iii) is not asserted by the structure
alone, because arcs do not
deny
independence. (The CPTs can deny it, however.)
(b) (3)
P
(
h; s;
:
p;
:
e
) =
P
(
h
)
P
(
s
j
h
)
P
(
:
p
j
h; s
)
P
(
:
e
j:
p
) = 0
:
1
0
:
3
0
:
1
0
:
9 = 0
:
00027
(c) (4) Probably the simplest way to do this is to construct the part of the full joint for
H
true (8 rows) and
then add up. The following is the enumeration algorithm:
P
(
E
j
h
) =
P
(
h
)
X
sP
(
s
j
h
)
X
pP
(
p
j
h; s
)
P
(
E
j
p
)
=
0
:
1[0
:
3
(0
:
9
h
0
:
6
;
0
:
4
i
+ 0
:
1
h
0
:
1
;
0
:
9
i
) + 0
:
7
(0
:
5
h
0
:
6
;
0
:
4
i
+ 0
:
5
h
0
:
1
;
0
:
9
i
)] =
h
0
:
41
;
0
:
59
i
(d) (6) Let's assume honesty doesn't inuence fundraising ability, but slickness does. Funds support advertising
which increases popularity, but do not directly aect electability otherwise. So
L
should be a child of
S
and
parent of
P
. We would need a CPT for
P
(
L
j
S
) and an augmented CPT
P
(
P
j
H; S; L
). Any CPTs refelcting
the abovementioned inuences will do.
5. (10 pts.) Vision
(a) (4) (i) A appears bigger and cars are usually roughly similar in size; (ii) since A and B are both on the same
horizontal plane and B appears
above
A, it
must
be further away.
1
pf2

Partial preview of the text

Download CS: Introduction to Artificial Intelligence - Russell and Norvig Solutions and more Exams Artificial Intelligence in PDF only on Docsity!

CS 188 Intro duction to AI

Fall 1999 Stuart Russell Final solutions

  1. (10 pts.) True/False

(a) (2) False; a feedforward network has no internal state and hence no memory. (b) (2) True; b oth return the \leftmost" among the shallowest solutions. (c) (2) True; although the solution to an MDP is a p olicy rather than just the solution path returned by A*, the rest of the p olicy b esides the solution path is irrelevant b ecause those states are never reached. (d) (2) True; a neural net with enough hidden no des can represent any Bo olean function. (e) (2) False; the entailment is the other way.

  1. (18 pts.) Logic True/false:

(a) (3) True; otherwise we can assign each distinct literal to b e false and falsify the clause. (b) (3) False; Q(w ; A) could only resolve against the negative literal :Q(x; F (x)), leaving a p ositive literal. (c) (4) True; C 1 j= C 1  for any  ; if C 1   C 2 then C 1  j= C 2 , by the semantics of disjunction. (d) (4) False; the dreaded 9 : : : ) : : :. (e) (4) True; the search tree is linear and nite, and resolution is complete.

  1. (14 pts.) Planning and MDPs

(a) (2) O^ p(Action:T^ ur^ nO^ n(b);^ Precond:O^ f^ f^ (b);^ Effect:O^ n(b)^ O^ p(Action:T^ ur^ nO^ f^ f^ (b);^ Precond:^ O^ n(b);^ Effect:O (b) (2) Start with p ostconditions O f f (1), O f f (2), O f f (3) and End with preconditions O n(2) and O n(3). (c) (5) The op en conditions are O n(2) and O n(3). These are not achieved by Start so a new step must b e added. T ur nO n(2) and T ur nO n(3) are added with preconditions O f f (2) and O f f (3). These are achieved by causal links from Start. (d) (4) An MDP requires the following: states are all 8 settings of the three bits; actions are all applicable T ur nO n and T ur nO f f actions in each state (3 actions p er state but the 2 goal states are absorbing); rewards are +ve (say +1) for goal states, -ve for others to ensure shortest solution; transition mo del is deterministic: T ur non(b) turns the bit b on with probability 1 where applicable. (e) (1) Just need to rememb er a p olicy for al l states: if bit 2 is o , turn it on; if bit 3 is o , turn it on.

  1. (16 pts.) Probabilistic inference

(a) (3) (ii) is asserted, by the lo cal semantics of BNs: a no de is conditionally indep endent of its nondescendants given its parents. (i) is not asserted since H and S are linked by an arc. (iii) is not asserted by the structure alone, b ecause arcs do not deny indep endence. (The CPTs can deny it, however.) (b) (3) P (h; s; :p; :e) = P (h)P (sjh)P (:pjh; s)P (:ej:p) = 0 : 1  0 : 3  0 : 1  0 : 9 = 0 : 00027 (c) (4) Probably the simplest way to do this is to construct the part of the full joint for H true (8 rows) and then add up. The following is the enumeration algorithm:

P (E jh) = P (h)

X

sP (sjh)

X

pP (pjh; s)P (E jp)

= 0 :1[0: 3  (0: 9 h 0 : 6 ; 0 : 4 i + 0 : 1 h 0 : 1 ; 0 : 9 i) + 0 : 7  (0: 5 h 0 : 6 ; 0 : 4 i + 0 : 5 h 0 : 1 ; 0 : 9 i)] = h 0 : 41 ; 0 : 59 i

(d) (6) Let's assume honesty do esn't in uence fundraising ability, but slickness do es. Funds supp ort advertising which increases p opularity, but do not directly a ect electability otherwise. So L should b e a child of S and parent of P. We would need a CPT for P (LjS ) and an augmented CPT P (P jH ; S; L). Any CPTs refelcting the ab ovementioned in uences will do.

  1. (10 pts.) Vision

(a) (4) (i) A app ears bigger and cars are usually roughly similar in size; (ii) since A and B are b oth on the same horizontal plane and B app ears above A, it must b e further away.

(b) (6) A, B, C can b e viewed in stereo and hence their depths can b e measured, allowing the viewer to determine that B is nearest, A and C are equidistant and slightly further away. Neither D nor E can b e seen by b oth cameras, so stereo cannot b e used. However, b ecause the b ottle occludes D from Y and E from X, D and E must b e further away than A, B, C, but their relative depths cannot b e determined.

  1. (12+7 pts.) Rob otics

(a) (7) See Fig. 1(a). (b) (7 extra credit) See Fig. 1(b). Boundaries are lo ci of arm{obstacle contact, e.g.: { End of arm against left wall: x = cos  ) b oundary 1. { End of arm against top barrier: 2 x = cos  for  2 [ = 6 ;  =2] ) b oundary 2. { Side of arm against top do orp ost: 2 x = 0 : 5 cot  for  2 [ = 6 ;  =2] ) b oundary 3. (c) (5) An ideal rob ot could move to x = 1, rotate to  = 0, move to x = 3, rotate to  =  =2. Any real rob ot would either err on the x = 1, so that the rotation sticks against the left wall or the barrier, or it err on  = 0, so that the slide to x = 3 would jam the arm against the barrier. The solution is to use force feedback: move to 1 < x < 2; rotate until contact with the barrier; move in x direction while rotating to maintain sliding contact with barrier until contact is lost (or contact on the opp osite side of the arm). Now the arm is in the do orway: slide to x > 3 maintaining contact with lower do orp ost; as so on as this is lost, rotate to  =  =2, slide until motion stopp ed by wall.

  1. (20 pts.) Learning A 1{decision list or 1-DL is a decision tree with Bo olean inputs in which at least one branch from every attribute test leads immediately to a leaf (obviously the nal test leads to two leaves).

(a) (3) Linear tree with attributes a 1 , a 2 , a 3 ; leaves are T, T, T, F. (b) (3) Need to sp ecify 4 weights. By symmetry, w 1 , w 2 , w 3 are the same; say 2. The \lowest" input requiring +1 output is (say) +1, {1, {1, giving a weighted sum of {2. The input requiring output of {1 is {1, {1, {1, giving a weighted sum of {6. Hence a weight w 0 = 4 nicely separates the +ve and -ve cases. (c) (6) Intuitively, the ro ot of the decision list is the most imp ortant, so has the highest weight. If a true attribute requires a false output, then its weight must b e negative. Hence A=3, B=2, C=1. (d) (5) (i) Perceptron learning converges when the data can b e represented by the p erceptron (see b o ok). (ii) For any DL, there is an equivalent p erceptron? Generalizing from the examples in part (c): Essentially, the k th attribute (out of n) along the DL has a weight of  2 nk^ +1^ , and its sign is determined by the parity of the asso ciated leaf. Then the bias weight w 0 is set so as to give the right answer for the nal leaf; this can always b e done. (e) (3) A decision tree can represent any Bo olean function including XOR. Perceptrons cannot represent XOR.

-1.

-0.

0

1

2

0 0.5 1 1.5 2 2.5 3 3.5 4

theta

x

-1.

-0.

0

1

2

0 0.5 1 1.5 2 2.5 3 3.5 4

theta

x (a) (b)

Fig. 1: C-spaces for 6(a) and (b).