Name:

Date:

 

 

Lab 5 - Neural Networks

Evolution and Learning in Computational and Robotic Agents
MSE 2400   Dr. Tom Way

Introduction

Worth

Due

Lab Steps

Part 1 - Understanding the Software

  1. Download Simbrain 3.0 (simbrain.net), which will be a zip file. Extract or "unzip" the file "to a folder" in a place on your computer that you will be able to find easily later.
     

  2. Navigate to the unzipped folder. If it doesn't look like this, ask the instructor for assistance.


     

  3. Verify you can run Simbrain by double-clicking on the file Simbrain.jar. If you don't see a screen that looks like this, as the instructor for assistance. If double-clicking on the file doesn't cause it to run, try opening a command prompt or terminal, navigating to that folder, and typing: java -jar Simbrain.jar


     

  4. View the Getting Started with Simbrainvideo to learn more about Simbrain.

    While watching the video, follow along using the Simbrain software to gain experience using it.

Part 2 - Creating Your Own Basic Neural Networks

To start with, let’s build some simple neural nets. To build a new network, you can either select Insert New Network or click on the “new network” button (it looks like a network of nodes). This will bring up the network creation screen. Refer also to a new Extra Handout that describes in more detail how to create these networks.

To add new nodes, click on the “add node” button (it looks like a circle with a bit plus on it). Click it three times to add three new nodes. You can drag nodes around into any configuration that you’d like. To start with, we’re going to try and do an “OR” neural net, so drag them into a configuration that looks like:

image

Now, let’s connect up the nodes. To make a connection you first have to specify one (or more) “source” nodes, i.e. where the signal will flow from. To specify a node as a source node, click on it (it will be circled in a green box) then press the ‘1’ key. This will circle it in a red box indicating that it is a source node. To create a link, click on the other node you’d like to connect it to then right-click and select Connect Neurons One-to-One. In the menu that pops up, just click ok.

In other words, click on the node in the lower-left (a source node), press the '1' key (red box appears), then click on the top node, then right click and select Connect Neurons One-to-One and then click OK.

After doing this you should see a connection from the source neuron to the target neuron. You can tell the direction of the connection because the target node will have the synapse on it (the red blob). The color of the synapse indicates whether the connection is positive (stimulates) indicated by red or negative (inhibits) indicated by blue. Add two connections so that your network looks like:

image

We have the structure of our network, now let’s define the weights and thresholds. We’re going to try and make an “OR” node, so where the edge weights are 1 and the output neuron uses a threshold of 1.

To update the edge weights, double-click on a synapse (i.e. the big red ball at the end of a connection). This will open the “Synapse Dialog” window. For now, the only thing we need to worry about is the “Strength” parameter, which is the weight of that connection.

Change the weight to -1 (indicating an inhibitory relationship) and click “OK”. Notice that the color of the synapse changes from red to blue.

For our “OR” network, we actually want both weights to be 1, so go back in and change the strength/weight back to 1.0.

The last thing we need to check is the threshold on the output node. Double-click on the neuron at the top to bring open the “Neuron Dialogue”. Here is a quick breakdown of the important fields:

We’d like to use the step threshold (all or nothing) which is labeled “Spiking threshold”. Select that from the drop-down menu and then set the threshold to 0.9 (this version of the threshold is > not ) and click “OK”.

Now our “OR” network is all set, so let’s test it out.

The bottom nodes represent the input to our “OR” node, so to test it out we need to put some activation on those nodes. You can do this by either double-clicking on a node or by click on a node and then using the up and down arrows to adjust its activation.

Adjust the activation of one of the nodes to be 1.0 so that it looks like:

image

Notice that as you add activation to a node it changes color accordingly.

Now we can simulate what will happen in the network. When we simulate a network the simulator will run in steps. At each every neuron that has activation will send its activation along the synapses to any connected neurons.

There are two ways to run the network. We’re going to just run the network a step at a time. To do this, just press the “pause” button once. This will step the network forward one step. You’ll see the bottom neuron “fire” passing its activation along the synapse to the top neuron. The top neuron will then check its threshold function and then activate since the threshold is met. If you press the step button again, you’ll see the activation disappear.

Try out a few different combination of inputs to make sure that our network actually implements the “OR” function properly.

Another way of running the network is with the play butting which will run the network step after step. If you do this when the network has activation you’ll see the top node flash red for just a moment (i.e. step) and then go back to 0 because the activation will have been passed along in the previous step and will not be there.

