仿真 足球机器人
第四次作业
决策树
该实例中总共有12个对象,6个类为“是”,6个类为“否”
I(p,n)=-(6/12)log2(6/12)-(6/12)log2(6/12)= 1
属性:有否其他选择,值:{“是”,“否”}
值:
“是”:6, p1=2 n1=4 I(p1,n1)= -(2/6)log2(2/6)-(4/6)log2(4/6)=0.918
“否”:6, p2=4 n2=2 I(p2,n2)=-(4/6)log2(4/6)-(2/6)log2(2/6)=0.918
E(有否其他选择)=(6/12)*I(p1,n1)+(6/12)*I(p2,n2)= 0.918
属性:饿否,值:{“是”,“否”}
值:
“是”:7, p1=5 n1=2 I(p1,n1)= -(5/7)log2(5/7)-(2/7)log2(2/7)=0.863
“否”:5 , p2=1 n2=4 I(p2,n2)=-(1/5)log2(1/5)-(4/5)log2(4/5)=0.722
E(饿否)=(7/12)*I(p1,n1)+(5/12)*I(p2,n2)= 0.804
Gain(s,“饿否”)=
I(p,n)-E()=0.196
属性:价格,值:{$ , , ,,$}
值:
$$$:3, p1=1 n1=2 I(p1,n1)= -(1/3)log2(1/3)-(2/3)log2(2/3)=0.918
$$: 2, p2=2 n2=0 I(p2,n2)=-(2/2)log2(2/2)-(0/2)log2(0/2)=0
$: 7, p3=3 n3=4 I(p3,n3)=-(3/7)log2(3/7)-(4/7)log2(4/7)=0.985
E(价格)=(3/12)*I(p1,n1)+(2/12)*I(p2,n2)+(7/12)*I(p3,n3)= 0.804
属性:餐馆类型 ,值:{法式,中餐, 快餐 ,意大利式}
值:
法式: 2, p1=1 n1=1 I(p1,n1)= -(1/2)log2(1/2)-(1/2)log2(1/2)&#