University of Notre Dame
Aerospace and Mechanical Engineering

ME 469: Introduction to Robotics
Homework 8

B. Goodwine
Spring, 1999
Issued: April 14, 1999
Due: April 21, 1999


Note: do either

  1. problems 1 through 5, or
  2. problems 1 and 6 only.


  1. (0 points) Download and compile the sample neural network code which is like what was distributed in class. To compile it, type
       gcc -o neural neural.c -lm
    and the resulting executable will be called neural.

    When run, neural will train a neural network to approximate the sine function, and plot a comparison of the network output and the actual sine function values. The program should automatically display a graph that looks like this:

    The default values are for the network to have 10 HIDDEN nodes in one hidden layer, and to train for 20000 ITERATIONS. These parameters are defined near the top of the code.

    Notes:

    1. As written, this code must be run on a Sun workstation.
    2. To run it in Linux, you must remove the definition of MAX_RAND, and replace every other occurrence of MAX_RAND with RAND_MAX.
    3. I have no idea how to run it in Windows 95, 98 or NT.
  2. 10 HIDDEN nodes is actually too many. Reduce the number of hidden nodes to try to determine the effect of having fewer nodes.

    In particular, answer the following questions (10 points each).

    1. What is the effect of reducing the number of hidden nodes?
    2. Does there appear to be a minimum number of hidden nodes for the network to satisfactorily approximate the sine function?
    3. What, if any, appears to be the relationship between the number of hidden nodes and the amount of training (i.e. the number of ITERATIONS, required?
    4. What seems to be the optimal number of HIDDEN nodes, i.e. the smallest number that adequately approximates the function and does not require a very long time to train?
  3. (5 points) Near the end of the code is a section that prints the output of the neural network and the sine function to a file called "network.m." Change the range of the for loop so that several periods of the sine function are plotted to verify that the network only approximates the function well around the points on which it was trained.
  4. (25 points) Modify the network, and training data points, if necessary, so that the network adequately approximates the sine function for at least two complete periods.
  5. (20 points) Determine the minimum number of data points needed to train the network to adequately approximate the sine function for at least two complete periods. Note that the location of the data points may have a substantial effect.
  6. (90 points) Use the sample code as a skeleton to create a neural network to approximate an unknown function. Possible examples include:
    1. predicting the weather,
    2. predicting the stock market,
    3. predicting the outcome of sporting events,
    4. etc.
    If you choose this problem, you must receive prior approval from the instructor. Also, be careful to pick a problem for which you can obtain data that is easily quantifiable. (Some stock market data is available from the instructor).


Last updated: April 14, 1999.
B. Goodwine (jgoodwin@nd.edu)