You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
3.7 KiB
Matlab
116 lines
3.7 KiB
Matlab
function words_perceptual_advantage_asynconset4()
|
|
incFeedback=1;
|
|
close all
|
|
|
|
%define network
|
|
[W,alpha,mImage,nLetters]=words_weights(incFeedback);
|
|
|
|
%define input patterns
|
|
context=zeros(mImage,1);
|
|
context([encode_letter('k'),encode_letter('n'),logical(zeros(1,14)),encode_letter('t')])=1;%KN_T
|
|
letter=zeros(mImage,1);
|
|
letter([logical(zeros(1,28)),encode_letter('i'),logical(zeros(1,14))])=1; %__I_
|
|
numbers=zeros(mImage,1);
|
|
numbers([encode_letter('3'),encode_letter('3'),logical(zeros(1,14)),encode_letter('3')])=1;%alternative context
|
|
|
|
contextMask=zeros(mImage,1);
|
|
contextMask([encode_letter('*'),encode_letter('*'),logical(zeros(1,14)),encode_letter('*')])=1;%**_*
|
|
letterMask=zeros(mImage,1);
|
|
letterMask([logical(zeros(1,28)),encode_letter('*'),logical(zeros(1,14))])=1; %__*_
|
|
|
|
period(1,:)=1:25;
|
|
period(2,:)=26:50;
|
|
offset=60;
|
|
X=zeros(mImage,offset,4);%X is three-dimensional, to allow for time-varying stimulus
|
|
|
|
%define images with normal context
|
|
k=0;
|
|
for r=1:2
|
|
k=k+1;
|
|
for t=[period(1,:),period(2,:)];
|
|
X(:,t,k)=context;
|
|
end
|
|
for t=t+1:offset
|
|
X(:,t,k)=contextMask;
|
|
end
|
|
for t=period(r,:)
|
|
X(:,t,k)=X(:,t,k)+letter;
|
|
end
|
|
for t=t+1:offset
|
|
X(:,t,k)=X(:,t,k)+letterMask;
|
|
end
|
|
end
|
|
%define images with "numerical" context
|
|
for r=1:2
|
|
k=k+1;
|
|
for t=[period(1,:),period(2,:)];
|
|
X(:,t,k)=numbers;
|
|
end
|
|
for t=t+1:offset
|
|
X(:,t,k)=contextMask;
|
|
end
|
|
for t=period(r,:)
|
|
X(:,t,k)=X(:,t,k)+letter;
|
|
end
|
|
for t=t+1:offset
|
|
X(:,t,k)=X(:,t,k)+letterMask;
|
|
end
|
|
end
|
|
|
|
%present each input to the network in turn and record the results
|
|
for k=1:size(X,3)
|
|
x=X(:,:,k);
|
|
[y,e,r,yTrace]=dim_activation_hierarchical(W,x,incFeedback,offset);
|
|
resp(k,:)=yTrace{1}(2*nLetters+9,:); %record response of node selective for letter i in 3rd position
|
|
respMean(k)=mean(resp(k,:));
|
|
|
|
figure(k),clf, words_plot_results(x,y,r,alpha);
|
|
c=0; for t=1:ceil(size(X,2)/8):size(X,2), for l=1:4, c=c+1; subplot(22,4,56+c), letter=X(1+(l-1)*14:l*14,t,k);draw_letter(letter);end,end
|
|
end
|
|
figure(6),clf
|
|
plot(resp','LineWidth',2),axis([0,offset,0,5])
|
|
legend(['target off 1st (word) ';
|
|
'context on 1st (word) ';
|
|
'target off 1st (digit)';
|
|
'context on 1st (digit)'],'Location','Best')
|
|
set(gca,'FontSize',15);
|
|
xlabel('time'),ylabel('activation')
|
|
set(gcf,'PaperSize',[18 12],'PaperPosition',[0 0 18 12]);
|
|
|
|
|
|
|
|
human=[71.5,75,56,53];
|
|
|
|
|
|
figure(7),clf
|
|
ratios=[1:2];
|
|
axes('Position',[0.2,0.2,0.6,0.6]),
|
|
cm='r';
|
|
ch=[0.5,0,0.5];
|
|
[hAx,hLine1,hLine2] = plotyy(ratios,respMean(1:2),ratios,human(1:2));
|
|
set(hLine1,'LineStyle','-','Color',cm,'Marker','o','LineWidth',2,'MarkerFaceColor',cm)
|
|
set(hLine2,'LineStyle','-','Color',ch,'Marker','s','LineWidth',2,'MarkerFaceColor',ch)
|
|
axis(hAx(1),[0.5,2.5,0.8,2.2]);
|
|
axis(hAx(2),[0.5,2.5,50,80]);
|
|
set(hAx(1),'FontSize',12);set(hAx(1),'XColor','k','YColor',cm)
|
|
set(hAx(2),'FontSize',12);set(hAx(2),'XColor','k','YColor',ch)
|
|
set(hAx(1),'XTick',[],'YTick',[]),
|
|
set(hAx(2),'XTick',[],'YTick',[])
|
|
|
|
|
|
hold on
|
|
[hAx,hLine1,hLine2] = plotyy(ratios,respMean(3:4),ratios,human(3:4));
|
|
set(hLine1,'LineStyle','--','Color',cm,'Marker','o','LineWidth',2,'MarkerFaceColor',cm)
|
|
set(hLine2,'LineStyle','--','Color',ch,'Marker','s','LineWidth',2,'MarkerFaceColor',ch)
|
|
axis(hAx(1),[0.5,2.5,0.8,2.2]);
|
|
axis(hAx(2),[0.5,2.5,50,80]);
|
|
set(hAx(1),'FontSize',12);set(hAx(1),'XColor','k','YColor',cm)
|
|
set(hAx(2),'FontSize',12);set(hAx(2),'XColor','k','YColor',ch)
|
|
set(hAx(1),'XTick',[],'YTick',[0:0.5:4])
|
|
set(hAx(2),'XTick',ratios,'YTick',[60:10:90]),
|
|
xlabel(hAx(2),'condition'),
|
|
ylabel(hAx(1),'mean activation','Color',cm,'FontSize',12),
|
|
ylabel(hAx(2),'% correct','Color',ch,'FontSize',12)
|
|
set(gcf,'PaperSize',[8 7],'PaperPosition',[0 0 8 8]);
|
|
print(gcf, '-dpdf', 'words_perceptual_advantage_asynconset4.pdf')
|