1 %> Maximum entropy split criterion
for tree classifiers
5 %> L. Breiman, J.H. Friedman, R.A. Olshen, and C.J. Stone,
6 %> Classification and regression trees, Wadsworth, California, 1984.
13 %> Copyright: R.P.W. Duin, duin@ph.tn.tudelft.nl
14 %> Faculty of Applied Physics, Delft University of Technology
15 %> P.O. Box 5046, 2600 GA Delft, The Netherlands
16 function [grades, idx, threshold] = test(o, X, classes)
19 % -variable threshold is an (2c)x k matrix containing:
20 % minimum feature values class 1
21 % maximum feature values class 1
22 % minimum feature values class 2
23 % maximum feature values class 2
25 % -variable R (same size) contains:
26 % fraction of objects which is < min. class 1.
27 % fraction of objects which is > max. class 1.
28 % fraction of objects which is < min. class 2.
29 % fraction of objects which is > max. class 2.
31 % These values are collected and computed in the next loop:
32 threshold = zeros(2*c,k); R = zeros(2*c,k);
36 threshold([2*j-1:2*j],:) = zeros(2,k);
37 R([2*j-1:2*j],:) = zeros(2,k);
39 threshold(2*j-1,:) = min(X(L,:),[],1);
40 R(2*j-1,:) = sum(X < ones(m,1)*threshold(2*j-1,:),1);
41 threshold(2*j,:) = max(X(L,:),[],1);
42 R(2*j,:) = sum(X > ones(m,1)*threshold(2*j,:),1);
45 % From R the purity index for all features is computed:
47 % and the best feature is found:
48 [gmax,tmax] = max(G,[],1);
49 [grades,idx] = max(gmax);
51 if Tmax ~= 2*floor(Tmax/2)
52 threshold = (threshold(Tmax,idx) + max(X(find(X(:,idx) < threshold(Tmax,idx)),idx)))/2;
54 threshold = (threshold(Tmax,idx) + min(X(find(X(:,idx) > threshold(Tmax,idx)),idx)))/2;
57 irerror('Maximum Entropy Criterion not feasible for this decision tree!');
64 o.classtitle = 'Maximum Entropy Criterion';
Binary Decision Tree Classifier.