From: Kiran Ramaswamy on
Hi all - my question is with relation to setting up sparsely connected neural networks using MATLAB / Neural Network Toolbox.

Essentially my goal is this - I'm going to have a set of inputs on my input layer, constructed through converting a series of NxN matrices obtained from an image - most likely 250x250 - into a 1-dimensional array (in this case, 62500 x M, where M is the number of images I'm using).

I need to connect this input layer to a single hidden layer, or possibly two hidden layers, and then connect the hidden layer to the output. The output will be a single item, consisting of a true-false setup.

The problem that I'm trying to address is the fact that I don't want a fully connected network. I have an algorithm that I've developed that will dictate which inputs are connected to which hidden layer items, but I'm not sure how to actually make that assignment.

What I'd like to be able to do is something like, Connect InputArray(0) to HiddenLayer (1), Connect InputArray(0) to HiddenLayer(2) ... etc...

Then, I'd like to be able to assign weights to the specific connections I've created, based on another algorithm.

Of course, the whole set up is going to be done through a script, not manually, so I'll need to be able to address the different items through array indices, as dictated by the current loop I'm using.

Any advice on how to achieve this goal?
From: Steven Lord on

"Kiran Ramaswamy" <kramaswamy7(a)yahoo.com> wrote in message
news:homa9t$t2f$1(a)fred.mathworks.com...
> Hi all - my question is with relation to setting up sparsely connected
> neural networks using MATLAB / Neural Network Toolbox.
>
> Essentially my goal is this - I'm going to have a set of inputs on my
> input layer, constructed through converting a series of NxN matrices
> obtained from an image - most likely 250x250 - into a 1-dimensional array
> (in this case, 62500 x M, where M is the number of images I'm using).
>
> I need to connect this input layer to a single hidden layer, or possibly
> two hidden layers, and then connect the hidden layer to the output. The
> output will be a single item, consisting of a true-false setup.
>
> The problem that I'm trying to address is the fact that I don't want a
> fully connected network. I have an algorithm that I've developed that will
> dictate which inputs are connected to which hidden layer items, but I'm
> not sure how to actually make that assignment.
>
> What I'd like to be able to do is something like, Connect InputArray(0) to
> HiddenLayer (1), Connect InputArray(0) to HiddenLayer(2) ... etc...
>
> Then, I'd like to be able to assign weights to the specific connections
> I've created, based on another algorithm.
>
> Of course, the whole set up is going to be done through a script, not
> manually, so I'll need to be able to address the different items through
> array indices, as dictated by the current loop I'm using.
>
> Any advice on how to achieve this goal?

Once you have your basic network object (which you can construct using
NETWORK, NEWFF, NEWRB, etc.) you can change its properties (including its
architecture) by modifying its properties. You can use this page from the
documentation for reference; the various *Connect properties and the IW, LW,
and b properties will be of particular interest to you.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: Kiran Ramaswamy on
What page are you referring to? I looked through the neural network toolbox documentation and didn't see anything relating to what I need to do, but it's possible I may have missed it - could you point me towards the location you're describing?

"Steven Lord" <slord(a)mathworks.com> wrote in message <homcfh$t5l$1(a)fred.mathworks.com>...
>
> "Kiran Ramaswamy" <kramaswamy7(a)yahoo.com> wrote in message
> news:homa9t$t2f$1(a)fred.mathworks.com...
> > Hi all - my question is with relation to setting up sparsely connected
> > neural networks using MATLAB / Neural Network Toolbox.
> >
> > Essentially my goal is this - I'm going to have a set of inputs on my
> > input layer, constructed through converting a series of NxN matrices
> > obtained from an image - most likely 250x250 - into a 1-dimensional array
> > (in this case, 62500 x M, where M is the number of images I'm using).
> >
> > I need to connect this input layer to a single hidden layer, or possibly
> > two hidden layers, and then connect the hidden layer to the output. The
> > output will be a single item, consisting of a true-false setup.
> >
> > The problem that I'm trying to address is the fact that I don't want a
> > fully connected network. I have an algorithm that I've developed that will
> > dictate which inputs are connected to which hidden layer items, but I'm
> > not sure how to actually make that assignment.
> >
> > What I'd like to be able to do is something like, Connect InputArray(0) to
> > HiddenLayer (1), Connect InputArray(0) to HiddenLayer(2) ... etc...
> >
> > Then, I'd like to be able to assign weights to the specific connections
> > I've created, based on another algorithm.
> >
> > Of course, the whole set up is going to be done through a script, not
> > manually, so I'll need to be able to address the different items through
> > array indices, as dictated by the current loop I'm using.
> >
> > Any advice on how to achieve this goal?
>
> Once you have your basic network object (which you can construct using
> NETWORK, NEWFF, NEWRB, etc.) you can change its properties (including its
> architecture) by modifying its properties. You can use this page from the
> documentation for reference; the various *Connect properties and the IW, LW,
> and b properties will be of particular interest to you.
>
> --
> Steve Lord
> slord(a)mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
>
From: Steven Lord on

"Kiran Ramaswamy" <kramaswamy7(a)yahoo.com> wrote in message
news:horodv$mqn$1(a)fred.mathworks.com...
> What page are you referring to? I looked through the neural network
> toolbox documentation and didn't see anything relating to what I need to
> do, but it's possible I may have missed it - could you point me towards
> the location you're describing?

Sorry, I forgot the link. This page is part of the documentation for the
most recent release of Neural Network Toolbox; if you're using an older
version, you should go to the corresponding page in the documentation
included in your installation.

http://www.mathworks.com/access/helpdesk/help/toolbox/nnet/network2.html#2476

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: Kiran Ramaswamy on
This image will serve as my example that I'm going to use:
http://img52.imageshack.us/img52/765/network.jpg

If I understand the algorithm right, here's what I would have to do:

net.IW(1,1) = 1
net.IW(1,4) = 1
net.IW(1,2) = 0
net.IW(1,3) = 0

net.IW(2,1) = 1
net.IW(2,2) = 1
net.IW(2,3) = 0
net.IW(2,4) = 0

net.IW(3,2) = 1
net.IW(3,3) = 1
net.IW(3,4) = 0
net.IW(3,1) = 0

net.IW(4,3) = 1
net.IW(4,4) = 1
net.IW(4,1) = 0
net.IW(4,2) = 0

net.IW(5,4) = 1
net.IW(5,1) = 0
net.IW(5,2) = 0
net.IW(5,3) = 0

How though, do I tell MATLAB that this is the connection from the input to the hidden layer 1? Makes sense to me that the first number would be the input nodes, since this is the input weights - but the second number I'm using is the node of the hidden layer 1, although I've not defined anywhere that I'm referring to hidden layer 1.