赞
踩
参考:
灭绝星辰_人工智能-清览作业2
HNU岳麓山大小姐_人工智能导论:清览作业
1.请用真值表的方法证明下列语句是有效的,可满足的,还是不可满足的?(20分)
P | Q | P∧Q | ¬Q | (P∧Q)∨¬Q |
---|---|---|---|---|
0 | 0 | 0 | 1 | 1 |
0 | 1 | 0 | 0 | 0 |
1 | 0 | 0 | 1 | 1 |
1 | 1 | 1 | 0 | 1 |
该语句在某一个模型中为真,为可满足的;
P | Q | R | P∧Q | (P∧Q)→R | P→R | Q→R | (P→R)∨(Q→R) | ((P∧Q)→R)↔((P→R)∨(Q→R)) |
---|---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 |
0 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 1 |
0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 |
0 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 |
1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 |
1 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 1 |
1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 |
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
该语句在所有模型中都为真,为有效的;
2.考虑下列的一阶逻辑表达式:
其中x,y,z,w,s,t是变量,a,b,c是常数。
a)讲1,2,3式子转换为CNF形式(9分)
b)从上述知识库(KB)中使用归结算法证明结论equal(c,a)。 (16分)
1式转换为CNF形式:equal(x,x)
2式转换为CNF形式:¬equal(y,z)∨equal(z,y)
3式转换为CNF形式:¬equal(w,s)∨¬equal(s,t) ∨equal(w,t)
原命题equal(c,a)得证;
ANSWER:
3.把下列表达式转换为CNF形式 (10分)
(∀x∀y∃z q(z,y,x)) →(¬∃x{ ∀y [p(x,y)→q(x,y)] })
4.考虑从一副标准的52张纸牌(不含大小王)中分发每手5张牌的扑克牌域。假设发牌人是公平的。
a)在联合概率分布中共有多少个原子事件(即,共有多少种5张手牌的组合)?(5分)
b)每个原子事件的概率是多少?(5分)
c)拿到大同花顺(即同花的A、K、Q、J、10)的概率是多少?(5分)
d)四同张(4张相同的牌,分别为4种花色)的概率是多少?(5分)
52张纸牌(不含大小王):
从52张不同的牌中取5张:
C
52
5
=
52
∗
51
∗
50
∗
49
∗
48
5
∗
4
∗
3
∗
2
∗
1
=
2598960
C^{5}_{52}= \frac {52*51*50*49*48} {5*4*3*2*1}=2598960
C525=5∗4∗3∗2∗152∗51∗50∗49∗48=2598960
从52张不同的牌中取到一个原子事件的概率:
P
1
=
1
C
52
5
=
1
52
∗
51
∗
50
∗
49
∗
48
5
∗
4
∗
3
∗
2
∗
1
=
1
2598960
P_{1}=\frac {1} {C^{5}_{52}}= \frac {1} {\frac {52*51*50*49*48} {5*4*3*2*1}}=\frac {1} {2598960}
P1=C5251=5∗4∗3∗2∗152∗51∗50∗49∗481=25989601
大同花顺包括四种原子事件:
全为黑桃/红桃/梅花/方块的A、K、Q、J、10
P
2
=
4
∗
P
1
=
4
2598960
=
1
649740
P_{2}=4*P_{1}=\frac {4} {2598960}=\frac {1} {649740}
P2=4∗P1=25989604=6497401
四同张包括13钟情况:
分别为黑桃、红桃、梅花、方块的1-10、K、Q、J;
组合中的另一张,从剩下的52-4=48张牌中任选一个,有48种情况:
P
3
=
13
∗
48
∗
P
1
=
13
∗
48
2598960
=
1
4165
P_{3}=13*48*P_{1}=\frac {13*48} {2598960}=\frac {1} {4165}
P3=13∗48∗P1=259896013∗48=41651
5. 参考下图中的贝叶斯网络,其中布尔变量I=聪明(intelligence) H=诚实(Honest) P=受欢迎的(Popular) L=大量的竞选资金 E=竞选成功
(a) 根据该网络结构,是否可以得到P(I,L,H)=P(I)P(L)P(H),如果不是,请给出正确的表达式; (6分)
(b)根据该网络结构计算P(i,h,¬l,p,¬e)的值,只有答案没有步骤不得分;(8分)
©假设已知某个人是诚实的,没有大量的竞选资金但是竞选成功了,那么他是聪明的概率是多少?只有答案没有过程不得分。(11分)
P ( I , L , H ) = P ( I ) P ( L , H ) = P ( I ) P ( L ∣ H ) P ( H ) P(I,L,H)=P(I)P(L,H) \\ =P(I) {P(L | H)} {P(H)} P(I,L,H)=P(I)P(L,H)=P(I)P(L∣H)P(H)
P
(
i
,
h
,
¬
l
,
p
,
¬
e
)
=
P
(
¬
e
∣
p
)
∗
P
(
p
∣
i
,
h
,
¬
l
)
∗
P
(
i
,
h
,
¬
l
)
=
P
(
¬
e
∣
p
)
∗
P
(
p
∣
i
,
h
,
¬
l
)
∗
P
(
i
)
∗
P
(
¬
l
∣
h
)
∗
P
(
h
)
P(i,h,¬l,p,¬e)=P(¬e | p)*P(p | i,h,¬l) * P(i,h,¬l) \\ =P(¬e | p)*P(p | i,h,¬l) * P(i) *P(¬l | h)* P(h)
P(i,h,¬l,p,¬e)=P(¬e∣p)∗P(p∣i,h,¬l)∗P(i,h,¬l)=P(¬e∣p)∗P(p∣i,h,¬l)∗P(i)∗P(¬l∣h)∗P(h)
由贝叶斯网络,得:
P
(
¬
e
∣
p
)
=
1
−
0.6
=
0.4
P
(
p
∣
i
,
h
,
¬
l
)
=
0.4
P
(
i
)
=
0.5
P
(
¬
l
∣
h
)
=
1
−
0.3
=
0.7
P
(
h
)
=
0.1
P(¬e | p)=1-0.6=0.4 \\ P(p | i,h,¬l)=0.4 \\ P(i) =0.5 \\ P(¬l | h)=1-0.3=0.7 \\ P(h)=0.1
P(¬e∣p)=1−0.6=0.4P(p∣i,h,¬l)=0.4P(i)=0.5P(¬l∣h)=1−0.3=0.7P(h)=0.1
代入,得:
P
(
i
,
h
,
¬
l
,
p
,
¬
e
)
=
0.4
∗
0.4
∗
0.5
∗
0.7
∗
0.1
=
0.0056
P(i,h,¬l,p,¬e)=0.4*0.4*0.5*0.7*0.1 \\ =0.0056
P(i,h,¬l,p,¬e)=0.4∗0.4∗0.5∗0.7∗0.1=0.0056
P
(
i
∣
h
,
¬
l
,
e
)
=
P
(
i
,
h
,
¬
l
,
e
)
P
(
h
,
¬
l
,
e
)
P(i|h,¬l,e)= \frac {P(i,h,¬l,e)} {P(h,¬l,e)}
P(i∣h,¬l,e)=P(h,¬l,e)P(i,h,¬l,e)
其中
P
(
i
,
h
,
¬
l
,
e
)
=
P
(
i
,
h
,
¬
l
,
p
,
e
)
+
P
(
i
,
h
,
¬
l
,
¬
p
,
e
)
P
(
i
,
h
,
¬
l
,
p
,
e
)
=
P
(
e
∣
p
)
∗
P
(
p
∣
i
,
h
,
¬
l
)
∗
P
(
i
)
∗
P
(
¬
l
∣
h
)
∗
P
(
h
)
=
0.6
∗
0.4
∗
0.5
∗
0.7
∗
0.1
=
0.0084
P
(
i
,
h
,
¬
l
,
¬
p
,
e
)
=
P
(
e
∣
¬
p
)
∗
P
(
¬
p
∣
i
,
h
,
¬
l
)
∗
P
(
i
)
∗
P
(
¬
l
∣
h
)
∗
P
(
h
)
=
0.1
∗
(
1
−
0.4
)
∗
0.5
∗
0.7
∗
0.1
=
0.0021
所以
P
(
i
,
h
,
¬
l
,
e
)
=
0.0084
+
0.0021
=
0.0105
P(i,h,¬l,e)=P(i,h,¬l,p,e)+P(i,h,¬l,¬p,e) \\ P(i,h,¬l,p,e)=P(e | p)*P(p | i,h,¬l) * P(i)*P(¬l | h)* P(h)\\ \space =0.6*0.4*0.5*0.7*0.1=0.0084 \\ P(i,h,¬l,¬p,e)=P(e | ¬p)*P(¬p | i,h,¬l) * P(i)*P(¬l | h)* P(h)\\ \space =0.1*(1-0.4)*0.5*0.7*0.1=0.0021\\ 所以P(i,h,¬l,e)=0.0084+0.0021=0.0105
P(i,h,¬l,e)=P(i,h,¬l,p,e)+P(i,h,¬l,¬p,e)P(i,h,¬l,p,e)=P(e∣p)∗P(p∣i,h,¬l)∗P(i)∗P(¬l∣h)∗P(h) =0.6∗0.4∗0.5∗0.7∗0.1=0.0084P(i,h,¬l,¬p,e)=P(e∣¬p)∗P(¬p∣i,h,¬l)∗P(i)∗P(¬l∣h)∗P(h) =0.1∗(1−0.4)∗0.5∗0.7∗0.1=0.0021所以P(i,h,¬l,e)=0.0084+0.0021=0.0105
P
(
h
,
¬
l
,
e
)
=
P
(
i
,
h
,
¬
l
,
e
)
+
P
(
¬
i
,
h
,
¬
l
,
e
)
由上式,
P
(
i
,
h
,
¬
l
,
e
)
=
0.0105
P
(
¬
i
,
h
,
¬
l
,
e
)
=
P
(
¬
i
,
h
,
¬
l
,
p
,
e
)
+
P
(
¬
i
,
h
,
¬
l
,
¬
p
,
e
)
P
(
¬
i
,
h
,
¬
l
,
p
,
e
)
=
P
(
e
∣
p
)
∗
P
(
p
∣
¬
i
,
h
,
¬
l
)
∗
P
(
¬
i
)
∗
P
(
¬
l
∣
h
)
∗
P
(
h
)
=
0.6
∗
0.3
∗
0.5
∗
0.7
∗
0.1
=
0.0063
P
(
¬
i
,
h
,
¬
l
,
¬
p
,
e
)
=
P
(
e
∣
¬
p
)
∗
P
(
¬
p
∣
¬
i
,
h
,
¬
l
)
∗
P
(
¬
i
)
∗
P
(
¬
l
∣
h
)
∗
P
(
h
)
=
0.1
∗
(
1
−
0.3
)
∗
0.5
∗
0.7
∗
0.1
=
0.00245
所以
P
(
¬
i
,
h
,
¬
l
,
e
)
=
0.0063
+
0.00245
=
0.00875
P
(
h
,
¬
l
,
e
)
=
0.0125
+
0.00875
=
0.01925
P(h,¬l,e)=P(i,h,¬l,e)+P(¬i,h,¬l,e) \\ 由上式,P(i,h,¬l,e)=0.0105 \\ P(¬i,h,¬l,e) =P(¬i,h,¬l,p,e)+P(¬i,h,¬l,¬p,e)\\ P(¬i,h,¬l,p,e)=P(e | p)*P(p | ¬i,h,¬l) * P(¬i)*P(¬l | h)* P(h)\\ \space =0.6*0.3*0.5*0.7*0.1=0.0063 \\ P(¬i,h,¬l,¬p,e)=P(e | ¬p)*P(¬p |¬i,h,¬l) * P(¬i)*P(¬l | h)* P(h)\\ \space =0.1*(1-0.3)*0.5*0.7*0.1=0.00245\\ 所以P(¬i,h,¬l,e)=0.0063+0.00245=0.00875 \\ P(h,¬l,e)=0.0125+0.00875=0.01925
P(h,¬l,e)=P(i,h,¬l,e)+P(¬i,h,¬l,e)由上式,P(i,h,¬l,e)=0.0105P(¬i,h,¬l,e)=P(¬i,h,¬l,p,e)+P(¬i,h,¬l,¬p,e)P(¬i,h,¬l,p,e)=P(e∣p)∗P(p∣¬i,h,¬l)∗P(¬i)∗P(¬l∣h)∗P(h) =0.6∗0.3∗0.5∗0.7∗0.1=0.0063P(¬i,h,¬l,¬p,e)=P(e∣¬p)∗P(¬p∣¬i,h,¬l)∗P(¬i)∗P(¬l∣h)∗P(h) =0.1∗(1−0.3)∗0.5∗0.7∗0.1=0.00245所以P(¬i,h,¬l,e)=0.0063+0.00245=0.00875P(h,¬l,e)=0.0125+0.00875=0.01925
代入,得:
P
(
i
∣
h
,
¬
l
,
e
)
=
P
(
i
,
h
,
¬
l
,
e
)
P
(
h
,
¬
l
,
e
)
=
0.0105
0.01925
≈
0.545
P(i|h,¬l,e)= \frac {P(i,h,¬l,e)} {P(h,¬l,e)}=\frac {0.0105} {0.01925}≈0.545
P(i∣h,¬l,e)=P(h,¬l,e)P(i,h,¬l,e)=0.019250.0105≈0.545
另解:
P
(
i
∣
h
,
¬
l
,
e
)
=
α
P
(
i
,
h
,
¬
l
,
e
)
=
α
P
(
e
∣
i
,
h
,
¬
l
)
P
(
i
)
P
(
h
)
p
(
¬
l
∣
h
)
=
α
∗
(
P
(
e
∣
p
)
P
(
p
∣
i
,
h
,
¬
l
)
P
(
i
)
P
(
h
)
p
(
¬
l
∣
h
)
+
P
(
e
∣
¬
p
)
P
(
¬
p
∣
i
,
h
,
¬
l
)
P
(
i
)
P
(
h
)
p
(
¬
l
∣
h
)
)
=
α
∗
(
0.6
∗
0.4
∗
0.5
∗
0.1
∗
0.7
+
0.1
∗
0.6
∗
0.5
∗
0.1
∗
0.7
)
=
α
∗
0.0105
P(i|h,¬l,e)= \alpha P(i,h,¬l,e) =\alpha P(e|i,h,¬l)P(i)P(h)p(¬l|h) \\ =\alpha*(P(e|p)P(p|i,h,¬l)P(i)P(h)p(¬l|h)+P(e|¬p)P(¬p|i,h,¬l)P(i)P(h)p(¬l|h)) \\ =\alpha *(0.6*0.4*0.5*0.1*0.7+0.1*0.6*0.5*0.1*0.7) \\ =\alpha*0.0105
P(i∣h,¬l,e)=αP(i,h,¬l,e)=αP(e∣i,h,¬l)P(i)P(h)p(¬l∣h)=α∗(P(e∣p)P(p∣i,h,¬l)P(i)P(h)p(¬l∣h)+P(e∣¬p)P(¬p∣i,h,¬l)P(i)P(h)p(¬l∣h))=α∗(0.6∗0.4∗0.5∗0.1∗0.7+0.1∗0.6∗0.5∗0.1∗0.7)=α∗0.0105
P ( ¬ i ∣ h , ¬ l , e ) = α P ( ¬ i , h , ¬ l , e ) = α P ( e ∣ ¬ i , h , ¬ l ) P ( ¬ i ) P ( h ) p ( ¬ l ∣ h ) = α ∗ ( P ( e ∣ p ) P ( p ∣ ¬ i , h , ¬ l ) P ( ¬ i ) P ( h ) p ( ¬ l ∣ h ) + P ( e ∣ ¬ p ) P ( ¬ p ∣ ¬ i , h , ¬ l ) P ( ¬ i ) P ( h ) p ( ¬ l ∣ h ) ) = α ∗ ( 0.6 ∗ 0.3 ∗ 0.5 ∗ 0.1 ∗ 0.7 + 0.1 ∗ 0.7 ∗ 0.5 ∗ 0.1 ∗ 0.7 ) = α ∗ 0.00875 P(¬i|h,¬l,e)= \alpha P(¬i,h,¬l,e) =\alpha P(e|¬i,h,¬l)P(¬i)P(h)p(¬l|h) \\ =\alpha*(P(e|p)P(p|¬i,h,¬l)P(¬i)P(h)p(¬l|h)+P(e|¬p)P(¬p|¬i,h,¬l)P(¬i)P(h)p(¬l|h) )\\ =\alpha *(0.6*0.3*0.5*0.1*0.7+0.1*0.7*0.5*0.1*0.7) \\ =\alpha*0.00875 P(¬i∣h,¬l,e)=αP(¬i,h,¬l,e)=αP(e∣¬i,h,¬l)P(¬i)P(h)p(¬l∣h)=α∗(P(e∣p)P(p∣¬i,h,¬l)P(¬i)P(h)p(¬l∣h)+P(e∣¬p)P(¬p∣¬i,h,¬l)P(¬i)P(h)p(¬l∣h))=α∗(0.6∗0.3∗0.5∗0.1∗0.7+0.1∗0.7∗0.5∗0.1∗0.7)=α∗0.00875
归一化:
α
∗
0.0105
+
α
∗
0.00875
=
1
所以
α
=
51.9480519
P
(
i
∣
h
,
¬
l
,
e
)
=
α
∗
0.0105
=
0.5454
…
…
\alpha*0.0105+\alpha*0.00875=1 \\ 所以 \alpha=51.9480519 \\ P(i|h,¬l,e)=\alpha*0.0105=0.5454……
α∗0.0105+α∗0.00875=1所以α=51.9480519P(i∣h,¬l,e)=α∗0.0105=0.5454……
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。