distfromcenter.m

来自「这个是支持向量聚类机用matlab编译的主程序和部分子程序」· M 代码 · 共 35 行

M
35
字号
%===============================================================================%%   DistFromCenter: %   ---------------%%   Parameters:   %       Samples  - This matrix holds the data points.%       N        - The number of samples.%       beta     - The Lagrangian multipliers%		q		- The width of the gaussian kernel.%       x        - The point to calculate its distance from the sphere's center. %                   %   Return Value:%       distance - The distance of point x's image from the sphere's center   %%   Computes the distance of point x's image from the sphere center% %================================================================================function [distance] = DistFromCenter(Samples,N,beta,q,x)% initializationk = zeros(N,1);% Calculate the dot product of x's image, with each data point's imagefor j = 1:N    k(j) = GaussianKernel(Samples(:,j),x,q);    %   SumOverj(beta(j)*K(Samples(j),X)的值end% K(x,x)kdiag = GaussianKernel(x,x,q); % =1   K(X,X)的值distance = kdiag - 2*beta'*k;

⌨️ 快捷键说明

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