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

📄 kdist2.m

📁 support vector clustering for Matlab tool box
💻 M
字号:
function d=kdist2(X,model)

%==========================================================================
% KDIST2 Computes squared distance between vectors in kernel space.
%
% Synopsis:
%  d = kdist2(X,model)
%
% Description:
%  It computes distance between vectors mapped into the feature 
%  space induced by the kernel function (model.options.ker,
%  model.options.arg). The distance is computed between images
%  of vectors X [dim x num_data] mapped into feature space
%  and a point in the feature space given by model:
%
%   d(i) = kernel(X(:,i),X(:,i)) 
%          - 2*kernel(X(:,i),models.sv.X)*model.Alpha + b,
%
%  where b [1x1] is assumed to be equal to 
%   model.b = model.Alpha'*kernel(model.sv.X)*model.Alpha.
%
% Input:
%  X [dim x num_data] Input vectors.
%  model [struct] Deternines a point of the feature space:
%   .Alpha [nsv x 1] Multipliers.
%   .sv.X [dim x nsv] Vectors.
%   .b [1x1] Bias.
%   .options.ker [string] Kernel identifier (see 'help kernel').
%   .options.arg [1 x nargs] Kernel argument(s).
%
% Output:
%  d [num_data x 1] Squared distance between vectors in the feature space.
%
%==========================================================================
% January 13, 2009
% Implemented by Daewon Lee
% WWW: http://sites.google.com/site/daewonlee/
%==========================================================================

[dim,num_data]=size(X);

x2 = diagker( X, model.options.ker, model.options.arg);

Ksvx = kernel( X, model.sv.X, model.options.ker, model.options.arg);

d = x2 - 2*Ksvx*model.Alpha(:) + model.b*ones(num_data,1) ;

return;
% EOF

⌨️ 快捷键说明

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