-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuo_nn_Xyplot.m
62 lines (62 loc) · 1.5 KB
/
uo_nn_Xyplot.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
function uo_nn_Xyplot(Xds,yds,wo)
cla;hold off;
sig = @(X) 1./(1+exp(-X));
y = @(X,w) sig(w'*sig(X));
acc = @(Xds,yds,wo) 100*sum(yds==round(y(Xds,wo)))/size(Xds,2);
num = zeros(7,5);
%
iwo=1; if size(wo,1)==0, wo=zeros(35,1); iwo=0; end
%
posi = 1;
posf = size(Xds,2);
iplot = 0;
%
% iplot : = 0 -> plot every position
% : = 1 -> plot only wrong recognitions.
if iplot == 0
n=posf-posi+1;
sp_r = round(sqrt(2*n/5));
sp_c = ceil((posf-posi+1)/sp_r);
range = posi:posf;
else
range =[];
for i=posi:posf
if round(y(Xds(:,i),wo)) ~= yds(i)
range =[range,i];
end
n=size(range,2);
sp_r = 1;
sp_c = n;
end
end
im = zeros(1,n);
isp = 0;
for i=range
if iplot== 0 || (iplot == 1 && round(y(Xds(:,i),wo)) ~= yds(i))
for j=1:7
num(j,1:5)=Xds((j-1)*5+1:(j-1)*5+5,i);
end
isp = isp+1;
im(i)=subplot(sp_r,sp_c,isp);
imagesc(num); set(gca,'YTicklabel',[],'XTicklabel',[]);
title(num2str(i),'FontSize',12);
if ~iwo
colormap(gray)
else
if round(y(Xds(:,i),wo)) == yds(i)
if yds(i)==1
colormap(im(i),summer);
else
colormap(im(i),winter);
end
else
if yds(i)==1
colormap(im(i),autumn);
else
colormap(im(i),spring);
end
end
end
end
end
end