/GML_AdaBoost_Matlab_Toolbox_0.3/@tree_node_w/get_dim_and_tr.m
Objective C | 60 lines | 54 code | 6 blank | 0 comment | 5 complexity | e67dafc1e21d5f1a7a550130a01d5a0c MD5 | raw file
- % 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. Result fo
- % current node would be concatinated to it
- % Return:
- % output - a vector of thresholds and dimensions. It has the
- % following format:
- % [dimension threshold left/right ...]
- % left/right is [-1, +1] number, wich signifies if
- % current threshold is eather left or right
-
- 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