How do you make for get one/zero output?
Show older comments
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
Answers (3)
dpb
on 9 Oct 2013
disp([i'>7.5 o'>0.55])
?, maybe?
FRANK
on 9 Oct 2013
0 votes
1 Comment
dpb
on 9 Oct 2013
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...
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!