hello, i'm want to ask about my neural network program. i have change input and output. but seems image still goes to others. can you please help me how to get it recognize correctly.

1 visualización (últimos 30 días)
%%Neural network classification
% General testing for sample
% Load Input and output for training purpose
Input=load('Input.txt');
Target=load('Output.txt');
Input1=Input';
Target1=Target';
%Number of neuron
L1=10;
L2=10;
L3=10;
% Form the Feedforward neural network
net1= newff(Input1,Target1,[L1 L2 L3],{'tansig','purelin'},'trainlm');
%Load weight
Weight=load('weight.txt');
net1=setx(net1,Weight);
Simulated Sample input
Input2=load(A3);
%Target2=load('Target.txt');
Input3=Input2';
%T3=Target2';
[net,Y]=adapt(net1,Input3);
dlmwrite('Y.txt',Y','-append','precision','%.4f',...
'newline','pc','delimiter',' ');
% Classification on the stimulated result
D1=Y;
Y1=D1;
[n,m]=size(Y1);
for m=1:m
if D1(m)>0.97 && D1(m)< 1.03
% Resistor
Y1(m)=1;
elseif D1(m)>1.97 && D1(m)< 2.03
% Ceramic Capacitor
Y1(m)=2;
elseif D1(m)>2.97 && D1(m)< 3.03
% Electrolytic Capacitor
Y1(m)=3;
elseif D1(m)>3.97 && D1(m)< 4.03
% BJT Transistor
Y1(m)=4;
elseif D1(m)>4.97 && D1(m)< 5.03
% Mosfet Transistor
Y1(m)=5;
elseif D1(m)>5.97 && D1(m)< 6.03
% Rectifier Circuit
Y1(m)=6;
elseif D1(m)>6.97 && D1(m)< 7.03
% Integrated Circuit
Y1(m)=7;
elseif D1(m)>7.97 && D1(m)< 8.03
% Microphone
Y1(m)=8;
elseif D1(m)>8.97 && D1(m)< 9.03
% Switch
Y1(m)=9;
elseif D1(m)>9.97 && D1(m)< 10.03
% Variable Resistor
Y1(m)=10;
elseif D1(m)>10.97 && D1(m)< 11.03
% Capacitor
Y1(m)=11;
elseif D1(m)>11.97 && D1(m)< 12.03
% Resistor 2W
Y1(m)=12;
elseif D1(m)>12.97 && D1(m)< 13.03
% Mosfet
Y1(m)=13;
else
% Others
Y1(m)=14;
end
end
Outposition=round(Y1');
% Output of the component
dlmwrite(A4,Outposition,'-append','precision','%.4f',...
'newline','pc','delimiter',' ');

Respuesta aceptada

Greg Heath
Greg Heath el 24 de Mayo de 2015
>>> GEH1 Matrix dimensions?
%Number of neuron
L1=10;
L2=10;
L3=10;
>>> GEH2 3 hidden layers is ill-advised
>>> GEH4 Total number of hidden nodes ill-advised
% Form the Feedforward neural network
net1= newff(Input1,Target1,[L1 L2 L3], {'tansig','purelin'},'trainlm');
>>> GEH5 No of layers and transfer functions don't match
>>> GEH6 NEWFF has been obsolete since 2010. If you don't have the current PATTERNNET (for classification), use NEWPR (for classification and calls NEWFF) ...
[net,Y]=adapt(net1,Input3);
>>> GEH7 HUGE ERROR: Use SIM, not ADAPT to obtain output. Adaptation is similar to training and needs a target.
...
>>>> GEH8 Use columns of eye(14) for the target, then use vec2ind and ind2vec on target and output obtain class indices.
help vec2ind doc vec2ind
Similarly for ind2vec
Hope this helps.
Greg

Más respuestas (0)

Categorías

Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by