21. Deep Learning
The exercises of this chapter of the 4th edition. Each card links to its page, which keeps its 3rd-edition number; the exercises that the book cites by name show that name. All chapters. ← Chapter 20 Chapter 22 →
Construct by hand a neural network that computes the XOR function of two inputs. Make sure to specify what sort of units you are using.
A simple perceptron cannot represent XOR (or, generally, the parity function of its inputs). Describe what happens to the weights of a four-input, hard-threshold perceptron, beginning with all weights set to 0.1, as examples of the parity function arrive.
Recall from Chapter concept-learning-chapter that there are $2^{2^n}$ distinct Boolean functions of $n$ inputs. How many of these are representable by a threshold perceptron?
Consider the following set of examples, each with six inputs and one
target output:
$$
\begin{array}
{|l|cccccccccccccc|}\hline
I_1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
I_2 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 1 & 1 & 0 & 1 & 0 & 1 & 1 \\
I_3 & 1 & 1 & 1 & 0 & 1 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 1 & 1 \\
I_4 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 1 & 1 & 1 & 0 & 1 \\
I_5 & 0 & 0 & 1 & 1 & 0 & 1 & 1 & 0 & 1 & 1 & 0 & 0 & 1 & 0 \\
I_6 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & 1 & 1 & 0 & 1 & 1 & 1 & 0 \\
\hline
T & 1 & 1 & 1 & 1 & 1 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\
\hline
\end{array}
$$
1. Run the perceptron learning rule on these data and show the
final weights.
2. Run the decision tree learning rule, and show the resulting
decision tree.
3. Comment on your results.
Section logistic-regression-section (page logistic-regression-section) noted that the output of the logistic function could be interpreted as a probability $p$ assigned by the model to the proposition that $f(\textbf{x}){ {\,=\,}}1$; the probability that $f(\textbf{x}){ {\,=\,}}0$ is therefore $1-p$. Write down the probability $p$ as a function of $\textbf{x}$ and calculate the derivative of $\log p$ with respect to each weight $w_i$. Repeat the process for $\log (1-p)$. These calculations give a learning rule for minimizing the negative-log-likelihood loss function for a probabilistic hypothesis. Comment on any resemblance to other learning rules in the chapter.
Suppose you had a neural network with linear
activation functions. That is, for each unit the output is some constant
$c$ times the weighted sum of the inputs.
1. Assume that the network has one hidden layer. For a given assignment
to the weights $\textbf{w}$, write down equations for the value of the
units in the output layer as a function of $\textbf{w}$ and the input layer
$\textbf{x}$, without any explicit mention of the output of the
hidden layer. Show that there is a network with no hidden units that
computes the same function.
2. Repeat the calculation in part (a), but this time do it for a
network with any number of hidden layers.
3. Suppose a network with one hidden layer and linear activation
functions has $n$ input and output nodes and $h$ hidden nodes. What
effect does the transformation in part (a) to a network with no
hidden layers have on the total number of weights? Discuss in
particular the case $h \ll n$.
Implement a data structure for layered, feed-forward neural networks, remembering to provide the information needed for both forward evaluation and backward propagation. Using this data structure, write a function NEURAL-NETWORK-OUTPUT that takes an example and a network and computes the appropriate output values.
Suppose that a training set contains only a single example, repeated 100 times. In 80 of the 100 cases, the single output value is 1; in the other 20, it is 0. What will a back-propagation network predict for this example, assuming that it has been trained and reaches a global optimum? (Hint: to find the global optimum, differentiate the error function and set it to zero.)
The neural network whose learning performance is measured in Figure restaurant-back-prop-figure has four hidden nodes. This number was chosen somewhat arbitrarily. Use a cross-validation method to find the best number of hidden nodes.