declare net of neural network in matlab

hi, I'd assigned this variable in matlab net = newff(minmax(input),Target,Hiddenlayer,'logsig','logsig'},'traingdx');'
I have 5 testing different images and 20 training images(4 sample for each of images). my question is to set the input and target, the matrix must be in dimension/matrix values or just simply in vector values? in my research, the problem is nnet does not gives accurate result. the performance always keep on changing when I run nnet.Why is that.. and can someone described me does the neural network values not fixed. is it changes every time we run the nnet?thanks in advance!

 Accepted Answer

Greg Heath
Greg Heath on 12 Oct 2012
% declare net of neural network in matlab
% Asked by Tulips on 10 Oct 2012 at 10:49
% hi, I'd assigned this variable in matlab
% net = newff(minmax(input),Target,Hiddenlayer,'logsig','logsig'},'traingdx');'
Invalid syntax for BOTH OBSOLETE versions of newff.
Which version are you using?
Is this regression or classification?
If the latter, use columns of eye(5) for target columns.
Make sure inputs are standardized (zscore or mapstd) and use tansig as the hidden node activation function.
[ I N ] = size(input)
[O N ] = size(target)
net = newff(mimax(input), [H O],{'tansig' 'logsig'); % Obsolete
net = newff(input, target, H, {'tansig' 'logsig'} ) ;% Less Obsolete
% I have 5 testing different images and 20 training images(4 sample for % each of images). my question is to set the input and target, the matrix % must be in dimension/matrix values or just simply in vector values? in my % research, the problem is nnet does not gives accurate result. the % performance always keep on changing when I run nnet.Why is that.. and can % someone described me does the neural network values not fixed. is it % changes every time we run the nnet?thanks in advance!
Each call of newff loads random weights. To repeat a previous run reinitialize the RNG to the same initial state.
Sample code is available by searhing the newsgroup using some subset of
heath newff close clear Neq Nw Ntrials
Hope this helps.
Thank you for formally accepting my answer.
Greg

6 Comments

I used matlab 2012a. yes, matlab command displayed obsolete when I used newff(minmax(input),Target,Hiddenlayer,'logsig','logsig'},'traingdx');'
then how to overcome this problem and assigned the input,target, hidden and training algorithm?
mr Greg, thanks for answering my question. the newff can also be used for classification right?after I run using this code it less obsolete newff((imc),T,15,{'tansig' ,'logsig'}) with lm training algorithm.the nnet will be stop as the minimum gradient reached. it this correct? for instance, eopch is assgined =2000, hidden layer =15.
1. The syntax you used was incorrect for BOTH obsolete versions. Carefully compare what you have written in your comment and original with what I wrote in my answer.
2. With 2012a you can use PATTERNNET for classification. I think the default training alg is TRAINSCG instead of TRAINLM.
help/doc patternnet
3. All of the latest algorithms, including NEWFF, automatically divide the data into training, validation and test subsets using DIVIDERAND with a 0.7/0.15/0.15 split.
help/doc divide
If you want a different division function or a different ratio, you have to override the default. See the documentation section on custom nets.
Use the form [ net tr ] = train(..).
Just typing net without semicolon before and after training will help you understand the state of net before and after training
Typing tr without semicolon after training will help you understand the results.
Hope this helps.
sir, can u give the accurate syntax for newff?am thinking to not use paternnet.are they same? how to know whether the syntax to declare nn function is correct or not?
sir can you explain me.for instance I have:- input = 200 x 20,[R,C]=size(input) target= 5 x20, [S2,Q]=size(target) output= 5 hiddenlayer =150 can to use patternet syntax to declare the above values? does patternnet same with newff?if I used for of them should I declare the value for bias or weight?or they are already built in with matlab.thanks for your answer.
can I know from the confusion table if I used patternnet.if it display NaN value at the confusion table, does it means our data is wrong?

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!