How to use ftinet to create neural network

1 次查看(过去 30 天)
Hi, I am doing a regression analysis using matlab Neuralnetwor for the verson2009, where I need to correlate 3 input data sets of(3*10) matrix with a target data set of (1*10)matrix. At first I have tried to use nntool and nftool. Now I am trying to do using command line by creating network with fitnet, but I am getting an error "??? Error using ==> load Unable to read file InputNeg: No such file or directory. Error in ==> math1 at 14 inputs = load ('InputNeg');" When I am trying to load the Input and Target Mat file. Then I tried to write the values directly in the code then I got the error "??? Undefined function or method 'fitnet' for input arguments of type 'double'. Error in ==> math1 at 17 net = fitnet(hiddenLayerSize);" Please If any one have any Idea about this, suggest me what should I do. Thanks in Advance
  3 个评论
Das Bably
Das Bably 2013-11-23
Sorry for late post. Here is my code in which I used the data sets directly a=[8.87 7.4 5.54 6.41 2.7 5.00 3.28 7.37 4.72 5.68]; b=[1.38 1.46 1.53 1.84 1.72 1.16 1.52 1.8 1.57 1.04]; c=[13.78 4.61 9.94 9.97 12.07 3.24 6.14 11.1 11.17 7.98]; y=[4.1644 3.5753 3.7534 4.1781 4.4589 2.8699 2.1781 4.0753 3.6644 2.3562]; inputs = vertcat(a,b,c); targets = y; % Create a Fitting Network hiddenLayerSize = 10; net = fitnet(hiddenLayerSize); % Set up Division of Data for Training, Validation, Testing net.divideParam.trainRatio = 70/100; net.divideParam.valRatio = 15/100; net.divideParam.testRatio = 15/100; % Train the Network [net,tr] = train(net,inputs,targets); % Test the Network outputs = net(inputs); errors = gsubtract(outputs,targets); performance = perform(net,targets,outputs) % View the Network view(net) Thanks in advance

请先登录,再进行评论。

采纳的回答

Greg Heath
Greg Heath 2013-12-1
This is a poor example: N = 10 is not large enough to obtain robust practical solutions. With [I N ] =size(x) = [ 3 10 ], [O N ] = size(t) = [ 1 10], Ntst = round(0.15*N) = 2, Nval = Ntst =2, Ntrn = N-Nval-Ntst = 6, Ntrneq = Ntrn*O = 6 is the number of training equations.
With H hidden nodes, the number of unknown weights is Nw = (I+1)*H+(H+1)*O. A sufficient condition for a robust practical solution is Ntrneq >> Nw. However, Notice that, Ntrneq > Nw only when H <= Hub where Hub = -1+ceil( (Ntrneq-O) / (I+O+1)) = 0.
There is quite a bit more that I could say about this poor example. However, the main points are
1. I was able to run your code
2. Be careful of overfitting (H too large and/or N too small) with your real data set.
Hope this helps.
Thank you for formally accepting my answer
Greg

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by