INeuralNetwork.InitSynapses

Fore Syntax

InitSynapses(MaxAbsoluteValue: Double; layerIndex: Integer);

Fore.NET Syntax

InitSynapses(MaxAbsoluteValue: double; layerIndex: integer);

Parameters

MaxAbsoluteValue. Maximum value of the synapse weight.

layerIndex. Layer index.

Description

The InitSynapses method sets values of synapse weights for the specified layer according to the set parameters.

Comments

InitSynapses generates values for synapses of all the neurons of the specified layer. Indexation of the layers is continuous and starts with zero.

The following methods can also be used to set values of synapse weights:

Fore Example

As an example a function is given, which input has neural network fed into (the Net parameter), as well as the logical parameter Layer that defines the method of weights generation. If Layer is set to True, values of synapse weights for different layers are generated by using different methods. If Layer is set to False, all the weights are generated by one method.

To execute the example, add a link to the NN system assembly.

Function m_InitSynapses(Net: NeuralNetwork; Layer: Boolean): NeuralNetwork;
Var
    lCount, i: Integer;
Begin
    If Layer Then
        // initialize synapses by different methods
        lCount := Net.GetNumberOfLayers;
        For i := 0 To lCount - 1 Do
            net.InitSynapsesConvexEx(i);
        End For;
        Net.InitSynapses(0.9, lCount - 1);
    Else
        // initialize all the synapses by one method 
        Net.InitSynapsesConvex;
    End If;
    Return Net;
End Function m_InitSynapses;

After executing the example the values of synapse weights are generated by the selected method.

Fore.NET Example

As an example a function is given, which input has neural network fed into (the Net parameter), as well as the logical parameter Layer that defines the method of weights generation. If Layer is set to True, values of synapse weights for different layers are generated by using different methods. If Layer is set to False, all the weights are generated by one method.

Imports Prognoz.Platform.Interop.NN;

Public Shared Function m_InitSynapses(Net: NeuralNetwork; Layer: Boolean): NeuralNetwork;
Var
    lCount, i: Integer;
Begin
    If Layer Then
        // initialize synapses by different methods
        lCount := Net.GetNumberOfLayers();
        For i := 0 To lCount - 1 Do
            net.InitSynapsesConvexEx(i);
        End For;
        Net.InitSynapses(0.9, lCount - 1);
    Else
        // initialize all the synapses by one method
        Net.InitSynapsesConvex();
    End If;
    Return Net;
End Function;

After executing the example the values of synapse weights are generated by the selected method.

See also:

INeuralNetwork