Model Neuron MC Culloch Pitts
Model Neuron MC Culloch Pitts
X2
0
1
0
1
Y
0
1
1
1
1
X1
1
Y
1
X2
W1 =1, W2 = 1, threshold = 1
Penyelesaian:
X1
X2
N = X1 W1 +X2 W2
Y=f(N)=0 if N<1
Y=f(N) =1 if N>=1
0
0.1+0.1=0
0
1
0.1+1.1=1
1
1.1+0.1=1
1
1.1+1.1=2
b. X-OR
Fungsi logika OR dengan dua masukan X1 dan X2 akan memiliki keluaran Y=0 bila dan
hanya bila X1=X2.
c.
d.
e.
f.
0
i.
0
l.
1
o.
1
r.
g.
0
j.
1
m.
0
p.
1
h.
0
k.
1
n.
1
q.
0
u. Z2 = (X2 X1)
W1 =-1, W2 = 2, threshold = 2
v. Y = N = Z1 Z2
W1 =1, W2 = 1, threshold = 1
w.
Layar tersembunyi
2
Z1
X1
-1
Y
f
1
-1
2
OR
Z2
f
X2
x. Penyelesaian:
y.
X
z.
X
aa.
~
ab.
~
ah.
0
ai.
0
aj.
1
ak.
1
ac. Z1 = (X1
X2)
ad. Z2 = (X2
X1)
al. 0
am.0
ae. N=
Z1
Z2
an. 0.1+
0.1=
0
af. Y=f(N)=0 if
N<1
ag. Y=f(N) =1 if
N>=1
ao. 0
ap.
0
aq.
1
ar.
1
as.
0
aw. 1
at. 0
au. 1
av. 0.1+
1.1=
1
ax.
1
ay.
0
az.
0
ba.
1
bb. 1
bc. 0
bd. 1.1+
0.1=
1
bf.
1
bg.
1
bh.
0
bi.
0
be. 1
bm.
bj. 0
bk. 0
bl. 0.1+
0.1=
0
bn.
2. Terjemahkanlah ke dalam program mengenai model neuron Mc Culloch-Pitss
dengan dua masukan x1 dan x2 untuk menyatakan fungsi logika AND, OR dan
X-OR.
bo. Pseudocode dalam bahasa c++:
bp. #include <cstdlib>
bq. #include <iostream>
br.
bs. using namespace std;
bt.
bu. int main(int argc, char *argv[])
bv. {
bw.
int n[4],a[4];
bx.
int x1[4] = {0, 0, 1, 1};
by.
int x2[4] = {0, 1, 0, 1};
bz.
int target[4] = {0, 0, 0, 1};
ca.
int target2[4] = {0, 1, 1, 1};
cb.
int target3[4] = {0, 1, 1, 0};
cc.
int w=1;
cd.
cout<<"JST-Model Neuron McCulloch-Pitts";
ce.
cout<<"\n\n#gerbang AND\n\n";
cf.
cout<<"[x1]\t[x2]\t[N]\t[target]\t[Y]\n\n";
cg.
for(int i=0; i<4; i++){
ch.
n[i]= w*x1[i]+w*x2[i];
ci.
if(n[i]<2){
cj.
a[i]=0;
ck.
}
cl.
else{
cm.
a[i]=1;
cn.
}
co.
cout<<" "<<x1[i]<<"\t "<<x2[i]<<"\t "<<n[i]<<"\t "<<target[i]<<"\t\t
"<<a[i]<<"\n";
cp.
cq.
cr.
cs.
ct.
cu.
cv.
cw.
cx.
cy.
cz.
da.
db.
cout<<"\n\n#gerbang OR\n\n";
cout<<"[x1]\t[x2]\t[N]\t[target]\t[Y]\n\n";
for(int i=0; i<4; i++){
n[i]= w*x1[i]+w*x2[i];
if(n[i]<1){
a[i]=0;
}
else{
a[i]=1;
}
cout<<" "<<x1[i]<<"\t "<<x2[i]<<"\t "<<n[i]<<"\t "<<target2[i]<<"\t\t
"<<a[i]<<"\n";
dc.
}
dd.
de.
cout<<"\n\n#gerbang XOR\n\n";
df.
int w0[2]={-1, 2};
dg.
int z1[4],z2[4],a1[4],n1[4],n2[4];
dh.
cout<<"[x1]\t[x2]\t[z1]\t[z2]\t[N]\t[target]\t[Y]\n\n";
di.
for(int i=0; i<4; i++){
dj.
n1[i]= w0[1]*x1[i]+w0[0]*x2[i];
dk.
if(n1[i]<2){
dl.
z1[i]=0;
dm.
}
dn.
else{
do.
z1[i]=1;
dp.
}
dq.
dr.
n2[i]= w0[0]*x1[i]+w0[1]*x2[i];
ds.
if(n2[i]<2){
dt.
z2[i]=0;
du.
}
dv.
else{
dw.
z2[i]=1;
dx.
}
dy.
n[i]= w*z1[i]+w*z2[i];
dz.
if(n[i]<1){
ea.
a1[i]=0;
eb.
}
ec.
else{
ed.
a1[i]=1;
ee.
}
ef.
cout<<" "<<x1[i]<<"\t "<<x2[i]<<"\t"<<z1[i]<<"\t"<<z2[i]<<"\t
"<<n[i]<<"\t "<<target3[i]<<"\t\t "<<a1[i]<<"\n";
eg.
}
eh.
ei.
ej. }
ek.
system("pause");
return 0;
em.