How do i approximate non-linear function with neural networks and work with performance plot?

12 views (last 30 days)
I have to approximate nonlinear function with neural network. The number of layers and number of neurons in layers are chosen by me. Suppose i have a certain dataset (attached).
Dataset contains 7 variables. T1-T5 are used to create function (see code) and X1 and X2 are inputs.
Now my code just does not work as intended. I am not even sure this is correct so a confirmation would be nice ☺.
But now the real problem. After i train the network, the performance graph shows three lines, one for training, one for validation and one for test. How can i change it. I only used train command for training set and it divided the training set into validation, training and test.
Lets suppose I join those three together into the big one. How does the algorithm decide how to divide them? Does it divide the data evenly? Can i decide how it will be divided?
load 'Data_Problem1_regression.mat';
Tnew = (8*T1 + 5*T2 + 2*T3 + 1*T4 + 0*T5)/(8+5+2+1+0); %this is given from the exercise. This is the function output
training = Tnew(1:1000)'; % 1000 samples from Tnew are supposed to be training (transposed for network to work)
validation = Tnew(1001:2000)'; % 1000 for validation
test = Tnew(2001:3000)'; % 1000 for testing.
x = {X1(1:1000)';X2(1:1000)'}; % Neural netowork will have two inputs.
%%
net1=feedforwardnet(12,'trainlm');
net1.numinputs = 2;
view(net1)
net1 = train(net1,x,training); % only giving "training" set as an argument but the performance plot will have 3 lines

Accepted Answer

Srivardhan Gadila
Srivardhan Gadila on 4 Mar 2020
The net1 from above has the function divideFcn as Object property. This property defines the data division function to be used when the network is trained using a supervised algorithm, such as backpropagation. You can set this property to the name of a division function.
For a list of functions, type "help nndivision" in command window
If you don't want any validation or test splits then use dividetrain.

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!