Documentation

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.

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. 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.

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.

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

Introduced in R2017a

Was this topic helpful?