createnet.m

来自「非线型因素分析matlab仿真程序包」· M 代码 · 共 41 行

M
41
字号
function net = createnet(n_in, n_hid, n_out, nonlin, ...			 w1std, b1std, w2std, b2std)% CREATENET  Create an MLP network with one hidden layer%%    Usage:%      net = createnet(n_in, n_hid, n_out, nonlin,%                      w1std, b1std, w2std, b2std)%%      where idim, hdim and odim are numbers of input, hidden%      and output neurons, respectively.  Nonlin specifies the%      name of activation function for the hidden layer (default: tanh).%      The network is initialized randomly and other parameters%      specify standard deviations for all values (defaults: 2,4,1,1).% Copyright (C) 1999-2000 Antti Honkela, Harri Valpola,% and Xavier Giannakopoulos.%% This package comes with ABSOLUTELY NO WARRANTY; for details% see License.txt in the program package.  This is free software,% and you are welcome to redistribute it under certain conditions;% see License.txt for details.if nargin < 5  w1std = 2;  b1std = 4;  w2std = 1;  b2std = 1;endvarcoef = .001;net.w1 = probdist(w1std * randn(n_hid, n_in),  varcoef * ones(n_hid, n_in));net.b1 = probdist(b1std * randn(n_hid, 1),     varcoef * ones(n_hid, 1));net.w2 = probdist(w2std * randn(n_out, n_hid), varcoef * ones(n_out, n_hid));net.b2 = probdist(b2std * randn(n_out, 1),     varcoef * ones(n_out, 1));if nargin > 3  net.nonlin = nonlin;else  net.nonlin = 'tanh';end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?