how use my trained neural network
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
how i create a neural network but how can i use it to obtain a new output insert a new dataset?
this is my script that i used to train my neural network
load testclearinputoutput.mat
x = DatasetCompleto1';
t = forzeFiltrate';
% Choose a Training Function
% For a list of all training functions type: help nntrain
% 'trainlm' is usually fastest.
% 'trainbr' takes longer but may be better for challenging problems.
% 'trainscg' uses less memory. Suitable in low memory situations.
trainFcn = 'trainbr'; %Bayesian regularization
% Create a Fitting Network
a=50;
b=40;
c=30;
d=20;
e=10;
hiddenLayerSize1 = a;
hiddenLayerSize2 = b;
hiddenLayerSize3 = c;
hiddenLayerSize4 = d;
hiddenLayerSize5 = e;
net = fitnet([hiddenLayerSize1,hiddenLayerSize2,hiddenLayerSize3,hiddenLayerSize4,hiddenLayerSize5] ,trainFcn);
% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
% Train the Network
[net,tr] = train(net,x,t);
% Test the Network
y = net(x);
e = gsubtract(t,y);
performance = perform(net,t,y)
% View the Network
view(net)
% Plots
% Uncomment these lines to enable various plots.
% figure, plotperform(tr)
% figure, plottrainstate(tr)
% figure, ploterrhist(e)
% figure, plotregression(t,y)
% figure, plotfit(net,x,t)
afeter i have saved the workspace response
Risposte (1)
Sanjana
il 1 Set 2023
Hi Mattia,
I understand that you are facing an issue with using a trained Neural Network, and testing with inputs of different dimensions, from that of the training data.
The trained network, has fixed number of neurons in the “input” and “output” layer, based on the “inputs” and “targets” provided in the training data. This can be analyzed from the network displayed by the “view” function. Therefore, predicting the output of the network, on an input with different dimensions is not correct.
Please refer to the below link, for further information,
Hope this helps!
Regards,
Sanjana
0 Commenti
Vedere anche
Categorie
Scopri di più su Sequence and Numeric Feature Data Workflows in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!