|
|
Intro Network Classes Overview Data Classes Overview Packages havBpNet:J Home Page
Random Presentation Order
havTdata provides a mechanism for randomizing the presentation order of training patterns in a data set. Patterns in an instance of havTdata may be randomized (in terms of their order) by sending a Randomize() message to the data set. Subsequent calls to retrieve a pattern can then be made using the GetRandPat(...) message as illustrated in the following excerpt:
static boolean show_selection_order = false; // controls train pass reporting
. . .
havTpat pat; // working ref to current pat in use
. . .
//=============== training section of main training loop
train_data.Randomize(); // Randomize the training pattern presentation order
if (show_selection_order)
train_data.ShowRandList();
for (i=0; i<number_of_train_patterns; i++) { // Loop for each training pattern
pat = train_data.GetRandPat(i);
in.PutValue(pat.GetPat()); // put input pattern in input layer
hid.Cycle(); // feed forward through the network
out.Cycle();
out.PutExpected(pat.GetExp()); // Put the expected response in the output layer
out.Train(); // Calculate error and update weights
hid.Train();
}
//============== end of training section of main training loop
|
You are responsible for re-randomizing the order of patterns in the data-set by sending the Randomize() message whenever the patterns’ order should be changed. In our applications, we typically do this after each pass through the training set when the training epoch (batch) size is smaller than the total number of patterns in the training set.
Intro Network Classes Overview Data Classes Overview Packages
Copyright © 1998 by hav.Software. All Rights Reserved.