Effacer les filtres
Effacer les filtres

how to save result in matlab neural network 2023

13 vues (au cours des 30 derniers jours)
alsayed almetwaly
alsayed almetwaly le 26 Déc 2023
how to save result in matlab neural network 2023
  2 commentaires
John D'Errico
John D'Errico le 26 Déc 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 le 27 Déc 2023
yes i generate a neural network , and i want to save it

Connectez-vous pour commenter.

Réponses (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov le 27 Déc 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 commentaire
alsayed almetwaly
alsayed almetwaly le 27 Déc 2023
not working
I am making demand forecasting with artificial neural networks with matlab 2023, but I cannot get estimated results,

Connectez-vous pour commenter.

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