how to save result in matlab neural network 2023

조회 수: 8 (최근 30일)
alsayed almetwaly
alsayed almetwaly 2023년 12월 26일
댓글: alsayed almetwaly 2023년 12월 27일
how to save result in matlab neural network 2023
  댓글 수: 2
John D'Errico
John D'Errico 2023년 12월 26일
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 2023년 12월 27일
yes i generate a neural network , and i want to save it

댓글을 달려면 로그인하십시오.

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 12월 27일
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
alsayed almetwaly
alsayed almetwaly 2023년 12월 27일
not working
I am making demand forecasting with artificial neural networks with matlab 2023, but I cannot get estimated results,

댓글을 달려면 로그인하십시오.

카테고리

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