<Chapter Label="thr_networks">
<Heading>Networks of Threshold Elements</Heading>
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.
<Section Label="thr_net_basic">
<Heading>Basic Operations</Heading>
In this section we describe some operations, similar to the ones described in Section
<Ref Chap="thr_basic"/>.
<ManSection>
<Func Name="NeuralNetwork" Arg="InnerLayer, OuterLayer"/>
<Description> <!-- The names chosen for the arguments describe their meaning.-->
For the list of threshold elements <C>InnerLayer</C> and the Boolean variable <C>OuterLayer</C>, which
can be either <C>true</C> (for disjunction), <C>false</C> (for conjunction), or <C>fail</C> (if there is only
one layer) the function <C>NeuralNetwork</C> returns a neural network built from this inputs.
<Example>
<![CDATA[
gap> te1:=ThresholdElement([1,1],1);
< threshold element with weight vector [ 1, 1 ] and threshold 1 >
gap> te2:=ThresholdElement([-1,-2],-2);
< threshold element with weight vector [ -1, -2 ] and threshold -2 >
gap> inner:=[te1,te2];
[ < threshold element with weight vector [ 1, 1 ] and threshold 1 >,
< threshold element with weight vector [ -1, -2 ] and threshold -2 > ]
gap> nn:=NeuralNetwork(inner,false);
< neural network with 2 threshold elements on inner layer and conjunction on outer level >
gap> Display(last);
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 ]
]]>
</Example>
</Description> </ManSection>
<ManSection>
<Func Name="IsNeuralNetwork" Arg="Obj"/>
<Description> <!-- The names chosen for the arguments describe their meaning.-->
For the object <C>Obj</C> the function <C>IsNeuralNetwork</C> returns <C>true</C> if
<C>Obj</C> is a neural network (see <Ref Func="NeuralNetwork" />), and <C>false</C> otherwise.
<Example>
<![CDATA[
gap> ## Consider the neural network <C>nn</C> from the previous example.
gap> IsNeuralNetwork(nn);
true
]]>
</Example>
</Description> </ManSection>
<ManSection>
<Func Name="OutputOfNeuralNetwork" Arg="NNetwork"/>
<Description> <!-- The names chosen for the arguments describe their meaning.-->
For the neural network <C>NNetwork</C> the function <C>OutputOfNeuralNetwork</C> returns the Boolean function, realized by <C>NNetwork</C>.
<Section Label="thr_net_net">
<Heading>Networks of Threshold Elements</Heading>
In this section we consider the networks of threshold elements.
<ManSection>
<Func Name="BooleanFunctionByNeuralNetwork" Arg="Func"/>
<Description> <!-- The names chosen for the arguments describe their meaning.-->
For the Boolean function <C>Func</C> the function <C>BooleanFunctionByNeuralNetwork</C> returns a two-layered neural network,
which realizes <C>Func</C> (see <Ref Func="NeuralNetwork" />).
The realization of this function is based on the algorithm proposed in <Cite Key="GecheRobotyshyn83"/>.
<Example>
<![CDATA[
gap> x:=Indeterminate(GF(2),"x");;
gap> y:=Indeterminate(GF(2),"y");;
gap> z:=Indeterminate(GF(2),"z");;
gap> f:=PolynomialToBooleanFunction(x*y+z,3);
< Boolean function of 3 variables >
gap> nn:=BooleanFunctionByNeuralNetwork(f);
< neural network with 2 threshold elements on inner layer and disjunction on outer level >
gap> Display(last);
Inner Layer:
[ [[ -1, -2, 4 ], 2], [[ 1, 2, -3 ], 3] ]
Outer Layer: disjunction
Neural Network realizes the function f :
Boolean function of 3 variables.
[ 0, 0, 0 ] || 0
[ 0, 0, 1 ] || 1
[ 0, 1, 0 ] || 0
[ 0, 1, 1 ] || 1
[ 1, 0, 0 ] || 0
[ 1, 0, 1 ] || 1
[ 1, 1, 0 ] || 1
[ 1, 1, 1 ] || 0
Sum of Products:[ 1, 3, 5, 6 ]
]]>
</Example>
</Description> </ManSection>
<ManSection>
<Func Name="BooleanFunctionByNeuralNetworkDASG" Arg="Func"/>
<Description> <!-- The names chosen for the arguments describe their meaning.-->
For the Boolean function <C>Func</C> the function <C>BooleanFunctionByNeuralNetworkDASG</C>
returns a two-layered neural network which realizes <C>Func</C> (see <Ref Func="NeuralNetwork" />).
The realization of this function is based on decomposition of <C>Func</C> by the non-unate
variables with the biggest influence. The DASG algorithm (DASG - Decomposition Algorithm
for Synthesis and Generalization) was proposed in <Cite Key="Subirats2008"/>,
however we use a slightly modified version of this algorithm.
<Example>
<![CDATA[
gap> f:=LogicFunction(3,2,[0,0,0,0,0,1,1,0]);
< Boolean function of 3 variables >
gap> nn:=BooleanFunctionByNeuralNetworkDASG(f);
< neural network with 2 threshold elements on inner layer and conjunction on outer level >
gap> Display(last);
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 ]
]]>
</Example>
</Description> </ManSection>
</Section>
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 und die Messung sind noch experimentell.