mse_classifier.m

来自「包含用lms、mse、perceptron准则函数的二类分类器」· M 代码 · 共 35 行

M
35
字号
function a = mse_classifier(feature1,feature2);
 
%-----------------------------------------------------
% a = mse_classifier(feature1,feature2)
% Function calculates the weight vector for the linear discriminant function
% for the two-category data  based on the minimum squared-error and
% pseudoinverse
% Input variables:
% - feature1 - augmented feature vector for the first class
% - feature2 - augmented feature vector for the second class

% Output:
% a - Weight vector (a0,a1,a2)' for the linear discriminant of the form: 
% g(x) = a0 + a1*x1 + a2*x2 

% --------------------------------------------------
% Evgeny Krestyannikov
% krestyan@cs.tut.fi
% Institute of Signal Processing
% Room TE 313

% Creating of augmented feature vector
sz= size(feature1,2);

feature2=-feature2;
Y = [feature1 feature2]';
b1=ones(1,sz);
b2=ones(1,sz);
b=[b1 b2]';


% Finding the matrix Y pseudoinverse
Y_pseudoinv=inv(Y'*Y)*Y';
a=Y_pseudoinv*b;

⌨️ 快捷键说明

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