how use my trained neural network

6 vues (au cours des 30 derniers jours)
Mattia Connola
Mattia Connola le 29 Mai 2022
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
  2 commentaires
Mattia Connola
Mattia Connola le 29 Mai 2022
Mattia Connola
Mattia Connola le 29 Mai 2022
another thing: to train my NN i used a 9x17600 dataset of input and 1x17600 of output
can i use a new dataset of (for exemple) 9x2200 inputs to predict a 1x2200 output on my trained NN ???

Connectez-vous pour commenter.

Réponses (1)

Sanjana
Sanjana le 1 Sep 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

Catégories

En savoir plus sur Sequence and Numeric Feature Data Workflows dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by