calc_output.asv

来自「该文件里面包含了三个AdaBoost算法」· ASV 代码 · 共 34 行

ASV
34
字号
%   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.
%
%   calc_output Implements classification of input by a classification tree node
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%
%    y = calc_output(tree_node, XData)
%    ---------------------------------------------------------------------------------
%    Arguments:
%           tree_node - classification tree node
%           XData     - data, that will be classified
%    Return:
%           y         - 1, if belongs 

function y = calc_output(tree_node, XData)
y = XData(tree_node.dim, :) * 0 + 1;


for i = 1 : length(tree_node.parent)
  y = y .* calc_output(tree_node.parent, XData);
end

if( length(tree_node.right_constrain) > 0)
  y = y .* ((XData(tree_node.dim, :) < tree_node.right_constrain));
end
if( length(tree_node.left_constrain) > 0)
  y = y .* ((XData(tree_node.dim, :) > tree_node.left_constrain));
end

⌨️ 快捷键说明

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