📄 findsvandbsv.m
字号:
%=====================================================================
%% FindSVandBSV
% ------------
%% Parameters: % Samples - The matrix hold the data points.
% beta - The vector of the Lagrangian multipliers.
% C - Defines the fraction of points which are allowed% to become outliers.% (p = 1/CN where N is the the total sampels number).% % Return Value:% SV - This matrix holds the Support vectors.
% nof_SV - The number of Support vectors produced.% BSV - This matrix holds the outliers.
% nof_BSV - The number of outliers produced.% %% Finds the support vectors and outliers (Bounded Support Vectors)
% of a cluster.
%
%=====================================================================function [SV,nof_SV,BSV,nof_BSV] = FindSVandBSV(Samples,beta,C)[attr,N] = size(Samples);% initializationBSV = zeros(attr,N);SV = zeros(attr,N);nof_BSV = 0;nof_SV = 0;for i = 1:N % BSV - outliers ( only when beta equlas C - the upper bound) if beta(i) == C; nof_BSV = nof_BSV + 1; BSV(:, nof_BSV) = Samples(:,i); % SV - beta is between 0 and C elseif beta(i) > 1e-6 % epsilon nof_SV = nof_SV + 1; SV(:,nof_SV) = Samples(:,i); end end% Corrects the matrics sizesBSV = BSV(:, 1:nof_BSV);SV = SV(:,1:nof_SV);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -