linclass.m
来自「this a SVM toolbox,it is very useful for」· M 代码 · 共 34 行
M
34 行
function [Ipred, Fx ]=linclass(X,alpha,theta)
% LINCLASS classifier based on linear discriminat function.
% [Ipred, Fx ]=linclass(X,alpha,theta)
%
% LINCLASS is the classifier based on a linear decision rule.
% The matrix X contains patterns to be classified into to classes.
% The linear classifier is detrmined by the vector alpha and
% the threshold theta.
% The result of the classifier is the vector J containing class labels.
%
% The classifier rule is:
% class 1 -> alpha'*x >= theta
% class 2 -> alpha'*x < theta
%
% Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac
% (c) Czech Technical University Prague, http://cmp.felk.cvut.cz
% Written Vojtech Franc (diploma thesis) 02.01.2000
% Modifications
% 24. 6.00 V. Hlavac, comments polished.
K=size(X,2); % # of samples
DIM=size(X,1); % dimension
E=ones(1,K);
Fx=alpha(:)'*X-theta*E;
Ypred = sign( Fx );
Ypred( find( Ypred == 0 )) = 1;
Ipred = sgntoi( Ypred );
return;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?