2017-04-19 52 views
0

trainNetwork()的输出类型必须为categorical()。我如何创建一个带有浮点/实际输出的CNN?是否有可能创建一个具有实际输出的CNN?

我指的是下面的命令提供了以下错误:

>> convnet = trainNetwork(input_datas, [0.0, 0.1, 0.2, 0.3], networkLayers, opts); 
Error using trainNetwork>iAssertCategoricalResponseVector (line 269) 
Y must be a vector of categorical responses. 

(该错误消息对应的[0.0,0.1,0.2,0.3]载体),但是,我需要真正的输出,而不是类别。

的networkLayers如下:

>> networkLayers= 

5x1 Layer array with layers: 
    1 '' Image Input  1x6000x1 images with 'zerocenter' normalization 
    2 '' Convolution  10 1x100 convolutions with stride [1 1] and padding [0 0] 
    3 '' Max Pooling  1x20 max pooling with stride [10 10] and padding [0 0] 
    4 '' Fully Connected 200 fully connected layer 
    5 '' Fully Connected 1 fully connected layer 

回答

0

答案有两个部分

1.分类VS回归 This post describe shortly

Regression: the output variable takes continuous values.

Classification: the output variable takes class labels.

所以我的问题是(当我问这个问题),我需要回归问题的神经网络,不用于分类。

2. Matlab的构架

有两个基本的方式与Matlab中的神经网络工作。

旧框架使用“神经网络”类定义了所有网络。一些基础网络可以用这种方式轻松构建(例如使用feedforwardnetlayrecnet),但构建更复杂的网络是一项艰苦的工作。使用网络类构建自定义神经网络的更多细节可参见here

更新的方法在R2016a中引入。介绍可以发现here。我试图使用这个框架。但是这个框架仅支持从2017年开始的回归问题!所以这是一个非常新的工具。但是可以找到here关于使用newwer框架进行回归问题的描述。

相关问题