COMP 200: Elements of Computer Science
Spring 2013

Assignment 8

Put all your answers in one CodeSkulptor file. Put your text answers in Python comments.

Work in assigned pairs on this assignment. Submit it on OWL-Space, under Assignment 8. Only the first person listed in the pair should submit the Codeskulptor URL. Put the pair designation as posted, (NetID1, NetID2), at the top of your submission as well as in Python comments at the top of your CodeSkulptor code. Including the person's actual names too would be nice.

As with the previous assignments, your grade will partly depend on your code style.

Be sure to read the course policies.

Neural Networks (100 points total)

Any neural net for the LED recognition problem has 7 input nodes (one for each LED segment) and 4 output nodes (sufficient to distinguish 11 possible outputs). However, the numbers of hidden layers and nodes are open. In this assignment, you will consider various options for the hidden layers and nodes, and evaluate which of the options was best.

You will consider the following numbers of hidden layers and nodes:

We are providing code for you to work with. This is an updated version of what was recently presented in class. It provides the full ANN class definitions, training code, where the training results are presented in an understandable manner. The only code you will need to edit is at the end of the program.

  1. (30 points total)

    The time for the training is proportional to how many nodes and edges are in the network. Furthermore, the amount of information that the network represents in some sense is proportional to the same values. You will calculate the number of nodes and edges in these networks.

    In principle, you could draw the networks and count the nodes and edges, but the drawings for these networks are much too crowded for that. You'll have to think about the structure of the code that you created in the previous assignment.

    1. (8 points — 1 point each arrangement)

      For each of the listed arrangements of hidden layers and nodes, how many total nodes does the ANN have?

    2. (7 points)

      Describe in precise English or a mathematical formula how to calculate the total number of nodes for an ANN. Your description should be in terms of the inputs to ANN().

    3. (8 points — 1 point each arrangement)

      For each of the listed arrangements of hidden layers and nodes, how many total edges does the ANN have?

    4. (7 points)

      Describe in precise English or a mathematical formula how to calculate the total number of edges for an ANN. Your description should be in terms of the inputs to ANN().

  2. (30 points total)

    For each of the previous numbers of hidden layers and nodes, create and train an ANN.

    About 20 students provided sample data. The provided code trains an ANN on all of that data, repeating the data 20 times. On some of the sample ANN sizes, training will likely take over an hour.

    1. (10 points)

      Show the output for each ANN, as reported at the end of the training phase.

    2. (20 points)

      Analyze how each ANN's results compare. Consider how the size and organization effects the results. For example, do more nodes or layers help or hinder? Be thorough, yet concise, in finding and describing the interesting relationships in the data.

      Pick which two of these ANNs you think produced the best results, for use in the next problem.

  3. (20 points total)

    Remember that the quality of an ANN depends partly upon the initial random weights that it begins with. Given enough training data, it can overcome even poor initial weights. For each of the two best ANN arrangements on the previous problem, repeat the process of creating and training ANNs twice more. Thus, you'll have three trained ANNs for each of these two sizes.

    1. (5 points)

      Again, show the output for each ANN, as reported at the end of the training phase.

    2. (15 points)

      Analyze how consistent the results are. Pick which ANN gives the overall best results.

  4. (20 points total)

    You have previously trained an ANN with two layers of 20 nodes each. That training repeated the data 20 times.

    1. (5 points)

      Train two more ANNs with the same layout. With one, repeat the data 10 times, and with the other, 5 times. Again, show the output for each ANN, as reported at the end of the training phase.

    2. (15 points)

      Analyze how the results depend on the amount of training data.