NOTE
This is part of the 8th homework, titled Deep Learning II, for the course Machine Learning (IN2064) in the Winter Semester 2024/25 at TUM.
Problem 3:
You are trying to solve a regression task and you want to choose between two approaches:
- A simple linear regression model.
- A feed forward neural network with hidden layers, where each hidden layer has a weight matrix and a ReLU activation function. The output layer has a weight matrix and no activation function. In both models, there are no bias terms. Your dataset contains data points with nonnegative features and the target is continuous:
Let be the optimal weights for the linear regression model corresponding to a global minimum of the following least squares optimization problem:
Let be the optimal weights for the neural network corresponding to a global minimum of the following optimization problem:
a) Assume that the optimal you obtain are non-negative. What will the relation () between the neural network loss and the linear regression loss be? Provide a mathematical argument to justify your answer.
b) In contrast to (a), now assume that the optimal weights you obtain are non-negative. What will the relation () between the linear regression loss and the neural network loss be? Provide a mathematical argument to justify your answer.
Solution: a)
In general, the following relation holds: , since the described neural network can, in the worst-case scenario, be equivalent to the linear regression model. In cases where there is nonlinearity between features and their labels , it can outperform linear regression due to the nonlinearity achieved through the ReLU activation functions in all but the last layer.
However, we are assuming that the optimal weights of the neural network are non-negative. Recall the ReLU activation function: This means that if we constrain the domain of the input , then the ReLU function becomes equivalent to the identity function, i.e., we can remove it from our considerations. From the task description, we know that dataset contains only non-negative features . This means that outputs of all the layers will be non-negative as we assumed that the optimal weights are non-negative too. Thus, our network becomes equivalent to the regression model, given that linear maps can be composed into a single one. Therefore, the relation between losses is as follows:
Solution: b)
Here the situation is a bit different as we assume the optimal weights for the linear regression model are non-negative. That means that the optimal linear map between the feature space and label space only does scaling and stretching. Since the relationship between and can be nonlinear, then it would follow that the loss of the neural network at its global minimum can be lower than the loss of the optimal linear regression model. However, that is not the case if there are no bias terms in our network and all the input features are nonnegative. This is because each layer in effect is actually only a linear map, where negative weights are equivalent to multiplying by zero since, the ReLU activation function will set all negative values to zero either way. A composition of linear functions is a linear function thus the upper bound on loss is given by the loss of the optimal regression model.
This upper-bound can be reached by the neural network as it can represent any linear regression model by setting the weights of all hidden layers to identity matrices ( for ) and setting the output layer weights equal to . This means that the neural network’s hypothesis space strictly includes the linear regression model’s hypothesis space. Therefore, the relation between losses is: