如何在MATLAB中训练现有的GRNN?

时间:2014-11-12 13:26:24

标签: neural-network regression

我使用命令创建了一个GRNN:

net = newgrnn(inputs, output);

如何在MATLAB中训练新输入的现有GRNN?换句话说,如何在其他投入上培训网络?

2 个答案:

答案 0 :(得分:0)

好的问题是newgrnn是根据训练数据定义的。因此,除非您从头开始,否则无法重新训练网络。我建议你使用一个可以重新训练的不同径向基网络,例如newrb。我为回归问题添加了这种网络的模拟。考虑到这是一个复杂的回归,因为您只对训练数据进行了部分覆盖,并且您不应期望从任何一个网络获得太多。您还可以使用此模拟来尝试不同的体系结构,例如MLP。

CODE:

%% simulate data
X=linspace(0,20*pi,1250);
Y=sin(X)-X/20+rand(1,1250)*0.2;
Xtrain=X([250:500,550,600,650,700,750:1000]);
Ytrain=Y([250:500,550,600,650,700,750:1000]);


%% create a radial neural network through newrbe
spread=0.6;
net = newrbe(Xtrain,Ytrain,spread);
view (net)
Y_net = net(X);

%% create a radial neural network through newgrnn
spread=0.6;
net1 = newgrnn(Xtrain,Ytrain,spread);
view (net1)
Y_net1 = net1(X);

%% create a radial neural network through newrb and retrain with bayesian
spread=0.6;
net2 = newrb(Xtrain,Ytrain,0,spread,40);
view (net2)
Y_net2 = net2(X);

net3=net2;
net3.trainFcn='trainbr';
net3.trainParam.epochs = 1000;
net3 = train(net3,Xtrain,Ytrain);
view (net3)
Y_net3 = net3(X);

%% plot networks
h=figure;
plot(X,Y,'black'),hold on
plot(Xtrain,Ytrain,'blacko'),hold on
plot(X,Y_net1,'Color',[1,0,1])
plot(X,Y_net,'r')
plot(X,Y_net2,'g')
plot(X,Y_net3,'b')
axis([X(1),X(end),-5,2])
legend('original data','train data','newrbe','newgrnn','newrb','newrb-retrain')

输出: simulation of radial basis neural networks

答案 1 :(得分:0)

GRNN无法在反向传播的意义上进行训练。这是单程学习。它将为每个输入模式分配新的神经元,因此为了训练它只需在命令newgrnn(1:n,1:m)中包含数据点;