网络是根据之前的训练学习还是重新启动?Matlab,神经网络

数据挖掘 神经网络 matlab
2022-03-06 11:27:50

在 Matlab 中,如果您构建一个简单的网络并对其进行训练:

OP = feedforwardnet(5, 'traingdm');
inputsVals = [0,1,2,3,4];
targetVals = [3,2,5,1,9];
OP = train(OP,inputsVals,targetVals);

然后你再训练一次OP = train(OP,inputsVals,targetVals);

网络发生了什么?它是根据你第一次训练时学到的知识再次OP = train(OP,inputsVals,targetVals);训练,还是像第一次训练网络一样训练。

1个回答

它会根据你第一次学习的内容再次训练OP = train(OP,inputsVals,targetVals)更一般地说,train使用网络的权重,即它不初始化权重。权重初始化发生在feedforwardnet.

例子:

% To generate reproducible results 
% http://stackoverflow.com/a/7797635/395857
rng(1234,'twister')

% Prepare input and target vectors
[x,t] = simplefit_dataset;

% Create ANN
net = feedforwardnet(10);

% Loop to see where train() initializes the weights
for i = 1:10

    % Learn
    net.trainParam.epochs = 1;
    net = train(net,x,t);

    % Score
    y = net(x);
    perf = perform(net,y,t)
end

产量

perf =

    0.4825


perf =

    0.0093


perf =

    0.0034


perf =

    0.0034


perf =

    0.0034


perf =

    0.0034


perf =

    0.0034


perf =

    0.0034


perf =

    0.0034


perf =

    0.0028