Поскольку я мало что знаю о том, как реализовать сеть с помощью командной строки, я попытался использовать графический интерфейс от NNSTART и экспортировал код, чтобы попытаться выяснить, как внести нужные мне изменения. проблема в том, что я не знаю, как добавить больше слоев/нейронов, даже больше эпох.
Вот код, который я получил с первой попытки:
% Solve an Input-Output Fitting problem with a Neural Network % Script generated by Neural Fitting app % Created 13-Sep-2017 20:47:36 % % This script assumes these variables are defined: % % Input_train - input data. % Target_train - target data. x = Input_train; t = Target_train; % 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 = 'trainlm'; % Levenberg-Marquardt backpropagation. % Create a Fitting Network hiddenLayerSize = 23; 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 nndivide 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); % Test the Network y = net(x); e = gsubtract(t,y); performance = perform(net,t,y) % 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) % 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) end
ОТВЕЧАТЬ
Matlabsolutions.com предоставляет последнюю Помощь по домашним заданиям MatLab, Помощь по заданию MatLab для студентов, инженеров и исследователей в различных отраслях, таких как ECE, EEE, CSE, Mechanical, Civil со 100% выходом. Код Matlab для BE, B.Tech , ME, M.Tech, к.т.н. Ученые со 100% конфиденциальностью гарантированы. Получите проекты MATLAB с исходным кодом для обучения и исследований.
вы можете использовать :
trainFcn = 'trainlm'; hiddenLayerSize = 23; numberhiddenlayers=2;%more hidden layers net = fitnet([hiddenLayerSize numberhiddenlayers],trainFcn); net.trainParam.epochs=2000;% more epochs view(net)
с вашим кодом:
% Solve an Input-Output Fitting problem with a Neural Network % Script generated by Neural Fitting app % Created 13-Sep-2017 20:47:36 % % This script assumes these variables are defined: % % Input_train - input data. % Target_train - target data. x = Input_train; t = Target_train; % 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 = 'trainlm'; % Levenberg-Marquardt backpropagation. % Create a Fitting Network hiddenLayerSize = 23; numberhiddenlayers=2; %more hidden layers
СМОТРИТЕ ПОЛНЫЙ ОТВЕТ НАЖМИТЕ НА ССЫЛКУ