⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 homog2.m

📁 st ptool
💻 M
字号:
function [NX]=homog2(X,I)
% HOMOG2 introduces homogenous coordinates.
% [NX]=homog2(X,I)
%
% HOMOG2 adds one constant coordinate to a training set so
%   that the original task of finding arbitrary placed hyperplane
%   becomes simpler. More precisely, the original task is to find
%   a vector alpha and a threshold theta (determining hyperplane)
%   for which holds
%           alpha' * x >= theta   for any x from the first class
%           alpha' * x < theta    for any x from the second class
%
%   After adding of one constant coordinate the original task
%   changes to equivalent one where the goal is to find nalpha
%   (hyperplane going through the origin) for which holds
%           nalpha' * nx >= 0   for any nx from the first class
%           nalpha' * nx <  0   for any nx from the second class
%
% Input:
%    X [NxM] is a matrix containing M points in N-dimensional
%       feature space. So that X=[x1,x2 ...xM] and xs are
%       column vectors.
%    I [1xM] is a vector of class labels for each point. In this
%       case possible value is 1 for first class or 2 for
%       second class.
%
% Output:
%    NX [NxM] is matrix of transformed points.
%
% See also CTRANSF.
%

% Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac
% (c) Czech Technical University Prague, http://cmp.felk.cvut.cz
% Written Vojtech Franc (diploma thesis) 24.10.1999
% Modifications

I=-(I*2-3);
NX=[X;ones(1,size(X,2))].*repmat(I,size(X,1)+1,1);

return;

⌨️ 快捷键说明

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