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

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

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

Hi Greg,
Thanks for getting back to me on this!
Do you know of any way around this (or is this an in-built feature of the Toolbox which I need to live with)?
For example, would it be possible to somehow save the network state for each case as it is trained, and then load this stored network state prior to presenting the next case?
Thanks in advance, Rob
I am completely baffled.
The info that you want to store is meaningless.
Why in the world would you want to do this??
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 Deep Learning Toolbox in Help Center and File Exchange

Asked:

on 21 May 2014

Commented:

on 30 May 2014

Community Treasure Hunt

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

Start Hunting!