prune_tree_c45.m

来自「决策树算法的matlab实现」· M 代码 · 共 34 行

M
34
字号
function T = prune_tree_C45(T,A,B,CF)
% PRUNE_TREE_C45 prunes the decision tree T using the pruning algorithm from 
%	C4.5: Programs from Machine Learning.
%
%	T = prune_tree_C45(T,A,B,CF)
%
%	T : matrix representing decision tree generated by MSM-T algorithm
%	A: matrix representing the point set A
%	B: matrix representing the point set B
%	CF: certainty factor used in pruning.  0 <= CF <= 1.0
%
%	ASSUME: the root node will always remain

% coeff is a global variable and is accessible for function prune, prune_tree.

global coeff;
global CF;

% n is the dimension of the points in sets A,B
global n;
n = size(A,2);

% determine coeff:
coeff = prune_det_coeff_C45(CF);


% prune the tree
% first determine T_breakdown
T_breakdown = msmt_tree_breakdown(T_breakdown,T,A,B,1);
position = [ 1 ];
[T,error] = prune_C45(T,T_breakdown,0,[position,T(n+2,1)]);	% prune left
[T,error] = prune_C45(T,T_breakdown,1,[position,T(n+3,1)]);	% prune right

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?