how to calculate the output of neural network manually using input data and weights.

3 visualizaciones (últimos 30 días)
i am having ann program with 3 inputs and one output. i am using back propagation and feed forward network. the activation functions are tansig and purelin. no of layer is 2 and no of neuron in hidden layer is 20. i want to calculate the output of network manually using the input and weights(iw,lw,b) i need an equation to find the output. can you help me?

Respuesta aceptada

Greg Heath
Greg Heath el 25 de Jun. de 2015
When I-dimensional "I"nput x and O-dimensional "O"utput target t are normalized via the default mapminmax (or mapstd),the relationship between the normalized input and output is
yn = repmat( b2, O, N ) + LW * tanh( repmat( b1 , I, N ) + IW * xn);
Thank you for formally accepting my answer
Greg
  2 comentarios
prabakaran jayaraman
prabakaran jayaraman el 26 de Jun. de 2015
thanks greg. how to get ∑ (Xi * IW). if i am having 3 inputs and iw as 20 X 3 matrix
Greg Heath
Greg Heath el 28 de Jun. de 2015
Editada: Greg Heath el 28 de Jun. de 2015
IW does not act on the original weights. It acts on the normalized weights. The default normalization documentation is
help mapminmax
doc mapminmax.
Search for examples using a subset of
greg xsettings tsettings
Greg

Iniciar sesión para comentar.

Más respuestas (1)

Amir Qolami
Amir Qolami el 12 de Abr. de 2020
This works for any number of hidden layers and neurons;
function output = NET(net,inputs)
w = cellfun(@transpose,[net.IW{1},net.LW(2:size(net.LW,1)+1:end)],'UniformOutput',false);
b = cellfun(@transpose,net.b','UniformOutput',false);
tf = cellfun(@(x)x.transferFcn,net.layers','UniformOutput',false);
%%mapminmax on inputs
if strcmp(net.Inputs{1}.processFcns{:},'mapminmax')
xoffset = net.Inputs{1}.processSettings{1}.xoffset;
gain = net.Inputs{1}.processSettings{1}.gain;
ymin = net.Inputs{1}.processSettings{1}.ymin;
In0 = bsxfun(@plus,bsxfun(@times,bsxfun(@minus,inputs,xoffset),gain),ymin);
else
In0 = inputs;
end
In = cell(1,length(w)); Out = In;
In{1} = In0'*w{1}+b{1};
Out{1} = eval([tf{1},'(In{1})']);
for i=2:length(w)
In{i} = Out{i-1}*w{i}+b{i};
Out{i} = eval([tf{i},'(In{',num2str(i),'})']);
end
%%reverse mapminmax on outputs
if strcmp(net.Outputs{end}.processFcns{:},'mapminmax')
gain = net.outputs{end}.processSettings{:}.gain;
ymin = net.outputs{end}.processSettings{:}.ymin;
xoffset = net.outputs{end}.processSettings{:}.xoffset;
output = bsxfun(@plus,bsxfun(@rdivide,bsxfun(@minus,Out{end},ymin),gain),xoffset);
else
output = Out{end};
end
end

Categorías

Más información sobre Deep Learning Toolbox 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