Bayesian networks in Mastermind
Jiˇ r´ ı Vomlel
http://www.utia.cas.cz/vomlel/
1
Bayesian networks in Mastermind Ji r Vomlel - - PowerPoint PPT Presentation
Bayesian networks in Mastermind Ji r Vomlel http://www.utia.cas.cz/vomlel/ 1 Contents Bayesian networks, tasks solved by them, and the junction tree propagation. An application of BNs - adaptive testing The game of
http://www.utia.cas.cz/vomlel/
1
propagation.
2
X1 X2 P(X1) P(X2) P(X3 | X1) P(X4 | X2) P(X6 | X3, X4) P(X9 | X6) P(X8 | X7, X6) P(X5 | X1) P(X7 | X5) X5 X7 X3 X8 X6 X9 X4
P(X1, . . . , X9) =
=
P(X9|X8, . . . , X1) · P(X8|X7, . . . , X1) · . . . · P(X2|X1) · P(X1)
=
P(X9|X6) · P(X8|X7, X6) · P(X7|X5) · P(X6|X4, X3)
·P(X5|X1) · P(X4|X2) · P(X3|X1) · P(X2) · P(X1)
3
probability distributions, e.g., P(X23|X17 = yes, X54 = no).
uncertainty.
4
Bayesian networks: junction tree propagation
(1) (3) (2) (4)
X9 X1 X1, X3, X5 X3, X5, X7 X6, X7, X8 X2, X4 X3, X4, X6 X6, X9 X1 X7 X5 X3 X4 X2 X9 X8 X1 X5 X7 X8 X3 X4 X2 X6 X3, X6, X7 X5 X3 X4 X2 X6 X9 X8 X7 X6
5
A simple example of an adaptive test
Question of medium difficulty
Good knowledge
Difficult question Easy question
No knowledge Low knowledge Medium knowledge
wrong answer correct answer wrong answer wrong answer correct answer correct answer 6
The game of Mastermind
Tj, Hj ... colors on the jth position in the guess and in the hidden
Pj
=
δ(Tj, Hj) P
=
4
j=1
Pj Ci
=
4
j=1
δ(Hj, i) Gi
=
4
j=1
δ(Tj, i) Mi
=
min(Ci, Gi) C
=
i=1
Mi
7
Probability over the codes
Q(H1, . . . , H4) ... the probability distribution over the possible codes. At the beginning of the game this distribution is uniform, i.e. Q(H1 = h1, . . . , H4 = h4)
=
1 64 = 1 1296 During the game we update probability Q(H1, . . . , H4) using the
Q(H1 = h1, . . . , H4 = h4 | e)
=
1 n(e)
if (h1, . . . , h4) is a possible code
where n(e) is the total number of codes that are possible candidates for the hidden code.
8
A measure of uncertainty - the Shannon entropy
A criteria suitable to measure the uncertainty about the hidden code is the Shannon entropy H(Q(H1, . . . , H4 | e))
=
h1,...,h4
Q(H1 = h1, . . . , H4 = h4 | e)
· log Q(H1 = h1, . . . , H4 = h4 | e)
, where 0 · log 0 is defined to be zero. Note that the Shannon entropy is zero if and only if the code is known.
9
Optimal Mastermind strategies
Different criteria:
minimal sum over all suggested sequences of length of a sequence × probability of this sequence Koyama, Lai (1993): A minimal strategy with 5625/1296 = 4.340 guesses.
minimal number of guesses in the worst case Koyama, Lai (1993): A different strategy with depth of 5 guesses.
minimal sum over all suggested sequences of entropy after a sequence × probability of this sequence
10
Bayesian network for the probabilistic Mastermind
P′ C P1 P2 P3 P4 P H1 C6 C5 C4 C3 C2 C1 M1 M2 C′ M3 H2 M4 M5 M6 G1 G2 G3 G4 G5 G6 T4 T3 T2 T1 H4 H3
11
Bayesian network after inserting evidence
M1 P M2 M3 M4 M5 M6 P3 P1 P4 C′ P2 C6 P′ C4 C5 C C3 C2 C1 H4 H3 H2 H1 H3 H4 C1 C2 C3 C5 C4 C6 P2 P4 P1 H2 C′
after moralization (before triangulation)
C P′ H1 P3 P M1 M2 M3 M4 M5 M6
12
Transformation by introducing an auxiliary variable to the model
Savicky, Vomlel (2004)
P M1 M2 C M3 M6 M4 M5
M3 P M4 M5 B M6 M1 M2 C
13
Bayesian network after the suggested transformation
H3 H4 C1 C2 C3 C5 C4 C6 B P2 C H2 P4 P M6 P1 M5 P3 M4 C′ M3 P′ H1 M2 M1
Junction tree size:
mation
> 20,526,445
tion 214,775
14
Summary
exploit functional dependences in the model.
computational demands.
15