-
Notifications
You must be signed in to change notification settings - Fork 0
/
myPlotFLD.m
42 lines (37 loc) · 985 Bytes
/
myPlotFLD.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function [ output_args ] = myPlotFLD( class )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
n = 256;
max1 = max(class.features(:,1));
max2 = max(class.features(:,2));
min1 = min(class.features(:,1));
min2 = min(class.features(:,2));
H0 = class.features(class.target == 0,:);
H1 = class.features(class.target == 1,:);
range1 = max1-min1;
range2 = max2-min2;
a1 = 2*range1/(n-1);
a2 = 2*range2/(n-1);
len = size(class.features,1);
for i = 1:n
for j = 1:n;
fig((i-1)*n+j,1) = min1-range1/2+a1*(i-1);
fig((i-1)*n+j,2) = min2-range2/2+a2*(j-1);
end %for j
end %for i
decision = myRunFLD(fig,class);
xtest = reshape(decision,n,n);
x1 = [min1-range1/2,max1+range1/2];
x2 = [min2-range2/2,max2+range2/2];
figure()
imagesc(x1,x2,xtest)
colormap hsv;
colorbar;
title('Decision Surface of FLD Classifier')
xlabel('Feature 1')
ylabel('Feature 2')
hold on
plot(H1(:,1),H1(:,2),'r*');
plot(H0(:,1),H0(:,2),'bo');
legend('H1','H0')
end