My Code for Input-Output Mapping by Neural Network toolbox (nftool) in MATLAB is correct?

I have written a code for Mapping using nftool and its as follow.
%-----------------------------------------------------------------
clc
clear all
load input.mat % Size is [1*200]
load output.mat % Size is [1*200]
load newinput.mat % Size is [1*5]
x=input;
t=output;
x1=newinput;
trainFcn = 'trainlm'; % Training algorithm
hiddenLayerSize = 5; % No. of hidden neurons
net = fitnet(hiddenLayerSize,trainFcn); % Network is developed
[trainInd,valInd,testInd]=divideind(200,1:150,151:180,181:200) % Dividing samples
net.divideParam.trainInd= 1:150
net.divideParam.valInd= 151:180
net.divideParam.testInd= 181:200
[net,tr] = train(net,x,t);
y = net(x);
e = gsubtract(t,y);
performance = perform(net,t,y);
view(net);
y1=net(x1) % Output for newinput x1
%------------------------------------------------------------------------------------
I have an input data of [1*200] in size and corresponding target(output) data of [1*200]. I am using " divideind " to divide my samples for developing the network. to test the mapping I have a test data named " newinput ". My samples, newinput and number of neurons are fixed. When I re-run the code I get different answer of " y1 " for same input " x1 ". 
So my question is " Why I am getting different answers for " y1 " when my all inputs are constant? ". Is anything wrong with my code?

Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Asked:

on 2 Jan 2017

Community Treasure Hunt

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

Start Hunting!