MATLAB中的简单前馈(newff)网络 [英] simple Feed forward (newff) network in MATLAB
本文介绍了MATLAB中的简单前馈(newff)网络的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我多次使用ffnew
函数,但是当我尝试创建一个简单的前馈网络时,输入向量为P=[1;2;3;4]
,所需的输出为T=[1 ;0;0;1]
.所以我只有一个样本输入向量
I used ffnew
functions many times but when I am trying to create a simple feed forward network such that the input vector is P=[1;2;3;4]
and the desired output is T=[1 ;0;0;1]
. So i only have one sample input vector
代码是
net = newff(P,T,[4 1],{'tansig','tansig'});
net=train (net,P,T);
当我写最后一行时,我得到了:
When I write the last line I got:
??? Error using ==> plus
Matrix dimensions must agree.
Error in ==> calcperf2 at 163
N{i,ts} = N{i,ts} + Z{k};
Error in ==> trainlm at 253
[perf,El,trainV.Y,Ac,N,Zb,Zi,Zl] = calcperf2(net,X,trainV.Pd,trainV.Tl,trainV.Ai,Q,TS);
Error in ==> network.train at 216
[net,tr] = feval(net.trainFcn,net,tr,trainV,valV,testV);
推荐答案
如果使用MLP或RNN创建NN,则可以更改功能
If you create your NN using MLP or RNN, you can change the function
a2 = round(f2(LW2 * a1 + b2))
或a2 = round(purelin(LW2 * a1 + b2))
然后输出NN(a2)将是二进制的
then the output NN (a2) will be binary
这篇关于MATLAB中的简单前馈(newff)网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文