資源簡介
ID3的Matlab實現,其中包含了四個源碼文件,熵函數、類別熵函數、遞歸建立決策樹部分、主程序。
代碼片段和文件信息
function?entro?=?entro_calculated(x)
????%?%?calculate?the?entropy
????Elem_x?=?unique(x);?%?find?all?possible?elements?of?Y
????num_x?=?length(Elem_x);?%?the?number?of?possible?cases?of?Y
????denominator?=?length(x);
????prob?=?zeros(num_x1);
????Info?=?zeros(num_x1);
????for?i?=?1:num_x
????????index?=?(x?==?Elem_x(i));
????????prob(i)?=?sum(index)/denominator;
????????Info(i)?=?prob(i)*log(prob(i));
????end
????entro?=?-sum(prob.*Info)/log(2);?%?unified?as?bit
end
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????15777??2014-03-12?16:25??balance_scale.png
?????文件???????6250??2014-03-07?20:00??balance-scale.data
?????文件???????2222??2014-03-07?20:00??balance-scale.names
?????文件???????5089??2014-03-12?16:41??balloon.png
?????文件????????160??2014-03-11?22:58??balloons.data
?????文件???????1104??2014-03-07?19:59??balloons.names
?????文件????????493??2014-03-05?20:20??E_category.m
?????文件????????488??2014-03-05?16:21??entro_calculated.m
?????文件????????254??2014-03-12?16:26??GolfPlay.mat
?????文件???????4388??2014-03-12?16:27??GolfPlay.png
?????文件????????447??2014-03-12?16:11??ID3_tree.m
?????文件????????408??2014-03-07?20:06??lenses.data
?????文件???????1644??2014-03-07?20:06??lenses.names
?????文件???????5222??2014-03-12?16:45??lenses.png
?????文件????????123??2014-03-12?15:37??preproc_balance_scale.asv
?????文件????????192??2014-03-12?16:11??preproc_balance_scale.m
?????文件????????226??2014-03-12?16:40??preproc_balloons.m
?????文件?????????62??2014-03-12?16:27??preproc_GolfPlay.m
?????文件?????????83??2014-03-12?16:32??preproc_lenses.m
?????文件???????2113??2014-03-12?00:45??recurrent_step.asv
?????文件???????2119??2014-03-12?00:46??recurrent_step.m
-----------?---------??----------?-----??----
????????????????48864????????????????????21
評論
共有 條評論