LearnSOFM;
The LearnSOFM method learns a Kohonen self-organizing map.
Values of synapse weights are corrected in the process of learning.
Short learning algorithm:
Selection of input vector of the network (array of input data).
Normalization of input values (if required). Use the methods INeuralNetwork.NormalizeInputValues, INeuralNetwork.NormalizeInputValuesEx.
Calling of the INeuralNetwork.PropagateSOFM method for calculation of distance between neurons in the selected input vector.
Calling of the LearnSOFM method. This method determines the "winner" and its neighbors and then changes weights of their synapses.
Definition of map error. Use the INeuralNetwork.GetError method.
Process of learning can be repeated several times. One iteration is called an epoch of learning.
As an example, a function is given, which input has a Kohonen self-organizing map fed into (the Net parameter). To execute the example, add links to the NN, IO system assemblies.
Function m_Learn(Net: NeuralNetwork): NeuralNetwork;
Var
epoch, learnRadius: Integer;
learnRate: Double;
NetFile: File;
TextW: ITextWriter;
Begin
TextW := NetFile.OpenTextWriter("C:/LearnRes.txt", True);
For epoch := 1 To 300 Do
learnRate := 0.6 * ((300 - epoch) / 300);
learnRadius := (3 * ((300 - epoch) / 350)) As Integer;
Net.SetLearnRadius(learnRadius);
Net.SetLearnRate(learnRate);
Net.SetUseVectorScalar(True);
Net.PropagateSOFM;
Net.LearnSOFM;
TextW.WriteLnString("Epoch of learning '" + epoch.ToString + "'. Error Code " + Net.GetError.ToString);
End For;
Return Net;
End Function m_Learn;
After executing the example the network is learned. The algorithm of scalar multiple vector multiplication is used to calculate the distance between neurons. Results are written to the file C:/LearnRes.txt.
See also: