|
|
Intro Network Classes Overview Data Classes Overview Packages havBpNet:J Home Page
Restoring a Network
Restoring havBpNet nodelists, layers and nodes is accomplished using alternate constructors defined for the havBpNodeList, havBpLayer and havBpNode classes. Use of these alternate constructors is illustrated in the following code excerpt which restores our xortrain.java example network:.
net_file = new FileInputStream(netfile); // open the SAVE file biasValue = havSys.readDouble(net_file); // first restore the private information havBpNodeList net = new havBpNodeList(net_file); // followed by the nodelist and havBpLayer bias = new havBpLayer(net, net_file); // then restore the network layers havBpLayer in = new havBpLayer(net, net_file); // using the same order in which they havBpLayer hid = new havBpLayer(net, net_file); // were saved havBpLayer out = new havBpLayer(net, net_file); net_file.close(); |
It is the user’s responsibility to open the save file and to ensure that the file pointer is appropriately positioned for the restore operation. Correct file pointer positioning can most easily be ensured by performing the restore in the same order that was used during the network save.
Also notice the explicit read required to handle the application-specific information that we saved in the SAVE file.
Notice that there is no need to perform explicit Connect(...) operations on the restored network. This is accomplished automatically as the network’s layers are restored.
Layer creation initializes the layer with training enabled. If the network is being restored for consultation and if there will be Train() messages sent to any of the layers for error determination, it is the user’s responsibility, after restoring a network, to ensure that weight adjustment is ennabled or disabled as needed.
Intro Network Classes Overview Data Classes Overview Packages
Copyright © 1998 by hav.Software. All Rights Reserved.