It can be annoying to have to keep refilling the “inputs” to check different outputs. Another way to setup the network is to connect up the input nodes to themselves. This way, whenever they fire, they will pass on activation to other neurons, but they also will keep whatever activation they have.

You can do this by selecting a neuron as both the source and the target and then adding a connections, something like:

image

Now, notice that if you add activation to one of the input nodes and then step multiple times it stays there.

When you’re network is setup like this, you can then hit the play/run button and alter the input neuron activations on the fly (again, using the up and down arrows) to see the output dynamically. Again, try out the values and see that it does in fact implement the “OR” function assuming that the inputs are binary.

When you have it working, save your "OR" network to a file using the File > Save As menu option of the Network window and assigning it a meaningful filename.

Once you’re comfortable with all this, try to build the following other networks and test them out. Save each one so you can load and demonstrate them later.

Demonstrate your OR, AND, NOT and XOR networks to the instructor or TA and acquire initials here: ____________
 

Part 3 - Avoider

  1. Open the Avoider workspace using File > Open Workspace File and selecting avoider.zip.

    Read the description of the Avoider network.

    Briefly describe what a Braitenberg vehicle is here:







     

  2. Follow the instructions for running the Avoider simulation. Try using the your computer mouse to move the pieces of cheese around, and observe the reactions in the mouse movement and the nodes in the neural network.

    How to slow down the simulation: select File > Workspace Properties and set the Simulation delay to a value greater than 0 (try values such as about 25, 50 and 100 until you can make the observations you desire).

    Also try stopping the simulation, repositioning items, and then stepping through the simulation using the "step" button to make more thorough observations.

    Describe what you observe about any changes in sensor activation values and corresponding changes in actuator values (turn left, turn right, straight). Comment on what Learning Agent (or Agents) this network resembles (refer to lecture material from Feb. 2 regarding Learning Agents).










     
  3. Describe an example of real-world behavior that the Avoider network simulates?





     

Part 4 - Pursuer

  1. Open the Avoider workspace using File > Open Workspace File and selecting pursuer.zip.

    Read the description of the Pursuer network.

    Briefly describe the differences you see in the design and network behavior of the Pursuer network as compared with the Avoider network.







     
  2. Describe an example of real-world behavior that the Pursuer network simulates?

Part 5 - Vehicle 2 Objects

  1. Open the Vehicle 2 Objects workspace using File > Open Workspace File and selecting vehicle2Objects.zip.

    Read the description of the Vehicle 2 Objects network.

    Play the Vehicle 2 Objects simulation (you will need to slow it down in File > Workspace Properties).
     
  2. Move the objects in the simulation to various places on the screen and observe the behavior of the animated mouse object.

    Create a positioning of the objects on the screen so the behavior of the animated mouse is particularly interesting, unusual or unexpected. Draw the position of the objects here:












     
  3. Change the activation in the straight neuron by clicking it and pressing the up and down arrows. Describe what happens in the simulation when you increase and decrease the activation of the straight neuron.




     
  4. Change the weights of connections between the flowers, cheeses (actually the fish and bottle of poison) and the left and right nodes in the network. To change the weight of a connection, click on the red or blue ball at the end of the connection line, then use the up or down arrow to change the weight. Describe what happens in the simulation when you try a few such changes?
     

Part 6 - Identifying Digits with a Neural Network

One of the early successes of neural networks was their use in identifying handwritten digits. Given an image of a digit where all the extraneous information has been cropped, the basic setup is as follows:

Part 7 - Other Letter Recognition

  1. Explore the LMS Letter Net workspace (lmsLetters.zip) and briefly describe the approach it uses the recognizing letters.





     
  2. Explore the SOM Letter Net workspace (somLetters.zip) and briefly describe the approach it uses the recognizing letters.





     
  3. Explore the Backprop for Letter Recognition workspace (backropLetters.zip) and briefly describe the approach it uses the recognizing letters.





     
  4. In thinking about the effectiveness of these three approaches, describe a real-world letter recognition task that each might be useful for and a task each would do poorly at.

Part 8 - Neural Network Exploration

  1. Explore the available workspaces that you have not yet explored.
     
  2. Select one workspace, read any description that comes with it and conduct your own experimentation using it.
     
  3. What workspace did you select?


     
  4. Describe what you discovered about the workspace you selected as you experimented with it? What does it simulate? What behavior does it exhibit?











     
  5. How do you think a similar network could be used to solve a real-world problem?