官术网_书友最值得收藏!

Entropy calculation

The frequency table for the combination Outlook-Train outside is as follows:

 

Using these values, we get the entropy of two variables, as shown here in detail:

p(Sunny).S(Sunny)+p(Overcast).S(Overcast)+p(Rainy)*S(Rainy)=

5/14*(-3/5*log2(3/5)-2/5*log2(2/5)) +

4/14*(-4/4*log2(4/4)-0/4*log2(0/4))+

5/14*(-2/5*log2(2/5)-3/5*log2(3/5))=

0.693

Here, p(Sunny) = (#Yes+#No)/Total entries = (2+3)/14, p(Overcast) = (#Yes+#No)/Total entries = (4+0)/14, and p(Rainy) = (#Yes+#No)/Total entries = (2+3)/14. The entropy values S(v) are calculated using the corresponding probabilities, that is, #Yes or #No over the total #Yes+#No.

The frequency table for the combination Temperature-Train outside is as follows:

 

Using these values and an analogous calculation, the entropy is shown in detail here:

p(Hot).S(Hot)+p(Mild).S(Mild)+p(Cool)*S(Cool)=

4/14*(-2/4*log2(2/4)-2/4*log2(2/4)) +

6/14*(-4/6*log2(4/6)-2/6*log2(2/6))+

4/14*(-3/4*log2(3/4)-1/4*log2(1/4)) =

0,911

The frequency table for the combination Humidity-Train outside is as follows:

Using these values, we get the entropy as follows:

p(High).S(High)+p(Normal).S(Normal)=

7/14*(-3/7*log2(3/7)-4/7*log2(4/7)) +

7/14*(-6/7*log2(6/7)-1/7*log2(1/7))=

0,788

The frequency table for the combination Windy-Train outside is as follows:

 

Using these values, we get the entropy as follows:

p(True).S(True)+p(False).S(False)=

8/14*(-6/8*log2(6/8)-2/8*log2(2/8)) +

6/14*(-3/6*log2(3/6)-3/6*log2(3/6))

=0,892

主站蜘蛛池模板: 云梦县| 敦化市| 沧源| 靖安县| 远安县| 阳山县| 犍为县| 凤台县| 遂宁市| 阿勒泰市| 固镇县| 广水市| 当涂县| 舒兰市| 东莞市| 奈曼旗| 台江县| 师宗县| 瑞安市| 花莲县| 舞钢市| 仙居县| 观塘区| 东源县| 鄂托克前旗| 台东市| 广昌县| 梅州市| 琼中| 镇巴县| 扶沟县| 安西县| 北川| 东港市| 巫溪县| 当雄县| 淮滨县| 鄂托克旗| 炉霍县| 弋阳县| 岳阳县|