How do you make for get one/zero output?

the result not is iqual to the vector target because i get 0.5 in place of zero. What function i can add to my code for to get the output iqual to the target?
inputs =
Columns 1 through 11
6.3200 6.7800 7.5600 6.8400 9.0000 6.7200 6.5200 6.7400 7.0600 8.8400 6.2600
0 0 0 0 0 0 0 0 0 0 0
Columns 12 through 22
7.6400 8.1400 7.5200 8.0600 6.4800 6.5000 6.6600 7.2400 7.3200 5.1200 8.2400
0 0 0 0 0 0 0 1.0000 1.0000 1.0000 1.0000
Columns 23 through 32
6.7800 8.0200 8.0800 6.6600 7.7800 6.3400 8.3000 9.0000 7.2000 5.7800
1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
target =
Columns 1 through 19
0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0
Columns 20 through 32
1 0 1 0 0 1 1 1 0 1 1 0 1
with the code: net=feedforwardnet(10); net.layers{1}.transferfcn='logsig'; net.layers{2}.transferfcn='logsig'; net.divideParam.trainRatio = 100/100; %net.divideParam.valRatio = 10/100; %net.divideParam.testRatio = 10/100; %net = configure(net,inputs,target); net=init(net); %net.iw{1,1} %net.b{1} %net.lw{2,1} net.trainparam.goal=0.001; net.trainparam.epochs=1000; net.trainFcn = 'trainlm'; %[net,tr]=train(net,inputs,target); net=train(net,inputs,target); output=sim(net,inputs) error=mse(target-output)
I get output: logit1
output =
Columns 1 through 11
0.5002 0.5002 0.5008 0.5002 0.9855 0.5002 0.5002 0.5002 0.5003 0.9101 0.5002
Columns 12 through 22
0.5009 0.5027 0.5007 0.5022 0.5002 0.5002 0.5002 0.5062 0.5085 0.5001 0.8629
Columns 23 through 32
0.5010 0.6980 0.7434 0.5006 0.5679 0.5002 0.9006 1.0000 0.5053 0.5001
error =
0.2121

回答(3 个)

FRANK
FRANK 2013-10-9
My dear, I don't understand, could you say me in what place to the code write its?

1 个评论

Any point at which you have the outputs of choice.
It simply demonstrates that you can create a logical vector of 0 and 1 by the comparison of the inputs to a suitably chosen reference level. What you do with that is dependent on your needs.
PS. It would help immeasurably if you would edit your initial question to properly format the code so it's not line-wrapped. Use the {}Code button or just prefix the first line of code with two blanks. Use the preview window to see what it looks like until get it right...

请先登录,再进行评论。

FRANK
FRANK 2013-10-9
net=feedforwardnet(10,'trainlm'); net.layers{1}.transferfcn='tansig'; net.layers{2}.transferfcn='tansig'; net.divideParam.trainRatio = 80/100; net.divideParam.valRatio = 15/100; net.divideParam.testRatio = 15/100; %net = configure(net,inputs,target); %net=init(net); net.iw{1,1} net.b{1} net.lw{2,1} net.trainparam.goal=0.001; net.trainparam.epochs=1000; %net.trainFcn = 'trainlm'; %[net,tr]=train(net,inputs,target); net=train(net,inputs,target); output=sim(net,inputs) error=mse(target-output)

1 个评论

Still not formatted, unfortunately...and would be better if edit the original question, then remove this comment (and I'd follow up by cleaning up this one)

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Deep Learning Toolbox 的更多信息

产品

提问:

2013-10-9

评论:

dpb
2013-10-9

Community Treasure Hunt

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

Start Hunting!

Translated by