how use my trained neural network

6 次查看(过去 30 天)
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 个评论
Mattia Connola
Mattia Connola 2022-5-29
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 ???

请先登录,再进行评论。

回答(1 个)

Sanjana
Sanjana 2023-9-1
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

类别

Help CenterFile Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by