📄 distfromcenter.m
字号:
%===============================================================================%% 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -