Build your own network
From Emergent
Start by creating a new project: File/New Project -- the New Project dialog will appear.
If the 'of type' button does not say 'LeabraProject' already, then click the button to display the chooser:
Select "LeabraProject" then click Ok. Click Ok on the type dialog. The new project will be displayed:
- Open the 'wizards' tree item and click on the LeabraWizard.
- In the Defaults menu button, choose 'Three Layer Net' (nothing visible will happen.)
- In the Network menu button, choose 'Std Network' -- the StdNetwork dialog will appear -- leave the 'net' button as is, and click Ok. The new network will appear in the T3 frame.
- In the Data menu button, choose 'Std Input Data' -- the StdInputData dialog will appear.
- net: choose the network you just made
- data table: leave blank (this will be created)
- n_patterns: set this to a small number, ex. 3
- group: leave unchecked
- Click Ok.
You can find your new table in the browser under data/InputData subgroup/StdInputData.
Notice a few things about the table.
- The Name column is a place to put a distinct name for each pattern. This can be used in log files, or in programs.
- The Input column is a matrix-type column -- it corresponds in dimension to the Input layer of your network. Each cell in the matrix will contain the value (from 0.0 to 1.0) that will get presented to the network during training and testing, in the Leabra 'plus' phase.
- The Output column is also a matrix-type column -- it corresponds in dimensions to the Output layer of your network -- this will contain the value that you want your network to learn when it is presented with the Input pattern for that table entry (row).
Now, we will make some input and output patterns. For this demo, we will make a vertical line, a horizontal line, and a diagonal line. To edit a matrix value, first click in the matrix cell at the top, then select a matrix entry in the bottom and type the new value. To make a line, just type 1 in successive cells, in the appropriate direction for that row. Since we are going to train the net to output the same thing as the input, just enter the same values in the Output column. You can also select a line or block of cells with the mouse, and then right click and choose Copy, move to the Output table, upper left cell of your destination, and right click Paste.
You can also enter descriptive names for the rows in the 'name' column. When you are finished, your first row should look something like this:
Now we will create the output data tables -- these are tables that Emergent uses to log statistics about your network during training or testing. In the wizard Data menu button, choose 'Std Output Data' -- the output data gets made and can be viewed in the OutputData subgroup. You can add additional columns if there are additional values you wish to log. (See Data_Tables for more information on tables.)
The last step is to make the standard Programs that will run the network -- a library of standard Programs is provided with Emergent -- in many cases, the standard Programs are sufficient to run the network. To create the standard Programs return to the LeabraWizard (click on this in the left hand browser window, if necessary) and select Std Progs from the Programs menu at the bottom right.
As you work on more advanced simulations, you may want to add some additional logging, get data from external files, and so on, in which case you can usually customize the standard Programs with a few simple additional elements. (See Programs for more information on programming.)
Let's run the network!
Got to programs/LeabraBatch. Click Init. Then click Run -- your network should start running, and you should see it operating in the T3 viewer. Depending on how fast is your computer, you should observe that each pattern is presented twice in succession; the first time is the "minus" phase, in which the network is allowed to run free -- since we started with initially random weights, the output will be random; the second phase is the "plus phase", in this phase, the network output is clamped to the desired value; the Leabra algorithm then compares the plus and minus phases, and applies a correction to the weights. Over time, you should see the minus phase patterns starting to approximate the hard clamped output values (the pattern in your Output column.)
When the network has finished training, you can manually step through the patterns to see what the output is. To do this, you will change the default Step Prog in the network:
- you should still have the LeabraBatch program selected in the tree and visible in the panel; if not, select it
- change the step_prog from LeabraBatch to LeabraSettle (click the button, and select LeabraSettle from the dialog)
- press Apply to save the change
Now you can press the Step button to advance the network through one phase of settling -- the network will alternate between plus and minus phases; in the plus phase you will see the exact output pattern displayed in the Output layer; in the minus phase, you should see a pattern of activation that is at least somewhat close to the output pattern (depending on how long your trained your network, and its batch termination criteria. (See Leabra for more information on the Leabra algorithm.)
return to Getting_Started
