# How can I use the trained weights of a neural network

3 visualizzazioni (ultimi 30 giorni)
David Franco il 1 Ott 2020
Risposto: David Franco il 1 Ott 2020
How can I use the trained weights of a neural network to simulate the output of a classification problem?
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

David Franco il 1 Ott 2020
I found the answer (output and yy are equal):
% Simulated a Neural Network
clear
close
clc
rng default
[x,y] = simpleclass_dataset;
neurons = 10;
net = feedforwardnet(neurons);
net = train(net,x,y);
outputs = sim(net,x);
% outputs = round(outputs);
figure, plotconfusion(y,outputs)
w1 = net.IW{1,1};
w2 = net.LW{2,1};
b1 = net.b{1};
b2 = net.b{2};
xx = x;
for ii = 1:length(net.inputs{1}.processFcns)
xx = feval(net.inputs{1}.processFcns{ii},...
'apply',xx,net.inputs{1}.processSettings{ii});
end
a1 = tanh(w1*xx + b1);
yy = purelin(w2*a1 + b2);
for mm = 1:length(net.outputs{1,2}.processFcns)
yy = feval(net.outputs{1,2}.processFcns{mm},...
'reverse',yy,net.outputs{1,2}.processSettings{mm});
end
figure, plotconfusion(y,yy)
=)
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Deep Learning Toolbox in Help Center e File Exchange

R2018b

### Community Treasure Hunt

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

Start Hunting!

Translated by