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_...

88 lines
2.9 KiB
Matlab

function words_perceptual_advantage_asynconset2()
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
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 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)+context;
end
end
%define images with "numerical" 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)+numbers;
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);
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
human=[81,86.7,63.3,61.7];
figure(5),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,0.8,2.3]);
axis(hAx(2),[0.5,2.5,60,93]);
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.3]);
axis(hAx(2),[0.5,2.5,60,93]);
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_asynconset2.pdf')