INeuralNetwork.ImportSynapses

Syntax

ImportSynapses(synapsysData: String): Boolean;

Parameters

synapsysData. String view of the values of the synapse weights.

Description

The ImportSynapses method loads values of synapse weights from the string view.

Comments

The method returns execution result. Available values:

The values of the weights can be loaded only from the string view of the network returned by the INeuralNetwork.ExportSynapses method. Unlike the INeuralNetwork.CreateNetwork method this method loads only the values of synapse weights. This means that the network has already been created.

Example

Executing the example requires the file C:\NetDefenition.txt in the file system; the file contains string view of the neural network. Add links to the NN and IO system assemblies.

Function m_ImportSynapses(Net: NeuralNetwork): Boolean;
Var
    NetFile: File;
    TextR: ITextReader;
    SynVal: String;
    res: Boolean;
Begin
    NetFile := New File.Create;
    TextR := NetFile.OpenTextReader("C:/NetDefenition.txt");
    Repeat
        SynVal := SynVal + TextR.ReadLine + " ";
    Until TextR.Eof;
    res := Net.ImportSynapses(SynVal);
    If res Then
        WinApplication.ErrorBox("Loading of values of synapse weights is completed!");
    Else
        WinApplication.ErrorBox("Error during loading values of synapse weights!");
    End If;
    Return res;
End Function m_ImportSynapses;

This function loads the values of the synapse weights from the file C:\NetDefenition.txt.

See also:

INeuralNetwork