-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnm_classifier.m
More file actions
24 lines (19 loc) · 815 Bytes
/
nm_classifier.m
File metadata and controls
24 lines (19 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
% nearest mean classifier
%
% INPUT: feat_norm - matrix with rows containing feature vectors of
% normal patients
% feat_alz - matrix with rows containing feature vectors of
% Alzheimer patients
% feat_test - feature vector to be classified
% OUTPUT: class - classification of 'feat_test' as normal (value>0) or
% Alzheimer (value<0)
function class = nm_classifier(feat_norm, feat_alz, feat_test)
%% average normal feature vector
V_norm = mean(feat_norm,1);
%% average Alzheimer feature vector
V_alz = mean(feat_alz,1);
%% distance of test feature to average normal and Alzheimer features
dn = norm(feat_test-V_norm);
da = norm(feat_test-V_alz);
%% class label (normal>0, Alzheimer<0)
class = (da-dn);