<p>The following script is from Trappenberg's Fundamentals of Computational Neuroscience and is used to test a perceptron's robustness against noise. </p>

<p>However, how would one alter it to test the output of a multilayer perceptron?</p>

<p>In particular, wOut and rIn are non-comformable because the wOut of a multilayer perceptron with 2 hidden layers is 26*2.</p>

<p>So how could I alter this to test the trained multilayer perceptron?</p>

<pre><code>%% Testing generalization perfroamnce of trained perceptron
 perceptron_network_sim; 
 letterMatrix=rIn; 
 for nflip = 1:80;    
    dist1=[]; dist2=[]; 
    for trial=1:10; 
       rIn=abs(letterMatrix-randomFlipMatrix(nflip)); 
       % Threshold output function
       rOut1=(wOut*rIn)&gt;0;
       nerror=0; 
       for j=1:26; nerror=nerror+(sum(rDes(:,j)~=rOut1(:,j))&gt;0); end 
       dist1=[dist1,nerror];
       % Max output function
       [v,i]=max(wOut*rIn);
       rOut2=zeros(26); for j=1:26; rOut2(i(j),j)=1; end
       dist2=[dist2,0.5*sum(sum(rDes~=rOut2))];
    end
    meanDist1(nflip)=mean(dist1); stdDist1(nflip)=std(dist1);
    meanDist2(nflip)=mean(dist2); stdDist2(nflip)=std(dist2);
 end
 figure; hold on;
 errorbar((1:80)/156,meanDist1,stdDist1,':')
 errorbar((1:80)/156,meanDist2,stdDist2,'r')
 xlabel('Fraction of flipped bits')
 ylabel('Average number of wrong letters')
</code></pre>

CC BY-SA 4.0
2020-04-08T12:42:55.817Z
Can you explain to us what multilayer perception is to place this question into perspective? Can you link your sources?
AliceD
<neuroscience><cognitive-neuroscience><theoretical-neuroscience><computational-modeling><neural-network>
Testing Multilayer Perceptron
syntheso
# Testing Multilayer Perceptron

(Asked by: username_0 on 2020-04-07)

The following script is from Trappenberg's Fundamentals of Computational Neuroscience and is used to test a perceptron's robustness against noise. 
However, how would one alter it to test the output of a multilayer perceptron?
In particular, wOut and rIn are non-comformable because the wOut of a multilayer perceptron with 2 hidden layers is 26*2.
So how could I alter this to test the trained multilayer perceptron?
%% Testing generalization perfroamnce of trained perceptron
 perceptron_network_sim; 
 letterMatrix=rIn; 
 for nflip = 1:80;    
    dist1=[]; dist2=[]; 
    for trial=1:10; 
       rIn=abs(letterMatrix-randomFlipMatrix(nflip)); 
       % Threshold output function
       rOut1=(wOut*rIn)>0;
       nerror=0; 
       for j=1:26; nerror=nerror+(sum(rDes(:,j)~=rOut1(:,j))>0); end 
       dist1=[dist1,nerror];
       % Max output function
       [v,i]=max(wOut*rIn);
       rOut2=zeros(26); for j=1:26; rOut2(i(j),j)=1; end
       dist2=[dist2,0.5*sum(sum(rDes~=rOut2))];
    end
    meanDist1(nflip)=mean(dist1); stdDist1(nflip)=std(dist1);
    meanDist2(nflip)=mean(dist2); stdDist2(nflip)=std(dist2);
 end
 figure; hold on;
 errorbar((1:80)/156,meanDist1,stdDist1,':')
 errorbar((1:80)/156,meanDist2,stdDist2,'r')
 xlabel('Fraction of flipped bits')
 ylabel('Average number of wrong letters')

**Tags:** neuroscience, cognitive-neuroscience, theoretical-neuroscience, computational-modeling, neural-network

> **Comments:**
> **username_1**: Can you explain to us what multilayer perception is to place this question into perspective? Can you link your sources?  

---

## 0 answers

