This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Create a regression output layer


routputlayer = regressionLayer
routputlayer = regressionLayer('Name',Name)


routputlayer = regressionLayer creates a regression output layer. For regression problems, you must include a fully connected layer followed by a regression layer at the end of the network. For information on concatenating layers to construct convolutional neural network architecture, see Layer. Predict responses using a trained network using predict.

LSTM networks do not support regression layers.


routputlayer = regressionLayer('Name',Name) returns a regression layer with the name specified by Name.


collapse all

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

layer = regressionLayer('Name','routput')
layer = 
  RegressionOutputLayer with properties:

             Name: 'routput'
    ResponseNames: {}

     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])
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

Input Arguments

collapse all

Layer name, specified as the comma-separated pair consisting of 'Name' and a character vector. If you do not specify a name, then the software initially specifies the default value '', and automatically assigns the name 'regressionoutputlayer' at training time.

Example: 'Name','routput'

Data Types: char

Output Arguments

collapse all

Regression output layer, returned as a RegressionOutputLayer object.

For information on concatenating layers to construct convolutional neural network architecture, see Layer.

Introduced in R2017a

Was this topic helpful?