Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从命令行使用nntool[MATLAB]_Matlab_Command Line_Neural Network_Nntool - Fatal编程技术网

从命令行使用nntool[MATLAB]

从命令行使用nntool[MATLAB],matlab,command-line,neural-network,nntool,Matlab,Command Line,Neural Network,Nntool,我有以下代码: in = [5 columns of data-points]; out = [1 column of data-points]; net = newfit(in,out,5); net = train(net,in,out); 现在我想 访问生成的误差变量(以便我可以计算平均误差等) 在循环中运行此操作,因此我想在循环之间重新初始化权重 访问存储运行时间的变量 如何从命令行完成这三件事? [我知道如何使用nntoolGUI]完成这些事情]示例: % some random

我有以下代码:

in = [5 columns of data-points];
out = [1 column of data-points];
net = newfit(in,out,5);
net = train(net,in,out);
现在我想

  • 访问生成的误差变量(以便我可以计算平均误差等)
  • 在循环中运行此操作,因此我想在循环之间重新初始化权重
  • 访问存储运行时间的变量
如何从命令行完成这三件事?

[我知道如何使用
nntool
GUI]完成这些事情]

示例:

% some random data
in = rand(100,5)';
out = rand(100,1)';

% create a feed-forward back-propagation neural network
% (1 hidden layer with 5 neurons)
net = newfit(in,out,5);
net.trainParam.showWindow = 0;     % dont show GUI

% repeat 10 times
rmse = [];
t = [];
for i=1:10
    net = init(net);               % initialize network weights

    tic
    net = train(net,in,out);       % train
    predicted = sim(net, in);      % test
    t(i) = toc;

    r = (out - predicted);         % residuals
    rmse(i) = sqrt(mean(r.^2));    % root mean square error
end

% plot errors and elapsed times
bar([t; rmse]', 'grouped'), xlabel('Runs')
legend({'Elapsed Time' 'RMSE'}, 'orientation','horizontal')


注意:在R2010b中,
newfit
函数被弃用,取而代之的是使用以下代码来创建网络:

% old
%net = newfit(in,out,5);

% new
net = fitnet(5);                   % create ANN
net = configure(net, in, out);     % set input/output sizes according to data