Main Content

回归层

创建回归输出层

描述

回归层为回归任务计算半均值的误差损失。

=回归层returns a regression output layer for a neural network as aRecressionOutputlayer目的。

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

例子

=回归层(名称,价值设置可选姓名andresponseNames使用名称值对的属性。例如,回归层('名称','输出')creates a regression layer with the name'输出'。将每个属性名称包装在单引号中。

例子

全部收缩

创建一个名称的回归输出层'routput'

layer =回归层('姓名',,,,'routput'
layer =带有属性的回归图layerer:名称:'rutput'响应名称:{} hyperparameters lossfunction:'eym-squared-error'

回归的默认损耗函数是均方误差。

将回归输出层包含在图层阵列中。

层= [...imageInputlayer([28 28 1])卷积2DLAYER(12,25)Relulayer PlullConnectedLayer(1)回归层]
层= 5x1层阵列,带有层:1''图像输入28x28x1图像,带有“ zerecenter”归一化2''卷积25 12x12卷积[1 1]和填充[0 0 0 0 0] 3'''''relu 4'''完全连接1个完全连接的层5''回归输出均值 - 错误

输入参数

全部收缩

名称值参数

specify optional pairs of arguments asname1 = value1,...,namen = valuen, 在哪里姓名是参数名称和Value相应的价值。名称-值参数must appear after other arguments, but the order of the pairs does not matter.

在R2021a之前,请使用逗号分隔每个名称和值,并附上姓名用引号。

例子:回归层('名称','输出')creates a regression layer with the name'输出'

图层名称,,,,specified as a character vector or a string scalar. For数组输入,火车网,,,,assembleNetwork,,,,层Graph,,,,anddlnetwork功能自动将名称分配给具有名称的图层''

数据类型:char|细绳

姓名s 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{}

数据类型:细胞

输出参数

全部收缩

regression output layer, returned as aRecressionOutputlayer目的。

更多关于

全部收缩

回归输出层

回归层为回归任务计算半均值的误差损失。对于典型的回归问题,回归层必须遵循最终的完全连接层。

对于一个单一的观察,均方误差由以下方式给出:

MSE = 一世 = 1 r (( t 一世 - y 一世 2 r ,,,,

在哪里r是响应数,t一世一世s the target output, andy一世是网络的响应预测一世

对于图像和序列到一个回归网络,回归层的损耗函数是预测响应的半均值误差,而不是由r

失利 = 1 2 一世 = 1 r (( t 一世 - y 一世 2

对于图像到图像回归网络,回归层的损耗函数是每个像素的预测响应的半均值误差,而不是由r

失利 = 1 2 p = 1 H w C (( t p - y p 2 ,,,,

在哪里H,,,,w,,,,andC分别表示输出的高度,宽度和数量,并表示p索引到每个元素(像素)的tandylinearly.

对于序列到序列回归网络,回归层的损耗函数是每个时间步的预测响应的半均值误差,而不是由r

失利 = 1 2 s 一世 = 1 s j = 1 r (( t 一世 j - y 一世 j 2 ,,,,

在哪里s一世s the sequence length.

when training, the software calculates the mean loss over the observations in the mini-batch.

扩展功能

C/C ++代码生成
Generate C and C++ code using MATLAB® Coder™.

GPU代码生成
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

版本历史记录

在R2017A中引入