📄 get_dim_and_tr.asv
字号:
% The algorithms implemented by Alexander Vezhnevets aka Vezhnick
% <a>href="mailto:vezhnick@gmail.com">vezhnick@gmail.com</a>
%
% Copyright (C) 2005, Vezhnevets Alexander
% vezhnick@gmail.com
%
% This file is part of GML Matlab Toolbox
% For conditions of distribution and use, see the accompanying License.txt file.
%
% get_dim_and_tr is the function, that returns dimension and threshold of
% tree node
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%
% output = get_dim_and_tr(tree_node, output)
% ---------------------------------------------------------------------------------
% Arguments:
% tree_node - a node of classification tree
% output - vector of dimensions and thresholds.
% Return:
% tree_node_left - left node (result of splitting)
% tree_node_right - right node (result of splitting)
% split_error - error of splitting
function output = get_dim_and_tr(tree_node, output)
if(nargin < 2)
output = [];
end
if(length(tree_node.parent) > 0)
output = get_dim_and_tr(tree_node.parent, output);
end
output(end+1) = tree_node.dim;
if( length(tree_node.right_constrain) > 0)
output(end+1) = tree_node.right_constrain;
output(end+1) = -1;
elseif( length(tree_node.left_constrain) > 0)
output(end+1) = tree_node.left_constrain;
output(end+1) = +1;
end
% function [dim, tr, signum] = get_dim_and_tr(tree_node)
%
% dim = tree_node.dim;
%
%
%
% if( length(tree_node.right_constrain) > 0)
% tr = tree_node.right_constrain;
% signum = -1;
% end
% if( length(tree_node.left_constrain) > 0)
% tr = tree_node.left_constrain;
% signum = +1;
% end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -