How can I design my own fitting neural network?

23 views (last 30 days)
I want to design a neural network which will be trained to calculate the squra root of 1000 random numbers generated. but I don't want to use fitnet, instead I want to design my own fitting network. can any one tell me the architecture of fitnet used in matlab means how many layers, initializing functions, training functions etc used.

Accepted Answer

Greg Heath
Greg Heath on 1 Dec 2013
Always start with the default configuration.
help fitnet
Combine with the script obtained via the nntool GUI.
You also can find examples by searching
greg fitnet Ntrials
HTH
Thank you for formally accepting my answer.
Greg
  1 Comment
saima zia
saima zia on 2 Dec 2013
Edited: saima zia on 2 Dec 2013
Thanks for guiding. I m sending u my code, I have tried to create my own fitnet to train it to calculate square root of number,instead of using the matlab fitnet. the structure of my network is exactly like the fitnet architecture( I analyzed the fitnet architecture by looking at the script and object created of fitnet).plz check it and let me know what mistake I m making cause its not getting trained.
x=rand(1,1000)*150;
t=sqrt(x);
net=network();
net.adaptFcn='adaptwb';
net.numInputs=1;
net.inputs{1}.size=1;
net.numLayers=2;
net.layers{1}.size=10;
net.layers{2}.size=1;
net.inputConnect(1,1)=1;
net.layerConnect(2,1)=1;
net.biasConnect(1)=1;
net.biasConnect(2)=1;
net.biases{1}.learnFcn='learngdm';
net.biases{1}.initFcn='';
net.biases{2}.learnFcn='learngdm';
net.biases{2}.initFcn='';
net.outputConnect(2)=1;
net.layers{1}.transferFcn='tansig';
net.layers{2}.transferFcn = 'purelin';
net.inputweights{1,1}.initFcn='';
net.inputweights{1,1}.learnFcn='learngdm';
net.layerweights{2,1}.initFcn='';
net.layerweights{2,1}.learnFcn='learngdm';
net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};
net.outputs{2}.processFcns = {'removeconstantrows','mapminmax'};
net.divideFcn = 'dividerand'; % Divide data randomly
net.divideMode = 'sample'; % Divide up every sample
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
net.trainFcn = 'trainlm';
net.performFcn = 'mse';
net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ... 'plotregression', 'plotfit'};
[net,tr] = train(net,x,t);
outputs = net(x);
test=100;
result = sim(net,test);

Sign in to comment.

More Answers (0)

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!