RegressionOutputLayer - Regression output layer - MATLAB (original) (raw)
A regression layer computes the half-mean-squared-error loss for regression tasks. For typical regression problems, a regression layer must follow the final fully connected layer.
For a single observation, the mean-squared-error is given by:
where R is the number of responses,ti is the target output, and_yi_ is the network’s prediction for response i.
For image and sequence-to-one regression networks, the loss function of the regression layer is the half-mean-squared-error of the predicted responses, not normalized by_R_:
For image-to-image regression networks, the loss function of the regression layer is the half-mean-squared-error of the predicted responses for each pixel, not normalized by_R_:
where H, W, and_C_ denote the height, width, and number of channels of the output respectively, and p indexes into each element (pixel) of_t_ and y linearly.
For sequence-to-sequence regression networks, the loss function of the regression layer is the half-mean-squared-error of the predicted responses for each time step, not normalized by_R_:
where S is the sequence length.
When training, the software calculates the mean loss over the observations in the mini-batch.