Filter löschen
Filter löschen

how to save result in matlab neural network 2023

13 Ansichten (letzte 30 Tage)
alsayed almetwaly
alsayed almetwaly am 26 Dez. 2023
how to save result in matlab neural network 2023
  2 Kommentare
John D'Errico
John D'Errico am 26 Dez. 2023
Highly confusing question. Do you have a neural network that you generated, and you want to know how to save it? Where? As a .mat file?
Or do you have something, that you want to somehow store as a neural network? Something else maybe?
alsayed almetwaly
alsayed almetwaly am 27 Dez. 2023
yes i generate a neural network , and i want to save it

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov am 27 Dez. 2023
Understand what issue you are facing with the net() - neural network simulation. Here is one code automatically generated by MATLAB, and then I added a few lines to store data from simulations (see comments SAVE).
% X - input data.
% y - target data.
Compounds = {'pH', 'L*', 'a*', 'b*', 'SubColor', 'WBSF1', 'WBSF2', 'WBSF3', 'WBSF4', 'WBSF5', 'WBSF5', 'WBSF_ave'};
N = 1; % 1 = pH; 2 = L*; 3 = a*; 4 = b*; 5 = SubColor; 6:11 = WBSF1:6; 12 = WBSF_ave
disp(['Simulation of: ' Compounds{N}]);
x = INALL(); x=x'; % Input: predictor data set
t = normalize(RALL(:,N), 'norm'); t=t'; % Output Data set
%t = RALL(:,N); t=t';
% 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'; % Levenberg-Marquardt backpropagation.
% Create a Fitting Network
hiddenLayerSize = 10;
net = fitnet(hiddenLayerSize,trainFcn);
% Choose Input and Output Pre/Post-Processing Functions
% For a list of all processing functions type: help nnprocess
net.input.processFcns = {'removeconstantrows','mapminmax'};
net.output.processFcns = {'removeconstantrows','mapminmax'};
% Setup Division of Data for Training, Validation, Testing
% For a list of all data division functions type: help nndivision
net.divideFcn = 'dividerand'; % Divide data randomly
net.divideMode = 'sample'; % Divide up every sample
net.divideParam.trainRatio = 80/100;
net.divideParam.valRatio = 10/100;
net.divideParam.testRatio = 10/100;
% Choose a Performance Function
% For a list of all performance functions type: help nnperformance
net.performFcn = 'mse'; % Mean Squared Error
% Choose Plot Functions
% For a list of all plot functions type: help nnplot
net.plotFcns = {'plotperform','plottrainstate','ploterrhist','plotregression', 'plotfit'};
% Train the Network
[net,tr] = train(net,x,t);
TRn{N}=tr; % SAVE
% Test the Network
y = net(x);
e = gsubtract(t,y);
performance = perform(net,t,y);
PERFORn{N} = performance; % SAVE
% Recalculate Training, Validation and Test Performance
trainTargets = t .* tr.trainMask{1};
valTargets = t .* tr.valMask{1};
testTargets = t .* tr.testMask{1};
trainPerformance = perform(net,trainTargets,y);
valPerformance = perform(net,valTargets,y);
testPerformance = perform(net,testTargets,y);
%
trainTARGETn{N}=trainTargets; % SAVE
valTARGETn{N}=valTargets; % SAVE
testTARGETn{N}=testTargets; % SAVE
trainPERFORn{N}=trainPerformance; % SAVE
valPERFORn{N}=valPerformance; % SAVE
testPERFORn{N}=testPerformance; % SAVE
% View the Network
view(net)
MODELn{N}=net;
% figure(N), plotperform(tr)
% figure(N+1), plottrainstate(tr)
% figure(N+2), plotregression(t,y)
  1 Kommentar
alsayed almetwaly
alsayed almetwaly am 27 Dez. 2023
not working
I am making demand forecasting with artificial neural networks with matlab 2023, but I cannot get estimated results,

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by