Help meeeee.....through this prblm.
Show older comments
hai, i want a program on three input and two output neural network with two hidden layers(1st hidden layer should have 3 nodes and 2nd layer 2 nodes... )
this program help me in solving so many things....so ,pls send the prgm as early as possible...
thank you,
2 Comments
Greg Heath
on 14 Feb 2012
Usually there is no good reason to use more than one hidden layer. Similarly, there is usually no good reason to not use as many default parameters as possible.
What version of the NNtoolbox are you using? There are currently two versions of NEWFF, and one each of FEEDFORWARDNET and FITNET.
See samples of code in the Documentation, the Newsgroup, and Answers.
Hope this helps.
Greg
Greg Heath
on 14 Feb 2012
What type of net do you need?
Regression (curve fitting) , Classification, or Time-Series Prediction?
Greg
Answers (2)
Greg Heath
on 14 Feb 2012
0 votes
The syntax to create a feedforward network with :
- 3 unit of inputs - hidden1 : 3 nodes - hidden2 : 2 nodes - 2 unit of outputs is shown below :
net = newff(PR,[3 3 2 2],{'logsig','logsig','logsig','logsig'},'traingda');
INCORRECT. THIS SPECIFIES 3 HIDDEN LAYERS. ONLY 1 IS NEEDED.
NOTE: I AM USING ALL CAPS FOR CLARIFICATION. DO NOT USE ALL CAPS IN YOUR CODE!
EITHER STANDARDIZE INPUTS TO ZERO-MEAN/UNIT-VARIANCE OR, IF PHYSICAL OR MATHEMATICAL BOUNDS ARE KNOWN, NORMALIZE TO THE BOUNDED BIPOLAR INTERVAL [-1,1].
FOR REGRESSION STANDARDIZE OUTPUTS.
USE 1 HIDDEN LAYER
USE TANSIG FOR HIDDEN NODES (DEFAULT)
USE PURELIN FOR THE OUTPUT NODES (DEFAULT)
USE TRAINLM FOR TRAINING (DEFAULT)
IF Pn IS THE NORMALIZED INPUT MATRIX AND Tn IS THE NORMALIZED OUTPUT MATRIX,
[ I N ] = SIZE(Pn)
[O N ] = SIZE( Tn)
FOR I-H-O NODE TOPOLOGY
NET = NEWFF(MINMAX(Pn), [H O]); % OLD VERSION
NET = NEWFF(Pn,Tn,H); % NEWER VERSION
NET = FITNET(H); % NEWEST VERSION
SEE THE DOCUMENTATION EXAMPLES ...(E.G., DOC FITNET)
In the next step you need to train this network. You can use train command from the toolbox.
For stopping criteria you can set the maximum number of epochs : 1500 and performance goal : 0
net.trainParam.epochs = 1500;
net.trainParam.goal = 0;
IF YOU USE TRAINLM THE DEFAULT IS 100 EPOCHS. INCREASE IF NEEDED
A PRACTICAL GOAL IS MEAN(VAR(Tn'))/100
net = train(net,pa,t);
Then to simulate the output, you can use sim command.
[NET TR Y] = TRAIN(...) AUTOMATICALLY YIELDS THE OUTPUT Y
This code below is just an example for the complete code :
p = [4 3 4 1 3 2]; t = eye(2);
COLUMNS OF EYE TYPICALLY ONLY USED FOR CLASSIFICATION.
pa = (p-min(p(:))) / (max(p(:))-min(p(:)));
PR = [0 1;0 1;0 1];
NOT RECOMMENDED. NORMALIZE EACH ROW SEPARATELY. EITHER STANDARDIZE OR NORMALIZE TO [-1 ,1]
-----SNIP
GREG
1 Comment
uday KUMAR
on 23 Feb 2012
uday KUMAR
on 23 Feb 2012
3 Comments
Greg Heath
on 24 Feb 2012
I don't mind helping you to use the NN Toolbox. However,
not using the toolbox and expecting me to inspect a zillion lines
of uncommented code is over the top.
Greg.
uday KUMAR
on 24 Feb 2012
Walter Roberson
on 24 Feb 2012
Using that code format does not prevent you from adding useful comments.
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!