Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

regressionLayer

Create a regression output layer

Syntax

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

Description

routputlayer = regressionLayer returns a regression output layer for a neural network as a RegressionOutputLayer object.

Predict responses of a trained regression network using predict. Normalizing the responses often helps stabilizing and speeding up training of neural networks for regression. For more information, see Train Convolutional Neural Network for Regression.

example

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

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

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.

Introduced in R2017a

Was this topic helpful?