bias problem with trainb
1 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
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
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!