prune_tree_points.m

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

M
26
字号
function T = prune_tree_points(T,A,B,min_points)
% PRUNE_TREE_POINTS prunes the decision tree T as follows:  if any decision
%	node misclassifies less than min_points points, then this decision
%	node will be made a leaf node.
%
%	T = prune_tree_points(T,A,B,min_points)
%
%	T : matrix representing the decision tree generated by MSM-T algorithm
%	A : matrix representing the point set A
%	B : matrix representing the point set B
%	min_points: the minimum allowable number of misclassified points at
%		a decision node.
%
%	ASSUME: the root node will never be pruned.

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

% prune the tree
position = [ 1 ];
T = prune_points(T,A,B,min_points,0,[position, T(n+2,1)]); % prune left
T = prune_points(T,A,B,min_points,1,[position, T(n+3,1)]); % prune right


⌨️ 快捷键说明

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