Data file attached.
FIrst, I have two neural networks being tested. I am solving for errors for every iteration. Every iteration produces a unique answer. Once the neural network recalulates for the next iteration, it replaces the prevous solution. I am given only the final solution. I need all iteration solutions in a single column matrix to use for later calculations. How can I combine each answer into a single matrix?
Thought of indexing the results, but I am not sure how to apply it.
Second, how can I determine number of epoch used when trainbr is utilized.
clearload 'beam_designs_lhs100.mat'; % beam_designs
% Normalize beam models and responses
[beamsin, PS] = mapminmax(beam_designs(:,1:5)');[beamsout, TS] = mapminmax(beam_designs(:,6:7)');% 2-layer network
for l1 = 3:5 for l2 = 3:5 % Divide designs into training and test datasets
trainin = beamsin(:,1:600); trainout = beamsout(:,1:600); testin = beamsin(:,600+1:end); testout = beamsout(:,600+1:end); % Create function fitting neural network
net = fitnet([l1,l2], 'trainlm'); netbr = fitnet([l1,l2], 'trainbr'); net.divideParam.trainRatio = 1; net.divideParam.valRatio = 0; net.divideParam.testRatio = 0; % Train the NN and evaluate its performance
[net, tr] = train(net, trainin, trainout); [netbr, tr] = train(netbr, trainin, trainout); outputsD = net(testin(1:5,:)); outputsB = netbr(testin(1:5,:)); perf = perform(net, testout, outputsD); % or use sum of squares
% Computes the sum of squared errors and print results
err_defD = sum((testout(1,:) - outputsD(1,:)).^2); err_defB = sum((testout(1,:) - outputsB(1,:)).^2); fprintf('answer %f\n',err_defD) % Dont need, the only way to visualize the solution to each iteration
Anything helps. Thank you.
Best Answer