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.
Cognition/words_perceptual_advantage_...

99 lines
3.2 KiB
Matlab

function words_perceptual_advantage_asynconset7()
incFeedback=1;
close all
%define network
[W,alpha,mImage,nLetters]=words_weights(incFeedback);
%define input patterns
wordcontext=zeros(mImage,1);
wordcontext([encode_letter('w'),logical(zeros(1,14)),encode_letter('r'),encode_letter('d')])=1;%W_RD
letter=zeros(mImage,1);
letter([logical(zeros(1,14)),encode_letter('o'),logical(zeros(1,28))])=1; %_O__
psudocontext=zeros(mImage,1);
psudocontext([encode_letter('w'),logical(zeros(1,14)),encode_letter('r'),encode_letter('l')])=1;%W_RL
offset=75;
onset=ceil((1+(2-1)*offset)/2);
ratios=[1,2];
X=zeros(mImage,offset+1,4);%X is three-dimensional, to allow for time-varying stimulus
%define images with normal word context
k=0;
for r=ratios
k=k+1;
for t=onset:offset
X(:,t,k)=letter;
end
for t=fix(offset-r*(offset-onset)):offset
X(:,t,k)=X(:,t,k)+wordcontext;
end
end
%define images with psudoword context
for r=ratios
k=k+1;
for t=onset:offset
X(:,t,k)=letter;
end
for t=fix(offset-r*(offset-onset)):offset
X(:,t,k)=X(:,t,k)+psudocontext;
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}(nLetters+15,:); %record response of node selective for letter "o" in 2nd 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(5),clf
plot(resp','LineWidth',2),axis([0,offset,0,5])
legend(['blank '
'word context ';
'blank ';
'psudo context '],'Location','Best')
set(gca,'FontSize',15);
xlabel('time'),ylabel('activation')
set(gcf,'PaperSize',[18 12],'PaperPosition',[0 0 18 12]);
human=[74,82.2,68.7,75.7];
figure(6),clf
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,1,2.365]);
axis(hAx(2),[0.5,2.5,67.5,85]);
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,1,2.365]);
axis(hAx(2),[0.5,2.5,67.5,85]);
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),'relative duration'),
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_asynconset7.pdf')