⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fda_test.m

📁 Fisher线性判别分类器源代码
💻 M
字号:
function LABEL_TEST=FDA_TEST(SAMPLES,WEIGHTS,INTERCEPT);
%Use the trained Fisher linear classifier to classify data
%USAGE: LABEL_TEST=FDA_TEST(SAMPLES,WEIGHTS,INTERCEPT)
%INPUT:
%SAMPLES is a matrix for the data to be classified, each column is a data
%sample, [WEIGHTS,INTERCEPT] are parameters for the classifier obtained by
%the training process from 'FDA_TRAIN'
%OUTPUT:
%LABEL_TEST is a row vector of the classification results for SAMPLES, 
%the label will be given as -1/1 for the two classes
%
%See also: FDA_TRAIN
%
% Dan.Zhang 2006-08-17
% d-zhang@mails.tsinghua.edu.cn

if(nargin~=3)
    fprintf('Error: Not the Correct Input.\n');
    return;
end
DimNum=size(SAMPLES,1);
WeiNum=size(WEIGHTS,2);
if(DimNum~=WeiNum)
    fprintf('Error: SAMPLES and WEIGHTS mismatch.\n');
    return;
end 

LABEL_TEST=WEIGHTS*SAMPLES-INTERCEPT;
LABEL_TEST(find(LABEL_TEST>=0))=1;
LABEL_TEST(find(LABEL_TEST<0))=-1;

⌨️ 快捷键说明

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