bias problem with trainb

5 ビュー (過去 30 日間)
Emiliano Rosso
Emiliano Rosso 2016 年 7 月 1 日
コメント済み: Emiliano Rosso 2016 年 7 月 2 日
I need to train a supervised neural network to linearly separate a set of inputs with logical output 0,1 in batch training. My inputs is inputstemp2 (100,2000) of double precision & target is dividetargets(2,2000) of double 0 & 1. My code is :
mynet=perceptron;
mynet.trainFcn= 'trainb';
mynet.inputWeights.learnFcn='learnp'; %default
mynet.biases.learnFcn= 'learnp'; %default
mynet.biasConnect =[1];
mynet.outputs{1}.processFcns = {};
mynet.inputs{1}.processFcns = {'mapstd','processpca'};
mynet.divideFcn = 'divideblock';
mynet.divideParam.trainRatio = 80/100;
mynet.divideParam.valRatio = 10/100;
mynet.divideParam.testRatio =10/100;
mynet.trainParam.showWindow = false;
mynet.trainParam.showCommandLine = false;
mynet.trainParam.epochs=500;
mynet.efficiency.memoryReduction=1;
[mynet,tr]=train(mynet,inputstemp2,dividetargets);
No problem if mynet.biasConnect =[0] but if I set mynet.biasConnect =[1] Matlab return:
Error using *
Inner matrix dimensions must agree.
Error in learnp>apply (line 93)
dw = e*p';
Error in trainb>train_network (line 231)
[db,BLS{i}] = learnFcn.apply(net.b{i}, ...
Error in trainb (line 55)
[out1,out2] = train_network(varargin{2:end});
ecc.... The same if I use linearlayer and harlim. Somebody can explain me why bias is not accepted?

採用された回答

Greg Heath
Greg Heath 2016 年 7 月 1 日
Just use the current (i.e., non-obsolete) classifier
net = patternnet([]); % [] => No hidden layer for linear model
For documentation
help patternnet
doc patternnet
Hope this helps.
Thank you for formally accepting my answer
Greg
  1 件のコメント
Emiliano Rosso
Emiliano Rosso 2016 年 7 月 2 日
Solved & best convergence.
Thanks.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by