CS340             Lab 8  -  Perceptrons

 

1. Use your learning problem for the majority function with 3 inputs i1, i2, and i3 from lab7.  You can create a perceptron for this problem using the code in the file ~jillz/cs340/nn.lsp.  The function perceptron-learning returns a list of perceptrons for the given learning problem:

 

            (define p (perceptron-learning <learning-problem>)) 

 

In the case of the majority function there will be only one perceptron in the list since there is only one output.  You can look at the weights of this perceptron by

           

            ((car p) ‘get-variable ‘weights)

 

Do these weights make sense?  Explain why this perceptron will indeed compute the majority function for three inputs.

 

Try it out by using the following:

 

            (network-output ‘(1 1 0) p)

 

 

2.  Suppose we have a majority function for a very large n.  If we took a sample of examples as our training set and built a perceptron, how do you think it would perform on a test set?  Try this out for a fairly small n of 6.  Use the same training set of size 6 as you used for the decision tree.  Try the same test set examples.  How well did it perform and why?