CreateNetworkEx(
numberOfLayers: Integer;
numberOfInputs: Integer;
Var numberOfNeuronsInLayers: Array;
initializeSynapsysMaxValue: Double;
NeuronSigmoidFuncsType: Integer);
numberOfLayers. The number of layers in the created network. Usually, a network consists of two layers of neurons.
numberOfInputs. The number of network input elements. Each neuron of the first layer contains the given number of synapses.
numberOfNeuronsInLayers. Integer array of neurons in each layer. If the network consists of two layers, the array should contain two elements.
initializeSynapsysMaxValue. Non-negative value for initialization of synapses of each neuron.
NeuronSigmoidFuncsType. The type of signal propagation function in the network.
The CreateNetworkEx method creates a neural network according to the assigned parameters.
The process of learning can be started for the created network, after which the network is ready for work. The network can be used for error back-propagation networks and for Kohonen self-organizing network.
After creating the network the synapses can be initialized using the INeuralNetwork.SetSynapse or INeuralNetwork.ImportSynapses method.
The range of network output values depends on the type of signal propagation. Available values of the NeuronSigmoidFuncsType parameter:
0. Default value. Exponential function (sigmoid) is used. Range of output values is shifted: [-0.5; 0.5].
1. Threshold function is used that returns true if the calculated value is less than zero, and false if the calculated value is greater than zero. Respectively, the output values will consist of zeros and ones.
2. Function of hyperbolic tangent (similar to sigmoid). Range of output values: [-1.0; 1.0].
3. Exponential function (sigmoid). Range of output values is shifted: [-0.5; 0.5].
4. Exponential function (sigmoid). Range of output values: [0.0; 1.0].
5. Exponential function (bipolar sigmoid). Range of output values: [-1.0; 1.0].
Executing the example requires the file C:\NetDefenition.txt in the file system. Add links to the NN and IO system assemblies.
Function m_CreateNetworkEx: NeuralNetwork;
Var
Net: NeuralNetwork;
ar: Array[2] Of Integer;
SynVal: Double;
NetFile: File;
TextW: ITextWriter;
Begin
Net := New NeuralNetwork.Create;
ar[0] := 3;
ar[1] := 2;
Net.CreateNetworkEx(2, 2, ar, 0.5, 3);
NetFile := New File.Create;
TextW := NetFile.OpenTextWriter("C:/NetDefenition.txt", True);
TextW.WriteLnString(Net.ExportSynapses);
SynVal := Net.GetSynapse(0, 0, 0);
SynVal := SynVal + 0.05;
Net.SetSynapse(SynVal, 0, 0, 0);
TextW.WriteLnString("----------------");
TextW.WriteLnString(Net.ExportSynapses);
Return Net;
End Function m_CreateNetworkEx;
The example describes creating a neural network consisting of two layers. The first layer contains three neurons. Each neuron contains two input elements. The second layer consists of two neurons. The weight of the first synapse for the first neuron of the first layer is obtained and enlarged. Network description before the change of the synapse weight value and after is written to the file C:\NetDefenition.txt.
See also: