# RegressionOutputLayer

Regression output layer

## Description

A regression layer computes the half-mean-squared-error loss for regression tasks.

## Creation

Create a regression output layer using `regressionLayer`.

## Properties

expand all

### Regression Output

Names of the responses, specified a cell array of character vectors or a string array. At training time, the software automatically sets the response names according to the training data. The default is `{}`.

Data Types: `cell`

Loss function the software uses for training, specified as `'mean-squared-error'`.

### Layer

Layer name, specified as a character vector or a string scalar. To include a layer in a layer graph, you must specify a nonempty, unique layer name. If you train a series network with the layer and `Name` is set to `''`, then the software automatically assigns a name to the layer at training time.

Data Types: `char` | `string`

Number of inputs of the layer. This layer accepts a single input only.

Data Types: `double`

Input names of the layer. This layer accepts a single input only.

Data Types: `cell`

Number of outputs of the layer. The layer has no outputs.

Data Types: `double`

Output names of the layer. The layer has no outputs.

Data Types: `cell`

## Examples

collapse all

Create a regression output layer with the name `'routput'`.

`layer = regressionLayer('Name','routput')`
```layer = RegressionOutputLayer with properties: Name: 'routput' ResponseNames: {} Hyperparameters LossFunction: 'mean-squared-error' ```

The default loss function for regression is mean-squared-error.

Include a regression output layer in a Layer array.

```layers = [ ... imageInputLayer([28 28 1]) convolution2dLayer(12,25) reluLayer fullyConnectedLayer(1) regressionLayer]```
```layers = 5x1 Layer array with layers: 1 '' Image Input 28x28x1 images with 'zerocenter' normalization 2 '' Convolution 25 12x12 convolutions with stride [1 1] and padding [0 0 0 0] 3 '' ReLU ReLU 4 '' Fully Connected 1 fully connected layer 5 '' Regression Output mean-squared-error ```