8 views (last 30 days)

I have a set of data :

Input to the network for training : 2 inputs

input1 1e13 1.2e13 1.23e13 ..... input2 1e09 1.01e09 1.2e09 ......

ouput 1e11 2e11 2.2e11.......

I have such 31 data points and 31 target data points,

What, I have done is used the first 25 data points and trained and tested the network using nftool, remaing 6 data points I have used the trained network to predict and selected that network which gave me the least error in the output.

My question is :

(a) The trained network shows excellent match for the target data points but as soon as I put another set of data i.e. say input1 5e13 input2 2e09 , it gives me an output which does not make sense, i.e. gives me a value lesser than that which it had given when I was training the network i.e. say input1 4e13 input2 1.8e09 , it gave a value of say 4e11 , but for the former inputs it is giving me a value of 3.8e11 , which does not make any sense , How do I train the network better so that at least it follows the trend i.e. when input1 increases the output or the value thrown by the network should increase ?

(b) I even tried normalizing the data using premnmx, but not sure how do I use the trained network with a single value say input1 5e13 input2 2e09 i.e. How do I normalize this input, what shoudl be the reference to normalize the same ?

Your inputs would help tremendously,

Thanks, Tonu

Greg Heath
on 8 Mar 2014

Edited: Greg Heath
on 8 Mar 2014

[ I N ] = size(x) % [ 2 31 ]

[O N ]= size(t)% [ 1 31]

1. For precision computing transform to zero mean and unit biased variance data (zx = zscore(x',1)', etc)

2. First time through use as many defaults as possible (trainlm with trn/val/tst =21/5/5 or trainbr with /25/0/6)

> What, I have done is used the first 25 data points and trained and tested > the network using nftool, remaing 6 data points I have used the trained > network to predict and selected that network which gave me the least > error in the output.

Very insufficient detail. Network type? No. of hidden nodes? No. of candidate designs with different initial weights? How did you avoid overfitting the network and memorizing training data?(val or trainbr?)

Many designs are needed to eliminate unfortunate values of initial weights and make sure that the network is not overfit (more weights than than the 26 training equations) and overtrained (memorizing training data without val or trainbr)).

First practice with MATLAB datasets to make sure you have enough data to obtain a good design.

Next use as many defaults as possible.

If no validation set use trainbr instead of trainlm.

If you are not using trainbr, try to minimize the number of hidden nodes.

Next time you post provide more details

Hope this helps.

Thank you for formally accepting my answer

Greg

Image Analyst
on 4 Apr 2014

Greg's comments moved here:

STILL insufficient detail. Failing to generalize to unseen data is a symptom of overtraining an overfit net with more unknown weights, Nw, than training equations Ntrneq. Assuming, of course, the new data can be assumed to come from the same probability distribution function ( e.g., mean, variance & correlation coefficient) as the training data. I have posted many discussions on overtraining.

Short answer: If statistics of new data are similar to those of the training data use a validation set or use TRAINBR.

Long Answer:

1. Search the comp.ai.neural-nets FAQ for the discussion of overfitting.

2. Search CANN, MATLAB NEWSGROUP and ANSWERS for my posts using "greg" and subsets of

overfitting overtraining Nw Ntrneq

Why don't you make the corrections and post your commented code.

Greg

Greg Heath
on 1 May 2014

IT WOULD REALLY HELP IF YOU RAN YOUR CODE ON ONE OF THE EXAMPLE DATASETS IN

help nndatasets

doc nndatasets

>> net = fitnet(3) % NO SEMICOLON

%yields

performFcn: 'mse'

trainFcn: 'trainlm'

trainParam: .showWindow, .showCommandLine, .show, .epochs,

.time, .goal, .min_grad, .max_fail, .mu, .mu_dec,

.mu_inc, .mu_max

%Therefore lr and mc are not defined for the default trainlm.

% Since mse is the performance function

obj_fun = mse(o3-y_exp)

%Proper normalization by the variance of the target yields

normobj_fun = obj_fun/var(y_exp,1)

% The coefficient of determination, ( or R-squared See Wikipedia r-squared)is

R2 = 1-normobj_fun

% R2 > 0.99 means the net is sucessfully accounting for 99% of the target variance.

Sign in to comment.

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.