<h3>4 <span class="Heading">Networks of Threshold Elements</span></h3>
<p>Not all Boolean functions can be realized by a single threshold element. However, all of them can be realized by a multi-layered network of threshold elements, with a number of threshold elements on a first layer and conjunction or a disjunction on the second layer. In this chapter we will decribe some functions regarding such networks.</p>
<p>In this section we describe some operations, similar to the ones described in Section <a href="chap3_mj.html#X82EB5BE77F9F686A"><span class="RefLink">3.1</span></a>.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ NeuralNetwork</code>( <var class="Arg">InnerLayer</var>, <var class="Arg">OuterLayer</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>For the list of threshold elements <code class="code">InnerLayer</code> and the Boolean variable <code class="code">OuterLayer</code>, which can be either <code class="code">true</code> (for disjunction), <code class="code">false</code> (for conjunction), or <code class="code">fail</code> (if there is only one layer) the function <code class="code">NeuralNetwork</code> returns a neural network built from this inputs.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">te1:=ThresholdElement([1,1],1);</span>
< threshold element with weight vector [ 1, 1 ] and threshold 1 >
<span class="GAPprompt">gap></span> <span class="GAPinput">te2:=ThresholdElement([-1,-2],-2);</span>
< threshold element with weight vector [ -1, -2 ] and threshold -2 >
<span class="GAPprompt">gap></span> <span class="GAPinput">inner:=[te1,te2];</span>
[ < threshold element with weight vector [ 1, 1 ] and threshold 1 >,
< threshold element with weight vector [ -1, -2 ] and threshold -2 > ]
<span class="GAPprompt">gap></span> <span class="GAPinput">nn:=NeuralNetwork(inner,false);</span>
< neural network with
2 threshold elements on inner layer and conjunction on outer level >
<span class="GAPprompt">gap></span> <span class="GAPinput">Display(last);</span>
Inner Layer:
[ [[ 1, 1 ], 1], [[ -1, -2 ], -2] ]
Outer Layer: conjunction
Neural Network realizes the function f :
Boolean function of 2 variables.
[ 0, 0 ] || 0
[ 0, 1 ] || 1
[ 1, 0 ] || 1
[ 1, 1 ] || 0
Sum of Products:[ 1, 2 ]
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsNeuralNetwork</code>( <var class="Arg">Obj</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>For the object <code class="code">Obj</code> the function <code class="code">IsNeuralNetwork</code> returns <code class="code">true</code> if <code class="code">Obj</code> is a neural network (see <code class="func">NeuralNetwork</code> (<a href="chap4_mj.html#X780C027786A8E34B"><span class="RefLink">4.1-1</span></a>)), and <code class="code">false</code> otherwise.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">## Consider the neural network <C>nn</C> from the previous example.</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsNeuralNetwork(nn);</span>
true
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ BooleanFunctionByNeuralNetwork</code>( <var class="Arg">Func</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>For the Boolean function <code class="code">Func</code> the function <code class="code">BooleanFunctionByNeuralNetwork</code> returns a two-layered neural network, which realizes <code class="code">Func</code> (see <code class="func">NeuralNetwork</code> (<a href="chap4_mj.html#X780C027786A8E34B"><span class="RefLink">4.1-1</span></a>)). The realization of this function is based on the algorithm proposed in <a href="chapBib_mj.html#biBGecheRobotyshyn83">[GPR83]</a>.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ BooleanFunctionByNeuralNetworkDASG</code>( <var class="Arg">Func</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>For the Boolean function <code class="code">Func</code> the function <code class="code">BooleanFunctionByNeuralNetworkDASG</code> returns a two-layered neural network which realizes <code class="code">Func</code> (see <code class="func">NeuralNetwork</code> (<a href="chap4_mj.html#X780C027786A8E34B"><span class="RefLink">4.1-1</span></a>)). The realization of this function is based on decomposition of <code class="code">Func</code> by the non-unate variables with the biggest influence. The DASG algorithm (DASG - Decomposition Algorithm for Synthesis and Generalization) was proposed in <a href="chapBib_mj.html#biBSubirats2008">[SJF08]</a>, however we use a slightly modified version of this algorithm.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=LogicFunction(3,2,[0,0,0,0,0,1,1,0]);</span>
< Boolean function of 3 variables >
<span class="GAPprompt">gap></span> <span class="GAPinput">nn:=BooleanFunctionByNeuralNetworkDASG(f);</span>
< neural network with 2 threshold elements on inner layer and conjunction on outer level >
<span class="GAPprompt">gap></span> <span class="GAPinput">Display(last);</span>
Inner Layer:
[ [[ 1, 4, 2 ], 3], [[ 1, -4, -2 ], -3] ]
Outer Layer: conjunction
Neural Network realizes the function f :
Boolean function of 3 variables.
[ 0, 0, 0 ] || 0
[ 0, 0, 1 ] || 0
[ 0, 1, 0 ] || 0
[ 0, 1, 1 ] || 0
[ 1, 0, 0 ] || 0
[ 1, 0, 1 ] || 1
[ 1, 1, 0 ] || 1
[ 1, 1, 1 ] || 0
Sum of Products:[ 5, 6 ]
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.