INeuralNetwork.LearnSOFM

Fore Syntax

LearnSOFM;

Fore.NET Syntax

LearnSOFM();

Description

The LearnSOFM method learns a Kohonen self-organizing map.

Comments

Values of synapse weights are corrected in the process of learning.

Short learning algorithm:

Process of learning can be repeated several times. One iteration is called an epoch of learning.

Fore Example

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.

Fore.NET Example

As an example a function is given, which input has neural network fed into (the Net parameter).

Imports System.IO;
Imports Prognoz.Platform.Interop.NN;

Public Shared Function m_Learn(Net: NeuralNetwork): NeuralNetwork;
Var
    epoch, learnRadius: Integer;
    learnRate: Double;
    NetFile: StreamWriter;
Begin
    NetFile := File.CreateText("C:/LearnRes.txt");
    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();
        NetFile.WriteLine("Epoch of learning '" + epoch.ToString() + "'. Error code: " + Net.GetError().ToString());
    End For;
    NetFile.Close();
    Return Net;
End Function;

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:

INeuralNetwork