《量化投资:以MATLAB为工具》

MATLAB技术论坛

 找回密码
 注册账号
查看: 813|回复: 2
收起左侧

[提问] 新版神经网络模型中自动进行数据的规格化问题

[复制链接]
发表于 2015-9-22 13:11:54 | 显示全部楼层 |阅读模式
大概从MATLAB2008开始,建立神经网络模型的函数,直接加入了数据规格化参数mapminmax,默认规格化到[-1,1]。大家可以在建立模型后查看net.inputs{1}.processParams{1,2},你会发现ymin=-1,ymax=1。
>> net=feedforwardnet;
>> net.inputs{1}.processParams{1,2}

ans =

    ymin: -1
    ymax: 1

我想请教一下,如何设置才能禁止这个默认的规格化处理?比如数据集分割函数可以禁止:
net.divideFcn='';
但是我无法通过类似途径禁止数据处理函数。

多谢!
 楼主| 发表于 2015-9-22 13:38:41 | 显示全部楼层
我已经找到了!从2007b开始的。
Automated data preprocessing and postprocessing occur during network creation in the Network/Data Manager GUI (nntool), Neural Network Fitting Tool GUI (nftool), and at the command line.
At the command line, the new syntax for using network-creation functions, automates preprocessing, postprocessing, and data-division operations.
For example, the following code returns a network that automatically preprocesses the inputs and targets and postprocesses the outputs:
net = newff(p,t,20);
net = train(net,p,t);
y = sim(net,p);
To create the same network in a previous release, you used the following longer code:
[p1,ps1] = removeconstantrows(p);
[p2,ps2] = mapminmax(p1);
[t1,ts1] = mapminmax(t);
pr = minmax(p2);
s2 = size(t1,1);
net = newff(pr,[20 s2]);
net = train(net,p2,t1);
y1 = sim(net,p2)
y = mapminmax('reverse',y1,ts1);
Default Processing Settings
The default input processFcns functions returned with a new network are, as follows:
net.inputs{1}.processFcns = ...
              {'fixunknowns','removeconstantrows', 'mapminmax'}
These three processing functions perform the following operations, respectively:
fixunknowns—Encode unknown or missing values (represented by NaN) using numerical values that the network can accept.
removeconstantrows—Remove rows that have constant values across all samples.
mapminmax—Map the minimum and maximum values of each row to the interval [-1 1].
The elements of processParams are set to the default values of the fixunknowns, removeconstantrows, and mapminmax functions.
The default output processFcns functions returned with a new network include the following:
net.outputs{2}.processFcns = {'removeconstantrows','mapminmax'}
These defaults process outputs by removing rows with constant values across all samples and mapping the values to the interval [-1 1].
sim and train automatically process inputs and targets using the input and output processing functions, respectively. sim and train also reverse-process network outputs as specified by the output processing functions.
For more information about processing input, target, and output data, see "Multilayer Networks and Backpropagation Training" in the Neural Network Toolbox User's Guide.
Changing Default Input Processing Functions
You can change the default processing functions either by specifying optional processing function arguments with the network-creation function, or by changing the value of processFcns after creating your network.
You can also modify the default parameters for each processing function by changing the elements of the processParams properties.
After you create a network object (net), you can use the following input properties to view and modify the automatic processing settings:
net.inputs{1}.exampleInput—Matrix of example input vectors
net.inputs{1}.processFcns—Cell array of processing function names
net.inputs{1}.processParams—Cell array of processing parameters
The following input properties are automatically set and you cannot change them:
net.inputs{1}.processSettings—Cell array of processing settings
net.inputs{1}.processedRange—Ranges of example input vectors after processing
net.inputs{1}.processedSize—Number of input elements after processing
Changing Default Output Processing Functions
After you create a network object (net), you can use the following output properties to view and modify the automatic processing settings:
net.outputs{2}.exampleOutput—Matrix of example output vectors
net.outputs{2}.processFcns—Cell array of processing function names
net.outputs{2}.processParams—Cell array of processing parameters
Note   These output properties require a network that has the output layer as the second layer.
The following new output properties are automatically set and you cannot change them:
net.outputs{2}.processSettings—Cell array of processing settings
net.outputs{2}.processedRange—Ranges of example output vectors after processing
net.outputs{2}.processedSize—Number of input elements after processing
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-9-22 13:45:42 | 显示全部楼层
简单地设置:
net.inputs{1}.processFcn={};即可全部禁止,然后net.inputs{1}.processParams也是空的了。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

QQ|网站地图|MATLAB技术论坛|Simulink仿真论坛 ( 蜀ICP备19014457号 

GMT+8, 2019-10-17 05:33 , Processed in 0.085724 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表