If you have both a classification and regression problem that are related and rely on the same input data, is it possible to successfully architect a neural network that gives both classification and regression outputs?
If so, how might the loss function be constructed?
A simple approach is to develop both regression and classification predictive models on the same data and use the models sequentially. An alternative and often more effective approach is to develop a single neural network model that can predict both a numeric and class label value from the same input.
Neural networks are flexible and can be used for both classification and regression.
Neural network models can be configured for multi-output regression tasks.
The changes are as follows: The output layer contains one neuron per class rather than just one neuron. If the dataset contains four classes, then the output layer has four neurons.
Usually, for such cases the loss is considered simply a weighted sum of classification loss and regression loss. In other words, your network have 2 independent output parts, one responsible for regression, on which you apply reggression loss L_reg (such as MSE) and another responsible for classification part, on which you apply classification loss L_class (such as cross entropy) and your final optimization criterion is simply (alpha)*L_reg + (1-alpha)*L_class, for some predefined alpha. This allows easy computation of gradients (and overall easy analysis).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With