电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

matlab实现的C4.5分类决策树算法VIP免费

matlab实现的C4.5分类决策树算法_第1页
1/6
matlab实现的C4.5分类决策树算法_第2页
2/6
matlab实现的C4.5分类决策树算法_第3页
3/6
function D = C4_5(train_features, train_targets, inc_node, region) % Classify using Quinlan's C4.5 algorithm % Inputs: % features - Train features % targets - Train targets % inc_node - Percentage of incorrectly assigned samples at a node % region - Decision region vector: [-x x -y y number_of_points] % % Outputs % D - Decision sufrace %NOTE: In this implementation it is assumed that a feature vector with fewer than 10 unique values (the parameter Nu) %is discrete, and will be treated as such. Other vectors will be treated as continuous [Ni, M] = size(train_features); inc_node = inc_node*M/100; Nu = 10; %For the decision region N = region(5); mx = ones(N,1) * linspace (region(1),region(2),N); my = linspace (region(3),region(4),N)' * ones(1,N); flatxy = [mx(:), my(:)]'; %Preprocessing %[f, t, UW, m] = PCA(train_features, train_targets, Ni, region); %train_features = UW * (train_features - m*ones(1,M));; %flatxy = UW * (flatxy - m*ones(1,N^2));; %Find which of the input features are discrete, and discretisize the corresponding %dimension on the decision region discrete_dim = zeros(1,Ni); for i = 1:Ni, Nb = length(unique(train_features(i,:))); if (Nb <= Nu), %This is a discrete feature discrete_dim(i) = Nb; [H, flatxy(i,:)] = high_histogram(flatxy(i,:), Nb); end end %Build the tree recursively disp( 'Building tree') tree = make_tree(train_features, train_targets, inc_node, discrete_dim, max(discrete_dim), 0); %Make the decision region according to the tree disp( 'Building decision surface using the tree') targets = use_tree(flatxy, 1:N^2, tree, discrete_dim, unique(train_targets)); D = reshape(targets,N,N); %END function targets = use_tree(features, indices, tree, discrete_dim, Uc) %Classify recursively using a tree targets...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

matlab实现的C4.5分类决策树算法

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部