Information Technology Reference
In-Depth Information
receptive fields of the hidden units). Thus, it would
be convenient to arrange it so that the training process
stops when the error goes to zero. Any statistic can pro-
vide a means for stopping the process it is attached to,
by simply setting a flag and establishing the conditions
under which stopping should occur. For training, we
will edit the squared error statistic object in the training
process.
c_float*
lrate;
\
// learning rate
c_int* hid_kwta; \
// activity of the hidden layer
The types of these variables start with a c_ ,which
indicates that they are really just pointers to internal,
hard-coded C/C++ variables that were created when
PDP++ itself was compiled. Thus, there is an important
distinction between variables defined within the script,
and hard coded variables. Script variables can point to
these hard coded variables, but they must be treated dif-
ferently since the script does not actually own the under-
lying variables (it just points to them). We will establish
this pointing relationship in the constructor.
Next, let's define some functions:
Right-click on the ..SE_Stat in the loop_stats
of the Train_Trn process.
Notice that the se field has some stopcrit param-
eters, which specify the stopping criteria parameters.
Click the toggle button on, to indicate that there is
a stopping criterion associated with this statistic value,
and just leave the <= and 0 parameters as is.
Thus, when the se value gets less than or equal to
zero, this statistic will signal the training process to
stop running. Now, when you Run the training process
again, you should see that it stops just as the red error
line goes to zero.
void Run();
\
// #BUTTON run training
void RunTest();
\
// #BUTTON run testing
void Train(); \
// #BUTTON display training windows
void Test(); \
// #BUTTON display testing windows
B.6
Creating an Overall Control Panel
and we also need one helper function that iconifies
all the windows before turning on other windows, and
of course the constructor for initializing things, and the
closing bracket:
The last thing we will do with the simulation is to cre-
ate one of those overall control panels that have been
so handy in the exercises. We will put some important
spec parameters in this control panel, and include some
buttons for switching between training and testing win-
dows and logs, and running the training and testing pro-
cesses. A control panel is really just a script object that
is edited to create an edit dialog, just like we did with
the environment creation script above.
void EverythingOff();
\
// iconify all windows
ConstrCtrl();
\
// constructor
};
Go through the same steps of creating a new script
object, set the file name to constr_ctrl.css , and edit
this file.
We start the script just like we did before, creating a
new type of object:
Now, we define the constructor:
ConstrCtrl::ConstrCtrl() {
// point lrate to the actual lrate parameter
lrate = .specs.ConSpec.lrate;
// point hid_kwta to actual parameter
hid_kwta = .specs.HiddenLayer.kwta.k;
}
class ConstrCtrl {
// control panel for the tutorial \
on constructing simulations
public:
where we just specify the path to the actual parame-
ter to point the c_ variables to these actual hard coded
parameters.
Then, we define the functions for running the training
and testing processes, which simply call the appropriate
functions:
Again, we start with some parameters. We will just
put in the learning rate and the activity level of the hid-
den layer.
Search WWH ::




Custom Search