How to give new input to trained network and getting output using neural network toolbox

조회 수: 4 (최근 30일)
Hello Friends,
I am using neural network toolbox. I have trained the net using input matrix of 5 X 48 and output matrix of 2 X 48. The network is saved by name Abhay. Now I want to use this network using a 5 X 1 input matrix and the corresponding output should be a 2 X 1 matrix as it is trained. I used, y = sim(Abhay,r) % r is the 5 X 1 input matrix. The result of this command should be a 2 X 1 but I am getting error regarding the size of input. so please if anyone can explain the problem and remedy.
  댓글 수: 3
ABHAY SONI
ABHAY SONI 2013년 8월 23일
function net = Abhay(inputs,targets) %CREATE_FIT_NET Creates and trains a fitting neural network. % % NET = CREATE_FIT_NET(INPUTS,TARGETS) takes these arguments: % INPUTS - RxQ matrix of Q R-element input samples % TARGETS - SxQ matrix of Q S-element associated target samples % arranged as columns, and returns these results: % NET - The trained neural network % % For example, to solve the Simple Fit dataset problem with this function: % % load simplefit_dataset % net = create_fit_net(simplefitInputs,simplefitTargets); % simplefitOutputs = sim(net,simplefitInputs); % % To reproduce the results you obtained in NFTOOL: % % net = create_fit_net(data',data');
% Create Network numHiddenNeurons = 40; % Adjust as desired net = newfit(inputs,targets,numHiddenNeurons); net.divideParam.trainRatio = 70/100; % Adjust as desired net.divideParam.valRatio = 15/100; % Adjust as desired net.divideParam.testRatio = 15/100; % Adjust as desired
% Train and Apply Network [net,tr] = train(net,inputs,targets); outputs = sim(net,inputs);
% Plot plotperf(tr) plotfit(net,inputs,targets) plotregression(targets,outputs)
The error
>> Abhay ??? Input argument "inputs" is undefined.
Error in ==> Abhay at 22 net = newfit(inputs,targets,numHiddenNeurons);
Greg Heath
Greg Heath 2013년 8월 26일
Please format. See the code symbol {}?
I don't understand. You previously mentioned an error regarding size(r) Where is the code relating to that?
Now you have an error because the variable inputs was never defined.
What version are you using?
newfit Create a fitting network.
Obsoleted in R2010b NNET 7.0. Last used in R2010a NNET 6.0.4.
Hope this helps.
Greg

댓글을 달려면 로그인하십시오.

답변 (1개)

Greg Heath
Greg Heath 2017년 11월 13일
Bottom Line:
You used "inputs" instead of the defined "SimplefitInputs"
Hope this helps.
Thank you for formally accepting my answer
Greg
PS: Take the time to FORMAT your questions with the {} operator. THEN your mistakes will become more obvious to us!

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by