simple logic in the matsumsig model
Again, just simple foundational ideas. Simple logic in the MatSumSig model:
d = a OR b OR c
[ d ] = [ BF[x1] ] [ 1 1 1 ] [ BF[x1] ] [ a ]
[ BF[x2] ] [ b ]
[ BF[x3] ] [ c ]
d = a AND b AND c
[ d ] = [ BF[x1] ] [ 1/3 1/3 1/3 ] [ BF[x1] ] [ a ]
[ BF[x2] ] [ b ]
[ BF[x3] ] [ c ]
d = a XOR b XOR c
[ d ] = [ XF[x1] ] [ 1 1 1 ] [ BF[x1] ] [ a ]
[ BF[x2] ] [ b ]
[ BF[x3] ] [ c ]
f = (a AND b AND c) OR (d AND e)
[ f ] = [ BF[x1] ] [ 1 1 ] [ BF[x1] ] [ 1/3 1/3 1/3 0 0 ] [ BF[x1] ] [ a ]
[ BF[x2] ] [ 0 0 0 1/2 1/2 ] [ BF[x2] ] [ b ]
[ BF[x3] ] [ c ]
[ BF[x4] ] [ d ]
[ BF[x5] ] [ e ]
where BF[x] and XF[x] are sigmoids:
def binary_filter(x):
if x <= 0.96:
return 0
else:
return 1
def xor_filter(x):
if 0.96 <= x and x <= 1.04:
return 1
else:
return 0
Update: now let's do the same in BKO. A 2 element truth table:
pattern |row-1> => 0|a> + 0|b>
pattern |row-2> => |a> + 0|b>
pattern |row-3> => 0|a> + |b>
pattern |row-4> => |a> + |b>
OR-2 |a> => |x1>
OR-2 |b> => |x1>
AND-2 |a> => 0.5|x1>
AND-2 |b> => 0.5|x1>
OR |*> #=> push-float binary-filter OR-2 binary-filter pattern |_self>
AND |*> #=> push-float binary-filter AND-2 binary-filter pattern |_self>
XOR |*> #=> push-float xor-filter OR-2 binary-filter pattern |_self>
sa: table[row,pattern,OR,AND,XOR] ket-sort starts-with |row->
+-------+----------+----+-----+-----+
| row | pattern | OR | AND | XOR |
+-------+----------+----+-----+-----+
| row-1 | 0 a, 0 b | 0 | 0 | 0 |
| row-2 | a, 0 b | 1 | 0 | 1 |
| row-3 | 0 a, b | 1 | 0 | 1 |
| row-4 | a, b | 1 | 1 | 0 |
+-------+----------+----+-----+-----+
Cool, huh!
Update: let's do a 3 element truth table:
pattern |row-1> => 0|a> + 0|b> + 0|c>
pattern |row-2> => 0|a> + 0|b> + |c>
pattern |row-3> => 0|a> + |b> + 0|c>
pattern |row-4> => 0|a> + |b> + |c>
pattern |row-5> => |a> + 0|b> + 0|c>
pattern |row-6> => |a> + 0|b> + |c>
pattern |row-7> => |a> + |b> + 0|c>
pattern |row-8> => |a> + |b> + |c>
OR-3 |a> => |x1>
OR-3 |b> => |x1>
OR-3 |c> => |x1>
AND-3 |a> => 0.333|x1>
AND-3 |b> => 0.333|x1>
AND-3 |c> => 0.333|x1>
OR |*> #=> push-float binary-filter OR-3 binary-filter pattern |_self>
AND |*> #=> push-float binary-filter AND-3 binary-filter pattern |_self>
XOR |*> #=> push-float xor-filter OR-3 binary-filter pattern |_self>
sa: table[row,pattern,OR,AND,XOR] ket-sort starts-with |row->
+-------+---------------+----+-----+-----+
| row | pattern | OR | AND | XOR |
+-------+---------------+----+-----+-----+
| row-1 | 0 a, 0 b, 0 c | 0 | 0 | 0 |
| row-2 | 0 a, 0 b, c | 1 | 0 | 1 |
| row-3 | 0 a, b, 0 c | 1 | 0 | 1 |
| row-4 | 0 a, b, c | 1 | 0 | 0 |
| row-5 | a, 0 b, 0 c | 1 | 0 | 1 |
| row-6 | a, 0 b, c | 1 | 0 | 0 |
| row-7 | a, b, 0 c | 1 | 0 | 0 |
| row-8 | a, b, c | 1 | 1 | 0 |
+-------+---------------+----+-----+-----+
That is even cooler! And I hope it helps to show the mapping between the MatSumSig model, and the BKO scheme.
I guess it would also be useful to give the OR-k and AND-k matrices:
sa: matrix[OR-2]
[ x1 ] = [ 1 1 ] [ a ]
[ b ]
sa: matrix[AND-2]
[ x1 ] = [ 0.5 0.5 ] [ a ]
[ b ]
sa: matrix[OR-3]
[ x1 ] = [ 1 1 1 ] [ a ]
[ b ]
[ c ]
sa: matrix[AND-3]
[ x1 ] = [ 0.33 0.33 0.33 ] [ a ]
[ b ]
[ c ]
Update: Let's do the compound example:
f = (a AND b AND c) OR (d AND e)
[ f ] = [ BF[x1] ] [ 1 1 ] [ BF[x1] ] [ 1/3 1/3 1/3 0 0 ] [ BF[x1] ] [ x1 ]
[ BF[x2] ] [ 0 0 0 1/2 1/2 ] [ BF[x2] ] [ x2 ]
[ BF[x3] ] [ x3 ]
[ BF[x4] ] [ x4 ]
[ BF[x5] ] [ x5 ]
Now in BKO:
-- define our patterns:
pattern |row-1> => 0|x1> + 0|x2> + 0|x3> + 0|x4> + 0|x5>
pattern |row-2> => |x1> + 0|x2> + 0|x3> + 0|x4> + 0|x5>
pattern |row-3> => 0|x1> + |x2> + 0|x3> + 0|x4> + 0|x5>
...
-- define our operators:
AND-3-2 |x1> => 0.333|x1>
AND-3-2 |x2> => 0.333|x1>
AND-3-2 |x3> => 0.333|x1>
AND-3-2 |x4> => 0.5|x2>
AND-3-2 |x5> => 0.5|x2>
OR-2 |x1> => |x1>
OR-2 |x2> => |x1>
f |*> #=> push-float binary-filter OR-2 binary-filter AND-3-2 binary-filter pattern |_self>
And the matrices:
sa: matrix[OR-2]
[ x1 ] = [ 1 1 ] [ x1 ]
[ x2 ]
sa: matrix[AND-3-2]
[ x1 ] = [ 0.33 0.33 0.33 0 0 ] [ x1 ]
[ x2 ] [ 0 0 0 0.5 0.5 ] [ x2 ]
[ x3 ]
[ x4 ]
[ x5 ]
Update: let's be more terse with our sigmoid names.
binary-filter => BF
xor-filter => XF
And then we have:
OR |*> #=> push-float BF OR-3 BF pattern |_self>
AND |*> #=> push-float BF AND-3 BF pattern |_self>
XOR |*> #=> push-float XF OR-3 BF pattern |_self>
f |*> #=> push-float BF OR-2 BF AND-3-2 BF pattern |_self>
Cool. I like the compact version better.
Home
previous: simple inhibitory signals in the matsumsig model
next: set union and intersection in the matsumsig model
updated: 19/12/2016
by Garry Morrison
email: garry -at- semantic-db.org