how to use two separate files for ANN?

Technical Source
2 min readAug 4, 2021

--

Hi, I would like to use two separate files for ANN.one file for training and the other file for test of data.Here is for the one input.

inputs = ii';
targets = f';
inputGap = ig;
targetGap = fg;
hiddenLayerSize = j;
net = fitnet(hiddenLayerSize);
net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};
net.outputs{2}.processFcns = {'removeconstantrows','mapminmax'};
net.divideFcn = 'dividerand';
net.divideMode = 'sample';
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
net.trainFcn = 'trainlm';
net.performFcn = 'mse';
% Train the Network
[net,tr] = train(net,inputs,targets);
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs);
valTargets = targets .* tr.valMask{1};
testTargets = target .* tr.testMask;
trainPerformance = perform(net,trainTagets,outputs);
testPerformance = perform(net,testTargets,outputs);
out1.net = net;
out1.inputs = inputs;
out1.targets = targets;

ANSWER

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

1- I wanted to fill some data that I missed during measurement by ANN and using some parameters which may impact on my target data. Inputgap are those data(8 parameters) that may be helpful to fill the gap.

Please do not refer to input variables and output variables as parameters. Parameters are entities that stay constant during the process:

outputs = f(inputs,parameters).

> 2- size of my input is 1525 data and size of gap is 666(target).

Still not clear: Apparently I need some physical insight:

What are your inputs, parameters and targets?size(targets) = [ 1  859]    
size(inputs) = [ 8 1525]
==> size(inputs) = [ 8 859] for net training?
size(inputs) = [ 8 666] for estimating missing data?

> 3- I wanted to try several H. I think(I am not sure if it is correct)If I use from 4 to 2n+3 for H (which n is my 8 parameters) would be enough to get the high mse and R-squared .

Not sure where you got that estimate. If the target plot is relatively smooth you will need at least one hidden node for each local extremum.

SEE COMPLETE ANSWER CLICK THE LINK

--

--

Technical Source
Technical Source

Written by Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

No responses yet