- 浏览: 140116 次
文章分类
最新评论
数据挖掘 ID3
本文讲的是数据挖掘中的ID3,这个有很多人做了,我也没有说什么改善,只是要考试,用我考试记录的来写,具有很大主观性,如果看到有觉得不对或感觉不好,请关掉浏览器或和我说,请不要生气或发不良的言论。
决策树使用属性划分
那么简单的,我有一只猫,不是吃的东西他就回去吃,吃的东西中,不给猫吃的,他就会吃。那么我们拿出一个东西,他就会根据构建的判断
ID3算法是由Quinlan首先提出的,该算法是以信息论为基础,以信息熵和信息增益为衡量标准,从而实现对数据的归纳分类。
ID3就是判断那个属性作为节点,例如上面说的,我们有属性 吃的、给猫吃的,两个属性,ID3判断那个属性作为第一个节点,选取完了第一个节点吃的,就从剩下的属性选取。
信息熵
ID3判断是用信息熵,信息熵就是主要是指信息的混乱程度,变量的不确定性越大,熵的值也就越大,这是香农提出,熵的公式可以表示为:
其中 <nobr><span class="math" id="MathJax-Span-42" style="width: 6.029em; display: inline-block;"><span style="display: inline-block; position: relative; width: 4.803em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(1.496em 1000em 3.576em -0.531em); top: -2.771em; left: 0.003em;"><span class="mrow" id="MathJax-Span-43"><span class="mi" id="MathJax-Span-44" style="font-family: MathJax_Math-italic;">p</span><span class="mo" id="MathJax-Span-45" style="font-family: MathJax_Main;">(</span><span class="msubsup" id="MathJax-Span-46"><span style="display: inline-block; position: relative; width: 0.909em; height: 0px;"><span style="position: absolute; clip: rect(1.976em 1000em 2.723em -0.477em); top: -2.557em; left: 0.003em;"><span class="mi" id="MathJax-Span-47" style="font-family: MathJax_Math-italic;">u</span><span style="display: inline-block; width: 0px; height: 2.563em;"></span></span><span style="position: absolute; top: -2.291em; left: 0.589em;"><span class="mi" id="MathJax-Span-48" style="font-size: 70.7%; font-family: MathJax_Math-italic;">i</span><span style="display: inline-block; width: 0px; height: 2.456em;"></span></span></span></span><span class="mo" id="MathJax-Span-49" style="font-family: MathJax_Main;">)</span><span class="mo" id="MathJax-Span-50" style="font-family: MathJax_Main; padding-left: 0.269em;">=</span><span class="mfrac" id="MathJax-Span-51" style="padding-left: 0.269em;"><span style="display: inline-block; position: relative; width: 1.123em; height: 0px; margin-right: 0.109em; margin-left: 0.109em;"><span style="position: absolute; clip: rect(1.763em 1000em 2.776em -0.371em); top: -3.037em; left: 50%; margin-left: -0.477em;"><span class="mrow" id="MathJax-Span-52"><span class="texatom" id="MathJax-Span-53"><span class="mrow" id="MathJax-Span-54"><span class="mo" id="MathJax-Span-55" style="font-size: 70.7%; font-family: MathJax_Main;">|</span></span></span><span class="msubsup" id="MathJax-Span-56"><span style="display: inline-block; position: relative; width: 0.643em; height: 0px;"><span style="position: absolute; clip: rect(1.976em 1000em 2.616em -0.477em); top: -2.451em; left: 0.003em;"><span class="mi" id="MathJax-Span-57" style="font-size: 70.7%; font-family: MathJax_Math-italic;">u</span><span style="display: inline-block; width: 0px; height: 2.456em;"></span></span><span style="position: absolute; top: -2.237em; left: 0.429em;"><span class="mi" id="MathJax-Span-58" style="font-size: 50%; font-family: MathJax_Math-italic;">i</span><span style="display: inline-block; width: 0px; height: 2.349em;"></span></span></span></span><span class="texatom" id="MathJax-Span-59"><span class="mrow" id="MathJax-Span-60"><span class="mo" id="MathJax-Span-61" style="font-size: 70.7%; font-family: MathJax_Main;">|</span></span></span></span><span style="display: inline-block; width: 0px; height: 2.456em;"></span></span><span style="position: absolute; clip: rect(1.763em 1000em 2.776em -0.371em); top: -2.024em; left: 50%; margin-left: -0.424em;"><span class="mrow" id="MathJax-Span-62"><span class="texatom" id="MathJax-Span-63"><span class="mrow" id="MathJax-Span-64"><span class="mo" id="MathJax-Span-65" style="font-size: 70.7%; font-family: MathJax_Main;">|</span></span></span><span class="mi" id="MathJax-Span-66" style="font-size: 70.7%; font-family: MathJax_Math-italic;">S<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="texatom" id="MathJax-Span-67"><span class="mrow" id="MathJax-Span-68"><span class="mo" id="MathJax-Span-69" style="font-size: 70.7%; font-family: MathJax_Main;">|</span></span></span></span><span style="display: inline-block; width: 0px; height: 2.456em;"></span></span><span style="position: absolute; clip: rect(0.856em 1000em 1.229em -0.477em); top: -1.277em; left: 0.003em;"><span style="border-left-width: 1.123em; border-left-style: solid; display: inline-block; overflow: hidden; width: 0px; height: 1.25px; vertical-align: 0.003em;"></span><span style="display: inline-block; width: 0px; height: 1.069em;"></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.776em;"></span></span></span><span style="border-left-width: 0.003em; border-left-style: solid; display: inline-block; overflow: hidden; width: 0px; height: 2.27em; vertical-align: -0.863em;"></span></span></nobr><script type="math/tex" id="MathJax-Element-2">p(u_i)=\frac{|u_i|}{|S|}</script>,<nobr><span class="math" id="MathJax-Span-70" style="width: 2.776em; display: inline-block;"><span style="display: inline-block; position: relative; width: 2.189em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(1.869em 1000em 3.203em -0.531em); top: -2.771em; left: 0.003em;"><span class="mrow" id="MathJax-Span-71"><span class="mi" id="MathJax-Span-72" style="font-family: MathJax_Math-italic;">p</span><span class="mo" id="MathJax-Span-73" style="font-family: MathJax_Main;">(</span><span class="msubsup" id="MathJax-Span-74"><span style="display: inline-block; position: relative; width: 0.909em; height: 0px;"><span style="position: absolute; clip: rect(1.976em 1000em 2.723em -0.477em); top: -2.557em; left: 0.003em;"><span class="mi" id="MathJax-Span-75" style="font-family: MathJax_Math-italic;">u</span><span style="display: inline-block; width: 0px; height: 2.563em;"></span></span><span style="position: absolute; top: -2.291em; left: 0.589em;"><span class="mi" id="MathJax-Span-76" style="font-size: 70.7%; font-family: MathJax_Math-italic;">i</span><span style="display: inline-block; width: 0px; height: 2.456em;"></span></span></span></span><span class="mo" id="MathJax-Span-77" style="font-family: MathJax_Main;">)</span></span><span style="display: inline-block; width: 0px; height: 2.776em;"></span></span></span><span style="border-left-width: 0.003em; border-left-style: solid; display: inline-block; overflow: hidden; width: 0px; height: 1.403em; vertical-align: -0.397em;"></span></span></nobr><script type="math/tex" id="MathJax-Element-3">p(u_i)</script>是类别<nobr><span class="math" id="MathJax-Span-78" style="width: 1.176em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0.909em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(1.763em 1000em 2.669em -0.477em); top: -2.344em; left: 0.003em;"><span class="mrow" id="MathJax-Span-79"><span class="msubsup" id="MathJax-Span-80"><span style="display: inline-block; position: relative; width: 0.909em; height: 0px;"><span style="position: absolute; clip: rect(1.976em 1000em 2.723em -0.477em); top: -2.557em; left: 0.003em;"><span class="mi" id="MathJax-Span-81" style="font-family: MathJax_Math-italic;">u</span><span style="display: inline-block; width: 0px; height: 2.563em;"></span></span><span style="position: absolute; top: -2.291em; left: 0.589em;"><span class="mi" id="MathJax-Span-82" style="font-size: 70.7%; font-family: MathJax_Math-italic;">i</span><span style="display: inline-block; width: 0px; height: 2.456em;"></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.349em;"></span></span></span><span style="border-left-width: 0.003em; border-left-style: solid; display: inline-block; overflow: hidden; width: 0px; height: 0.87em; vertical-align: -0.263em;"></span></span></nobr><script type="math/tex" id="MathJax-Element-4">u_i</script>在S出现概率。
信息不确定大,熵越大,所以把它分离作为节点得到信息多,如果一个熵为0,那么就不用分裂,表示确定,例如看到水100度,得到结果他沸在常温下
信息增益
信息增益(Information gain) 指的是划分前后熵的变化,可以用下面的公式表示:
其中,A表示样本的属性,<nobr><span class="math" id="MathJax-Span-5204" style="width: 5.229em; display: inline-block;"><span style="display: inline-block; position: relative; width: 4.163em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(1.869em 1000em 3.203em -0.424em); top: -2.771em; left: 0.003em;"><span class="mrow" id="MathJax-Span-5205"><span class="mi" id="MathJax-Span-5206" style="font-family: MathJax_Math-italic;">V<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.163em;"></span></span><span class="mi" id="MathJax-Span-5207" style="font-family: MathJax_Math-italic;">a</span><span class="mi" id="MathJax-Span-5208" style="font-family: MathJax_Math-italic;">l</span><span class="mi" id="MathJax-Span-5209" style="font-family: MathJax_Math-italic;">u</span><span class="mi" id="MathJax-Span-5210" style="font-family: MathJax_Math-italic;">e</span><span class="mo" id="MathJax-Span-5211" style="font-family: MathJax_Main;">(</span><span class="mi" id="MathJax-Span-5212" style="font-family: MathJax_Math-italic;">A</span><span class="mo" id="MathJax-Span-5213" style="font-family: MathJax_Main;">)</span></span><span style="display: inline-block; width: 0px; height: 2.776em;"></span></span></span><span style="border-left-width: 0.003em; border-left-style: solid; display: inline-block; overflow: hidden; width: 0px; height: 1.403em; vertical-align: -0.397em;"></span></span></nobr><script type="math/tex" id="MathJax-Element-96">Value(A)</script>是属性A所有的取值集合。V是A其中一个属性值,<nobr><span class="math" id="MathJax-Span-5214" style="width: 1.443em; display: inline-block;"><span style="display: inline-block; position: relative; width: 1.123em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(1.496em 1000em 2.669em -0.424em); top: -2.344em; left: 0.003em;"><span class="mrow" id="MathJax-Span-5215"><span class="msubsup" id="MathJax-Span-5216"><span style="display: inline-block; position: relative; width: 1.123em; height: 0px;"><span style="position: absolute; clip: rect(1.709em 1000em 2.723em -0.424em); top: -2.557em; left: 0.003em;"><span class="mi" id="MathJax-Span-5217" style="font-family: MathJax_Math-italic;">S<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.056em;"></span></span><span style="display: inline-block; width: 0px; height: 2.563em;"></span></span><span style="position: absolute; top: -2.291em; left: 0.643em;"><span class="mi" id="MathJax-Span-5218" style="font-size: 70.7%; font-family: MathJax_Math-italic;">v</span><span style="display: inline-block; width: 0px; height: 2.456em;"></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.349em;"></span></span></span><span style="border-left-width: 0.003em; border-left-style: solid; display: inline-block; overflow: hidden; width: 0px; height: 1.203em; vertical-align: -0.263em;"></span></span></nobr><script type="math/tex" id="MathJax-Element-97">S_v</script>是S中A的值为V样例的集合。
那么看到这觉得不知道我在说什么,简答例子
我们先用别的大神例子,假如还是我们那个用某人是否网球天气
Day | Outlook | Temperature | Humidity | Wind | PlayTennis |
D1 | Sunny | Hot | High | Weak | No |
D2 | Sunny | Hot | High | Strong | No |
D3 | Overcast | Hot | High | Weak | Yes |
D4 | Rain | Mild | High | Weak | Yes |
D5 | Rain | Cool | Normal | Weak | Yes |
D6 | Rain | Cool | Normal | Strong | No |
D7 | Overcast | Cool | Normal | Strong | Yes |
D8 | Sunny | Mild | High | Weak | No |
D9 | Sunny | Cool | Normal | Weak | Yes |
D10 | Rain | Mild | Normal | Weak | Yes |
D11 | Sunny | Mild | Normal | Strong | Yes |
D12 | Overcast | Mild | High | Strong | Yes |
D13 | Overcast | Hot | Normal | Weak | Yes |
D14 | Rain | Mild | High | Strong | No |
未知 Outlook=sunny, Temperature=cool,Humidity=high,Wind=strong
那么我们根据现在数据
计算信息熵
我们yes存在9,no存在4,根据<nobr><span class="math" id="MathJax-Span-5219" style="width: 19.843em; display: inline-block;"><span style="display: inline-block; position: relative; width: 15.843em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(1.816em 1000em 3.203em -0.424em); top: -2.771em; left: 0.003em;"><span class="mrow" id="MathJax-Span-5220"><span class="mi" id="MathJax-Span-5221" style="font-family: MathJax_Math-italic;">E<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mi" id="MathJax-Span-5222" style="font-family: MathJax_Math-italic;">n</span><span class="mi" id="MathJax-Span-5223" style="font-family: MathJax_Math-italic;">t</span><span class="mi" id="MathJax-Span-5224" style="font-family: MathJax_Math-italic;">r</span><span class="mi" id="MathJax-Span-5225" style="font-family: MathJax_Math-italic;">o</span><span class="mi" id="MathJax-Span-5226" style="font-family: MathJax_Math-italic;">p</span><span class="mi" id="MathJax-Span-5227" style="font-family: MathJax_Math-italic;">y<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mo" id="MathJax-Span-5228" style="font-family: MathJax_Main;">(</span><span class="mi" id="MathJax-Span-5229" style="font-family: MathJax_Math-italic;">S<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.056em;"></span></span><span class="mo" id="MathJax-Span-5230" style="font-family: MathJax_Main;">)</span><span class="mo" id="MathJax-Span-5231" style="font-family: MathJax_Main; padding-left: 0.269em;">=</span><span class="mo" id="MathJax-Span-5232" style="font-family: MathJax_Main; padding-left: 0.269em;">−</span><span class="munderover" id="MathJax-Span-5233" style="padding-left: 0.163em;"><span style="display: inline-block; position: relative; width: 2.296em; height: 0px;"><span style="position: absolute; clip: rect(1.869em 1000em 3.203em -0.424em); top: -2.771em; left: 0.003em;"><span class="mo" id="MathJax-Span-5234" style="font-family: MathJax_Size1; vertical-align: 0.003em;">∑</span><span style="display: inline-block; width: 0px; height: 2.776em;"></span></span><span style="position: absolute; clip: rect(1.976em 1000em 2.616em -0.477em); top: -2.931em; left: 1.069em;"><span class="texatom" id="MathJax-Span-5235"><span class="mrow" id="MathJax-Span-5236"><span class="mi" id="MathJax-Span-5237" style="font-size: 70.7%; font-family: MathJax_Math-italic;">m</span></span></span><span style="display: inline-block; width: 0px; height: 2.456em;"></span></span><span style="position: absolute; clip: rect(1.816em 1000em 2.616em -0.477em); top: -2.184em; left: 1.069em;"><span class="texatom" id="MathJax-Span-5238"><span class="mrow" id="MathJax-Span-5239"><span class="mi" id="MathJax-Span-5240" style="font-size: 70.7%; font-family: MathJax_Math-italic;">i</span><span class="mo" id="MathJax-Span-5241" style="font-size: 70.7%; font-family: MathJax_Main;">=</span><span class="mn" id="MathJax-Span-5242" style="font-size: 70.7%; font-family: MathJax_Main;">1</span></span></span><span style="display: inline-block; width: 0px; height: 2.456em;"></span></span></span></span><span class="mi" id="MathJax-Span-5243" style="font-family: MathJax_Math-italic; padding-left: 0.163em;">p</span><span class="mo" id="MathJax-Span-5244" style="font-family: MathJax_Main;">(</span><span class="msubsup" id="MathJax-Span-5245"><span style="display: inline-block; position: relative; width: 0.909em; height: 0px;"><span style="position: absolute; clip: rect(1.976em 1000em 2.723em -0.477em); top: -2.557em; left: 0.003em;"><span class="mi" id="MathJax-Span-5246" style="font-family: MathJax_Math-italic;">u</span><span style="display: inline-block; width: 0px; height: 2.563em;"></span></span><span style="position: absolute; top: -2.291em; left: 0.589em;"><span class="mi" id="MathJax-Span-5247" style="font-size: 70.7%; font-family: MathJax_Math-italic;">i</span><span style="display: inline-block; width: 0px; height: 2.456em;"></span></span></span></span><span class="mo" id="MathJax-Span-5248" style="font-family: MathJax_Main;">)</span><span class="mi" id="MathJax-Span-5249" style="font-family: MathJax_Math-italic;">l</span><span class="mi" id="MathJax-Span-5250" style="font-family: MathJax_Math-italic;">o</span><span class="msubsup" id="MathJax-Span-5251"><span style="display: inline-block; position: relative; width: 0.909em; height: 0px;"><span style="position: absolute; clip: rect(1.976em 1000em 2.936em -0.477em); top: -2.557em; left: 0.003em;"><span class="mi" id="MathJax-Span-5252" style="font-family: MathJax_Math-italic;">g<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span style="display: inline-block; width: 0px; height: 2.563em;"></span></span><span style="position: absolute; top: -2.184em; left: 0.483em;"><span class="mn" id="MathJax-Span-5253" style="font-size: 70.7%; font-family: MathJax_Main;">2</span><span style="display: inline-block; width: 0px; height: 2.456em;"></span></span></span></span><span class="mi" id="MathJax-Span-5254" style="font-family: MathJax_Math-italic;">p</span><span class="mo" id="MathJax-Span-5255" style="font-family: MathJax_Main;">(</span><span class="msubsup" id="MathJax-Span-5256"><span style="display: inline-block; position: relative; width: 0.909em; height: 0px;"><span style="position: absolute; clip: rect(1.976em 1000em 2.723em -0.477em); top: -2.557em; left: 0.003em;"><span class="mi" id="MathJax-Span-5257" style="font-family: MathJax_Math-italic;">u</span><span style="display: inline-block; width: 0px; height: 2.563em;"></span></span><span style="position: absolute; top: -2.291em; left: 0.589em;"><span class="mi" id="MathJax-Span-5258" style="font-size: 70.7%; font-family: MathJax_Math-italic;">i</span><span style="display: inline-block; width: 0px; height: 2.456em;"></span></span></span></span><span class="mo" id="MathJax-Span-5259" style="font-family: MathJax_Main;">)</span></span><span style="display: inline-block; width: 0px; height: 2.776em;"></span></span></span><span style="border-left-width: 0.003em; border-left-style: solid; display: inline-block; overflow: hidden; width: 0px; height: 1.47em; vertical-align: -0.397em;"></span></span></nobr><script type="math/tex" id="MathJax-Element-98">Entropy(S)=-\sum_{i=1}^{m} p(u_i)log_2p(u_i)</script>
<nobr><span class="math" id="MathJax-Span-5260" style="width: 27.309em; display: inline-block;"><span style="display: inline-block; position: relative; width: 21.816em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(3.096em 1000em 5.549em -0.477em); top: -3.997em; left: 0.003em;"><span class="mrow" id="MathJax-Span-5261"><span style="display: inline-block; position: relative; width: 21.816em; height: 0px;"><span style="position: absolute; clip: rect(3.096em 1000em 4.429em -0.477em); top: -3.997em; left: 0.003em;"><span class="mi" id="MathJax-Span-5262" style="font-family: MathJax_Math-italic;">i</span><span class="mi" id="MathJax-Span-5263" style="font-family: MathJax_Math-italic;">n</span><span class="mi" id="MathJax-Span-5264" style="font-family: MathJax_Math-italic;">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.056em;"></span></span><span class="mi" id="MathJax-Span-5265" style="font-family: MathJax_Math-italic;">o</span><span class="mo" id="MathJax-Span-5266" style="font-family: MathJax_Main;">(</span><span class="mi" id="MathJax-Span-5267" style="font-family: MathJax_Math-italic;">D</span><span class="mo" id="MathJax-Span-5268" style="font-family: MathJax_Main;">)</span><span class="mo" id="MathJax-Span-5269" style="font-family: MathJax_Main; padding-left: 0.269em;">=</span><span class="mo" id="MathJax-Span-5270" style="font-family: MathJax_Main; padding-left: 0.269em;">−</span><span class="mn" id="MathJax-Span-5271" style="font-family: MathJax_Main;">9</span><span class="texatom" id="MathJax-Span-5272"><span class="mrow" id="MathJax-Span-5273"><span class="mo" id="MathJax-Span-5274" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5275" style="font-family: MathJax_Main;">14</span><span class="mo" id="MathJax-Span-5276" style="font-family: MathJax_Main; padding-left: 0.216em;">∗</span><span class="mi" id="MathJax-Span-5277" style="font-family: MathJax_Math-italic; padding-left: 0.216em;">l</span><span class="mi" id="MathJax-Span-5278" style="font-family: MathJax_Math-italic;">o</span><span class="mi" id="MathJax-Span-5279" style="font-family: MathJax_Math-italic;">g<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mn" id="MathJax-Span-5280" style="font-family: MathJax_Main;">2</span><span class="mo" id="MathJax-Span-5281" style="font-family: MathJax_Main;">(</span><span class="mn" id="MathJax-Span-5282" style="font-family: MathJax_Main;">9</span><span class="texatom" id="MathJax-Span-5283"><span class="mrow" id="MathJax-Span-5284"><span class="mo" id="MathJax-Span-5285" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5286" style="font-family: MathJax_Main;">14</span><span class="mo" id="MathJax-Span-5287" style="font-family: MathJax_Main;">)</span><span class="mo" id="MathJax-Span-5288" style="font-family: MathJax_Main; padding-left: 0.216em;">−</span><span class="mn" id="MathJax-Span-5289" style="font-family: MathJax_Main; padding-left: 0.216em;">5</span><span class="texatom" id="MathJax-Span-5290"><span class="mrow" id="MathJax-Span-5291"><span class="mo" id="MathJax-Span-5292" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5293" style="font-family: MathJax_Main;">14</span><span class="mo" id="MathJax-Span-5294" style="font-family: MathJax_Main; padding-left: 0.216em;">∗</span><span class="mi" id="MathJax-Span-5295" style="font-family: MathJax_Math-italic; padding-left: 0.216em;">l</span><span class="mi" id="MathJax-Span-5296" style="font-family: MathJax_Math-italic;">o</span><span class="mi" id="MathJax-Span-5297" style="font-family: MathJax_Math-italic;">g<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mn" id="MathJax-Span-5298" style="font-family: MathJax_Main;">2</span><span class="mo" id="MathJax-Span-5299" style="font-family: MathJax_Main;">(</span><span class="mn" id="MathJax-Span-5300" style="font-family: MathJax_Main;">5</span><span class="texatom" id="MathJax-Span-5301"><span class="mrow" id="MathJax-Span-5302"><span class="mo" id="MathJax-Span-5303" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5304" style="font-family: MathJax_Main;">14</span><span class="mo" id="MathJax-Span-5305" style="font-family: MathJax_Main;">)</span><span style="display: inline-block; width: 0px; height: 4.003em;"></span></span><span style="position: absolute; clip: rect(3.149em 1000em 4.163em -0.424em); top: -2.664em; left: 0.003em;"><span class="mo" id="MathJax-Span-5306" style="font-family: MathJax_Main;">=</span><span class="mn" id="MathJax-Span-5307" style="font-family: MathJax_Main; padding-left: 0.269em;">0.940</span><span style="display: inline-block; width: 0px; height: 4.003em;"></span></span></span></span><span style="display: inline-block; width: 0px; height: 4.003em;"></span></span></span><span style="border-left-width: 0.003em; border-left-style: solid; display: inline-block; overflow: hidden; width: 0px; height: 2.803em; vertical-align: -1.797em;"></span></span></nobr><script type="math/tex" id="MathJax-Element-99">info(D)=-9/14 * log2(9/14) - 5/14 * log2(5/14) = 0.940 </script>
对每个属性计算,OUTLOOK属性中,有3个取值:Sunny、Overcast和Rainy,样本分布情况如下:
类别为Yes时,Sunny有2个样本;类别为No时,Sunny有3个样本。
类别为Yes时,Overcast有4个样本;类别为No时,Overcast有0个样本。
类别为Yes时,Rainy有3个样本;类别为No时,Rainy有2个样本。
<nobr><span class="math" id="MathJax-Span-5308" style="width: 27.736em; display: inline-block;"><span style="display: inline-block; position: relative; width: 22.189em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(5.389em 1000em 10.989em -0.477em); top: -6.291em; left: 0.003em;"><span class="mrow" id="MathJax-Span-5309"><span style="display: inline-block; position: relative; width: 22.189em; height: 0px;"><span style="position: absolute; clip: rect(3.096em 1000em 4.429em -0.477em); top: -3.997em; left: 0.003em;"><span class="mi" id="MathJax-Span-5310" style="font-family: MathJax_Math-italic;">I<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.056em;"></span></span><span class="mi" id="MathJax-Span-5311" style="font-family: MathJax_Math-italic;">n</span><span class="mi" id="MathJax-Span-5312" style="font-family: MathJax_Math-italic;">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.056em;"></span></span><span class="mi" id="MathJax-Span-5313" style="font-family: MathJax_Math-italic;">o</span><span class="mo" id="MathJax-Span-5314" style="font-family: MathJax_Main;">(</span><span class="mi" id="MathJax-Span-5315" style="font-family: MathJax_Math-italic;">O</span><span class="mi" id="MathJax-Span-5316" style="font-family: MathJax_Math-italic;">U<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.109em;"></span></span><span class="mi" id="MathJax-Span-5317" style="font-family: MathJax_Math-italic;">T<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.109em;"></span></span><span class="mi" id="MathJax-Span-5318" style="font-family: MathJax_Math-italic;">L</span><span class="mi" id="MathJax-Span-5319" style="font-family: MathJax_Math-italic;">O</span><span class="mi" id="MathJax-Span-5320" style="font-family: MathJax_Math-italic;">O</span><span class="mi" id="MathJax-Span-5321" style="font-family: MathJax_Math-italic;">K<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.056em;"></span></span><span class="mo" id="MathJax-Span-5322" style="font-family: MathJax_Main;">)</span><span class="mo" id="MathJax-Span-5323" style="font-family: MathJax_Main; padding-left: 0.269em;">=</span><span class="mn" id="MathJax-Span-5324" style="font-family: MathJax_Main; padding-left: 0.269em;">5</span><span class="texatom" id="MathJax-Span-5325"><span class="mrow" id="MathJax-Span-5326"><span class="mo" id="MathJax-Span-5327" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5328" style="font-family: MathJax_Main;">14</span><span class="mo" id="MathJax-Span-5329" style="font-family: MathJax_Main; padding-left: 0.216em;">∗</span><span class="mo" id="MathJax-Span-5330" style="font-family: MathJax_Main; padding-left: 0.216em;">[</span><span class="mo" id="MathJax-Span-5331" style="font-family: MathJax_Main;">−</span><span class="mn" id="MathJax-Span-5332" style="font-family: MathJax_Main;">2</span><span class="texatom" id="MathJax-Span-5333"><span class="mrow" id="MathJax-Span-5334"><span class="mo" id="MathJax-Span-5335" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5336" style="font-family: MathJax_Main;">5</span><span class="mo" id="MathJax-Span-5337" style="font-family: MathJax_Main; padding-left: 0.216em;">∗</span><span class="mi" id="MathJax-Span-5338" style="font-family: MathJax_Math-italic; padding-left: 0.216em;">l</span><span class="mi" id="MathJax-Span-5339" style="font-family: MathJax_Math-italic;">o</span><span class="mi" id="MathJax-Span-5340" style="font-family: MathJax_Math-italic;">g<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mn" id="MathJax-Span-5341" style="font-family: MathJax_Main;">2</span><span class="mo" id="MathJax-Span-5342" style="font-family: MathJax_Main;">(</span><span class="mn" id="MathJax-Span-5343" style="font-family: MathJax_Main;">2</span><span class="texatom" id="MathJax-Span-5344"><span class="mrow" id="MathJax-Span-5345"><span class="mo" id="MathJax-Span-5346" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5347" style="font-family: MathJax_Main;">5</span><span class="mo" id="MathJax-Span-5348" style="font-family: MathJax_Main;">)</span><span class="mo" id="MathJax-Span-5349" style="font-family: MathJax_Main;">–</span><span class="mn" id="MathJax-Span-5350" style="font-family: MathJax_Main; padding-left: 0.163em;">3</span><span class="texatom" id="MathJax-Span-5351"><span class="mrow" id="MathJax-Span-5352"><span class="mo" id="MathJax-Span-5353" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5354" style="font-family: MathJax_Main;">5</span><span style="display: inline-block; width: 0px; height: 4.003em;"></span></span><span style="position: absolute; clip: rect(3.096em 1000em 4.429em -0.424em); top: -2.557em; left: 0.003em;"><span class="mo" id="MathJax-Span-5355" style="font-family: MathJax_Main;">∗</span><span class="mi" id="MathJax-Span-5356" style="font-family: MathJax_Math-italic; padding-left: 0.216em;">l</span><span class="mi" id="MathJax-Span-5357" style="font-family: MathJax_Math-italic;">o</span><span class="mi" id="MathJax-Span-5358" style="font-family: MathJax_Math-italic;">g<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mn" id="MathJax-Span-5359" style="font-family: MathJax_Main;">2</span><span class="mo" id="MathJax-Span-5360" style="font-family: MathJax_Main;">(</span><span class="mn" id="MathJax-Span-5361" style="font-family: MathJax_Main;">3</span><span class="texatom" id="MathJax-Span-5362"><span class="mrow" id="MathJax-Span-5363"><span class="mo" id="MathJax-Span-5364" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5365" style="font-family: MathJax_Main;">5</span><span class="mo" id="MathJax-Span-5366" style="font-family: MathJax_Main;">)</span><span class="mo" id="MathJax-Span-5367" style="font-family: MathJax_Main;">]</span><span class="mo" id="MathJax-Span-5368" style="font-family: MathJax_Main; padding-left: 0.216em;">+</span><span class="mn" id="MathJax-Span-5369" style="font-family: MathJax_Main; padding-left: 0.216em;">4</span><span class="texatom" id="MathJax-Span-5370"><span class="mrow" id="MathJax-Span-5371"><span class="mo" id="MathJax-Span-5372" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5373" style="font-family: MathJax_Main;">14</span><span class="mo" id="MathJax-Span-5374" style="font-family: MathJax_Main; padding-left: 0.216em;">∗</span><span class="mo" id="MathJax-Span-5375" style="font-family: MathJax_Main; padding-left: 0.216em;">[</span><span class="mo" id="MathJax-Span-5376" style="font-family: MathJax_Main;">−</span><span class="mn" id="MathJax-Span-5377" style="font-family: MathJax_Main;">4</span><span class="texatom" id="MathJax-Span-5378"><span class="mrow" id="MathJax-Span-5379"><span class="mo" id="MathJax-Span-5380" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5381" style="font-family: MathJax_Main;">4</span><span class="mo" id="MathJax-Span-5382" style="font-family: MathJax_Main; padding-left: 0.216em;">∗</span><span class="mi" id="MathJax-Span-5383" style="font-family: MathJax_Math-italic; padding-left: 0.216em;">l</span><span class="mi" id="MathJax-Span-5384" style="font-family: MathJax_Math-italic;">o</span><span class="mi" id="MathJax-Span-5385" style="font-family: MathJax_Math-italic;">g<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mn" id="MathJax-Span-5386" style="font-family: MathJax_Main;">2</span><span class="mo" id="MathJax-Span-5387" style="font-family: MathJax_Main;">(</span><span class="mn" id="MathJax-Span-5388" style="font-family: MathJax_Main;">4</span><span class="texatom" id="MathJax-Span-5389"><span class="mrow" id="MathJax-Span-5390"><span class="mo" id="MathJax-Span-5391" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5392" style="font-family: MathJax_Main;">4</span><span class="mo" id="MathJax-Span-5393" style="font-family: MathJax_Main;">)</span><span class="mo" id="MathJax-Span-5394" style="font-family: MathJax_Main; padding-left: 0.216em;">−</span><span class="mn" id="MathJax-Span-5395" style="font-family: MathJax_Main; padding-left: 0.216em;">0</span><span class="texatom" id="MathJax-Span-5396"><span class="mrow" id="MathJax-Span-5397"><span class="mo" id="MathJax-Span-5398" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5399" style="font-family: MathJax_Main;">4</span><span style="display: inline-block; width: 0px; height: 4.003em;"></span></span><span style="position: absolute; clip: rect(3.096em 1000em 4.429em -0.424em); top: -1.117em; left: 0.003em;"><span class="mo" id="MathJax-Span-5400" style="font-family: MathJax_Main;">∗</span><span class="mi" id="MathJax-Span-5401" style="font-family: MathJax_Math-italic; padding-left: 0.216em;">l</span><span class="mi" id="MathJax-Span-5402" style="font-family: MathJax_Math-italic;">o</span><span class="mi" id="MathJax-Span-5403" style="font-family: MathJax_Math-italic;">g<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mn" id="MathJax-Span-5404" style="font-family: MathJax_Main;">2</span><span class="mo" id="MathJax-Span-5405" style="font-family: MathJax_Main;">(</span><span class="mn" id="MathJax-Span-5406" style="font-family: MathJax_Main;">0</span><span class="texatom" id="MathJax-Span-5407"><span class="mrow" id="MathJax-Span-5408"><span class="mo" id="MathJax-Span-5409" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5410" style="font-family: MathJax_Main;">4</span><span class="mo" id="MathJax-Span-5411" style="font-family: MathJax_Main;">)</span><span class="mo" id="MathJax-Span-5412" style="font-family: MathJax_Main;">]</span><span class="mo" id="MathJax-Span-5413" style="font-family: MathJax_Main; padding-left: 0.216em;">+</span><span class="mn" id="MathJax-Span-5414" style="font-family: MathJax_Main; padding-left: 0.216em;">5</span><span class="texatom" id="MathJax-Span-5415"><span class="mrow" id="MathJax-Span-5416"><span class="mo" id="MathJax-Span-5417" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5418" style="font-family: MathJax_Main;">14</span><span class="mo" id="MathJax-Span-5419" style="font-family: MathJax_Main; padding-left: 0.216em;">∗</span><span class="mo" id="MathJax-Span-5420" style="font-family: MathJax_Main; padding-left: 0.216em;">[</span><span class="mo" id="MathJax-Span-5421" style="font-family: MathJax_Main;">−</span><span class="mn" id="MathJax-Span-5422" style="font-family: MathJax_Main;">3</span><span class="texatom" id="MathJax-Span-5423"><span class="mrow" id="MathJax-Span-5424"><span class="mo" id="MathJax-Span-5425" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5426" style="font-family: MathJax_Main;">5</span><span class="mo" id="MathJax-Span-5427" style="font-family: MathJax_Main; padding-left: 0.216em;">∗</span><span class="mi" id="MathJax-Span-5428" style="font-family: MathJax_Math-italic; padding-left: 0.216em;">l</span><span class="mi" id="MathJax-Span-5429" style="font-family: MathJax_Math-italic;">o</span><span class="mi" id="MathJax-Span-5430" style="font-family: MathJax_Math-italic;">g<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mn" id="MathJax-Span-5431" style="font-family: MathJax_Main;">2</span><span class="mo" id="MathJax-Span-5432" style="font-family: MathJax_Main;">(</span><span class="mn" id="MathJax-Span-5433" style="font-family: MathJax_Main;">3</span><span class="texatom" id="MathJax-Span-5434"><span class="mrow" id="MathJax-Span-5435"><span class="mo" id="MathJax-Span-5436" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5437" style="font-family: MathJax_Main;">5</span><span class="mo" id="MathJax-Span-5438" style="font-family: MathJax_Main;">)</span><span class="mo" id="MathJax-Span-5439" style="font-family: MathJax_Main;">–</span><span class="mn" id="MathJax-Span-5440" style="font-family: MathJax_Main; padding-left: 0.163em;">2</span><span class="texatom" id="MathJax-Span-5441"><span class="mrow" id="MathJax-Span-5442"><span class="mo" id="MathJax-Span-5443" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5444" style="font-family: MathJax_Main;">5</span><span style="display: inline-block; width: 0px; height: 4.003em;"></span></span><span style="position: absolute; clip: rect(3.096em 1000em 4.429em -0.424em); top: 0.269em; left: 0.003em;"><span class="mo" id="MathJax-Span-5445" style="font-family: MathJax_Main;">∗</span><span class="mi" id="MathJax-Span-5446" style="font-family: MathJax_Math-italic; padding-left: 0.216em;">l</span><span class="mi" id="MathJax-Span-5447" style="font-family: MathJax_Math-italic;">o</span><span class="mi" id="MathJax-Span-5448" style="font-family: MathJax_Math-italic;">g<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mn" id="MathJax-Span-5449" style="font-family: MathJax_Main;">2</span><span class="mo" id="MathJax-Span-5450" style="font-family: MathJax_Main;">(</span><span class="mn" id="MathJax-Span-5451" style="font-family: MathJax_Main;">2</span><span class="texatom" id="MathJax-Span-5452"><span class="mrow" id="MathJax-Span-5453"><span class="mo" id="MathJax-Span-5454" style="font-family: MathJax_Main;">/</span></span></span><span class="mn" id="MathJax-Span-5455" style="font-family: MathJax_Main;">5</span><span class="mo" id="MathJax-Span-5456" style="font-family: MathJax_Main;">)</span><span class="mo" id="MathJax-Span-5457" style="font-family: MathJax_Main;">]</span><span class="mo" id="MathJax-Span-5458" style="font-family: MathJax_Main; padding-left: 0.269em;">=</span><span class="mn" id="MathJax-Span-5459" style="font-family: MathJax_Main; padding-left: 0.269em;">0.694</span><span style="display: inline-block; width: 0px; height: 4.003em;"></span></span></span></span><span style="display: inline-block; width: 0px; height: 6.296em;"></span></span></span><span style="border-left-width: 0.003em; border-left-style: solid; display: inline-block; overflow: hidden; width: 0px; height: 6.737em; vertical-align: -5.73em;"></span></span></nobr><script type="math/tex" id="MathJax-Element-100">Info(OUTLOOK) = 5/14 * [- 2/5 * log2(2/5) – 3/5 * log2(3/5)] + 4/14 * [ - 4/4 * log2(4/4) - 0/4 * log2(0/4)] + 5/14 * [ - 3/5 * log2(3/5) – 2/5 * log2(2/5)] = 0.694</script>
接着对所有属性计算
<nobr><span class="math" id="MathJax-Span-5460" style="width: 18.776em; display: inline-block;"><span style="display: inline-block; position: relative; width: 14.989em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(1.869em 1000em 3.203em -0.477em); top: -2.771em; left: 0.003em;"><span class="mrow" id="MathJax-Span-5461"><span class="mi" id="MathJax-Span-5462" style="font-family: MathJax_Math-italic;">I<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.056em;"></span></span><span class="mi" id="MathJax-Span-5463" style="font-family: MathJax_Math-italic;">n</span><span class="mi" id="MathJax-Span-5464" style="font-family: MathJax_Math-italic;">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.056em;"></span></span><span class="mi" id="MathJax-Span-5465" style="font-family: MathJax_Math-italic;">o</span><span class="mo" id="MathJax-Span-5466" style="font-family: MathJax_Main;">(</span><span class="mi" id="MathJax-Span-5467" style="font-family: MathJax_Math-italic;">T<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.109em;"></span></span><span class="mi" id="MathJax-Span-5468" style="font-family: MathJax_Math-italic;">E<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mi" id="MathJax-Span-5469" style="font-family: MathJax_Math-italic;">M<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.109em;"></span></span><span class="mi" id="MathJax-Span-5470" style="font-family: MathJax_Math-italic;">P<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.109em;"></span></span><span class="mi" id="MathJax-Span-5471" style="font-family: MathJax_Math-italic;">E<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mi" id="MathJax-Span-5472" style="font-family: MathJax_Math-italic;">R</span><span class="mi" id="MathJax-Span-5473" style="font-family: MathJax_Math-italic;">A</span><span class="mi" id="MathJax-Span-5474" style="font-family: MathJax_Math-italic;">T<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.109em;"></span></span><span class="mi" id="MathJax-Span-5475" style="font-family: MathJax_Math-italic;">U<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.109em;"></span></span><span class="mi" id="MathJax-Span-5476" style="font-family: MathJax_Math-italic;">R</span><span class="mi" id="MathJax-Span-5477" style="font-family: MathJax_Math-italic;">E<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mo" id="MathJax-Span-5478" style="font-family: MathJax_Main;">)</span><span class="mo" id="MathJax-Span-5479" style="font-family: MathJax_Main; padding-left: 0.269em;">=</span><span class="mn" id="MathJax-Span-5480" style="font-family: MathJax_Main; padding-left: 0.269em;">0.911</span></span><span style="display: inline-block; width: 0px; height: 2.776em;"></span></span></span><span style="border-left-width: 0.003em; border-left-style: solid; display: inline-block; overflow: hidden; width: 0px; height: 1.403em; vertical-align: -0.397em;"></span></span></nobr><script type="math/tex" id="MathJax-Element-101">Info(TEMPERATURE)=0.911</script>
<nobr><span class="math" id="MathJax-Span-5481" style="width: 15.629em; display: inline-block;"><span style="display: inline-block; position: relative; width: 12.483em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(1.869em 1000em 3.203em -0.477em); top: -2.771em; left: 0.003em;"><span class="mrow" id="MathJax-Span-5482"><span class="mi" id="MathJax-Span-5483" style="font-family: MathJax_Math-italic;">I<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.056em;"></span></span><span class="mi" id="MathJax-Span-5484" style="font-family: MathJax_Math-italic;">n</span><span class="mi" id="MathJax-Span-5485" style="font-family: MathJax_Math-italic;">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.056em;"></span></span><span class="mi" id="MathJax-Span-5486" style="font-family: MathJax_Math-italic;">o</span><span class="mo" id="MathJax-Span-5487" style="font-family: MathJax_Main;">(</span><span class="mi" id="MathJax-Span-5488" style="font-family: MathJax_Math-italic;">H<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.056em;"></span></span><span class="mi" id="MathJax-Span-5489" style="font-family: MathJax_Math-italic;">U<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.109em;"></span></span><span class="mi" id="MathJax-Span-5490" style="font-family: MathJax_Math-italic;">M<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.109em;"></span></span><span class="mi" id="MathJax-Span-5491" style="font-family: MathJax_Math-italic;">I<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.056em;"></span></span><span class="mi" id="MathJax-Span-5492" style="font-family: MathJax_Math-italic;">D</span><span class="mi" id="MathJax-Span-5493" style="font-family: MathJax_Math-italic;">I<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.056em;"></span></span><span class="mi" id="MathJax-Span-5494" style="font-family: MathJax_Math-italic;">T<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.109em;"></span></span><span class="mi" id="MathJax-Span-5495" style="font-family: MathJax_Math-italic;">Y<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.163em;"></span></span><span class="mo" id="MathJax-Span-5496" style="font-family: MathJax_Main;">)</span><span class="mo" id="MathJax-Span-5497" style="font-family: MathJax_Main; padding-left: 0.269em;">=</span><span class="mn" id="MathJax-Span-5498" style="font-family: MathJax_Main; padding-left: 0.269em;">0.789</span></span><span style="display: inline-block; width: 0px; height: 2.776em;"></span></span></span><span style="border-left-width: 0.003em; border-left-style: solid; display: inline-block; overflow: hidden; width: 0px; height: 1.403em; vertical-align: -0.397em;"></span></span></nobr><script type="math/tex" id="MathJax-Element-102">Info(HUMIDITY)= 0.789</script>
<nobr><span class="math" id="MathJax-Span-5499" style="width: 13.176em; display: inline-block;"><span style="display: inline-block; position: relative; width: 10.509em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(1.869em 1000em 3.203em -0.477em); top: -2.771em; left: 0.003em;"><span class="mrow" id="MathJax-Span-5500"><span class="mi" id="MathJax-Span-5501" style="font-family: MathJax_Math-italic;">I<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.056em;"></span></span><span class="mi" id="MathJax-Span-5502" style="font-family: MathJax_Math-italic;">n</span><span class="mi" id="MathJax-Span-5503" style="font-family: MathJax_Math-italic;">f<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.056em;"></span></span><span class="mi" id="MathJax-Span-5504" style="font-family: MathJax_Math-italic;">o</span><span class="mo" id="MathJax-Span-5505" style="font-family: MathJax_Main;">(</span><span class="mi" id="MathJax-Span-5506" style="font-family: MathJax_Math-italic;">W<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.109em;"></span></span><span class="mi" id="MathJax-Span-5507" style="font-family: MathJax_Math-italic;">I<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.056em;"></span></span><span class="mi" id="MathJax-Span-5508" style="font-family: MathJax_Math-italic;">N<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.109em;"></span></span><span class="mi" id="MathJax-Span-5509" style="font-family: MathJax_Math-italic;">D</span><span class="mi" id="MathJax-Span-5510" style="font-family: MathJax_Math-italic;">Y<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.163em;"></span></span><span class="mo" id="MathJax-Span-5511" style="font-family: MathJax_Main;">)</span><span class="mo" id="MathJax-Span-5512" style="font-family: MathJax_Main; padding-left: 0.269em;">=</span><span class="mn" id="MathJax-Span-5513" style="font-family: MathJax_Main; padding-left: 0.269em;">0.892</span></span><span style="display: inline-block; width: 0px; height: 2.776em;"></span></span></span><span style="border-left-width: 0.003em; border-left-style: solid; display: inline-block; overflow: hidden; width: 0px; height: 1.403em; vertical-align: -0.397em;"></span></span></nobr><script type="math/tex" id="MathJax-Element-103">Info(WINDY)=0.892</script>
信息增益
选出最大OutLook,然后把OutLook做节点,依靠不用属性分为多个集合,再对每个集合计算信息增益得到节点,直到不能再分。
我们得到决策树就可以把我们要分的属性依靠决策树来分,这个方法已经很老,现在比较少用
参考:http://shiyanjun.cn/archives/417.html
本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。欢迎转载、使用、重新发布,但务必保留文章署名林德熙(包含链接:http://blog.csdn.net/lindexi_gd ),不得用于商业目的,基于本文修改后的作品务必以相同的许可发布。如有任何疑问,请与我联系。
相关推荐
总结来说,数据挖掘ID3分类算法通过构建决策树的方式,为数据分类问题提供了一种高效的解决方法。通过对信息熵的深入理解和应用,ID3算法能够有效地从数据集中挖掘出隐藏的模式和关系。同时,随着数据挖掘技术的不断...
ID3(Iterative Dichotomiser 3)是数据挖掘中的一种经典决策树算法,由Ross Quinlan在1986年提出。ID3主要用于分类任务,通过构建一棵决策树来对未知数据进行预测。 ID3算法的核心思想是信息熵和信息增益。信息熵...
ID3算法是一种决策树学习方法,常用于数据挖掘中的分类任务。它由Ross Quinlan在1986年提出,其全称为Iterative Dichotomiser 3(迭代二分器3)。ID3算法主要基于信息熵和信息增益来选择最优特征,构建决策树模型。 ...
### 数据挖掘ID3决策树详解 #### 一、ID3决策树简介 ID3(Iterative Dichotomiser 3)是一种经典的决策树学习算法,由Ross Quinlan在1986年提出。该算法主要用于分类问题,通过递归地选择最优特征进行分割来构建决策...
数据挖掘技术是一种通过从大量数据中提取有价值信息和知识的过程,这一过程通过分析数据库、云端服务器或数据仓库等存储媒介中的大量数据信息,可以发现数据之间潜在的关联结构。数据挖掘技术在实际应用中的作用日益...
在数据挖掘中,ID3(Iterative Dichotomiser 3)算法是一种经典的决策树学习方法,由Ross Quinlan在1986年提出。ID3主要应用于分类任务,它通过构建一个树形结构来表示各种可能的决策路径。 ID3算法的核心思想是...
在数据挖掘中,ID3算法是一种经典的决策树学习方法,由Ross Quinlan于1986年提出,主要用于分类任务。本文将深入探讨ID3算法的原理、实现以及其在C++中的应用。 ID3算法基于信息熵和信息增益这两个概念。信息熵衡量...
总结来说,ID3算法是数据挖掘中的一个重要工具,它通过信息增益选择最优特征,构建决策树模型。在Java和C++中实现ID3算法,主要的区别在于编程语言特性和库的使用,但核心逻辑是一致的。理解并掌握ID3算法,不仅可以...
数据挖掘是一种从大量数据中提取或“挖掘”知识的过程,它是信息技术领域的重要组成部分。ID3(Iterative Dichotomiser 3)算法是早期的一种决策树学习方法,由Ross Quinlan于1986年提出,主要用于分类任务。本教程...
数据挖掘是一种从大量数据中发现有价值信息的过程,而ID3(Iterative Dichotomiser 3)算法是数据挖掘领域中决策树构建的一种经典方法,由Ross Quinlan于1986年提出。ID3算法主要用于分类任务,它通过信息熵和信息...
ID3(Iterative Dichotomiser 3)算法是数据挖掘中的一种决策树学习方法,由Ross Quinlan在1986年提出。这个算法主要用于分类任务,通过构建一个树形结构来表示特征与类别之间的关系。 ID3算法的核心思想是信息熵和...
大数据与数据挖掘
ID3数据挖掘 C语言版本 网络下载来的
聚类算法1
在数据挖掘领域,它常被用来进行分类任务,尤其适用于处理离散属性的数据集。C语言作为底层编程语言,因其高效性和灵活性,被广泛用于各种算法的实现,包括ID3算法。 ID3算法的核心思想是信息增益(Information ...
数据挖掘中的ID3算法选择具有最高信息熵增益的属性作为分裂属性 ID3算法是基于决策树的分类算法之一,该算法的核心思想是选择具有最高信息熵增益的属性作为分裂属性,从而将数据集分割成更小的子集,以便更好地分类...
总结起来,数据挖掘中的ID3算法是一种高效的决策树学习方法,通过C++实现可以加深对算法的理解并应用于实际问题。在这个过程中,不仅需要掌握ID3算法的理论知识,还要熟悉C++编程,尤其是数据结构和递归算法的应用。...
在Java编程语言中实现ID3算法可以帮助开发者深入理解其工作原理,并能应用于实际的数据挖掘项目。 1. **ID3算法基础**: - **信息熵**:度量一个数据集纯度的指标,熵越大,表示数据集的不确定性越高。 - **信息...
ID3算法,全称为Iterative Dichotomiser 3(迭代二分法3),是数据挖掘领域中一种经典的决策树学习算法,由Ross Quinlan于1986年提出。该算法主要用于分类任务,通过信息熵和信息增益来选择最佳属性进行划分,构建...