Is it possible to manually select cases from an array for training a neural network?

1 view (last 30 days)
Hi all,
I’m trying to create a conventional backpropagation network to solve the XoR problem.
The input cases (and their respective targets) are:
0 0 (0)
1 0 (1)
0 1 (1)
1 1 (0)
Here is the issue: I need to take control of selecting each case for training the network (rather than the MATLAB default doing this for me). To do this, I am using simple code to select each case in turn and manually pass the case through the network.
I set up and configure the network using these commands
net = feedforwardnet(2);
net.trainFcn = 'traingdm';
net = configure (net, train_data,target_data);
('train_data' and 'target_data' are the names of the respective databases)
For each selected case, I present it to the network for training with the ‘adapt’ function
net = adapt(net,P,T);
(P and T are input and target values for the selected case)
Unfortunately, the network seems to be having trouble learning XoR solution. The system will produce the right answer only some of the time. That is, the network does not reliably learn the solution.
My questions is this: is it permissible for me to manually select each case in turn and run it through the network (as done above), or is case selection something that MATLAB needs to do itself?

Accepted Answer

Greg Heath
Greg Heath on 24 May 2014
No. The net must process the inputs together (batch or sequential). Otherwise the net will forget the characteristics of previous inputs.
Hope this helps
Thank you for formally accepting my answer
Greg
  3 Comments
Greg Heath
Greg Heath on 28 May 2014
I am completely baffled.
The info that you want to store is meaningless.
Why in the world would you want to do this??
Greg Heath
Greg Heath on 30 May 2014
The simple answer is no. In multivariable problems it is very seldom that the answer can be obtained by sequencing multiple significant operations of different inputs.

Sign in to comment.

More Answers (0)

Categories

Find more on Sequence and Numeric Feature Data Workflows 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!