views:

675

answers:

3

I have a question that may be trivial but it's not described anywhere i've looked. I'm studying neural networks and everywhere i look there's some theory and some trivial example with some 0s and 1s as an input. I'm wondering: do i have to put only one value as an input value for one neuron, or can it be a vector of, let's say, 3 values (RGB colour for example)?

+1  A: 

It can be whatever you want, as long as you write your inner function accordingly.

The examples you mention use [0;1] as their domain, but you can use R, R², or whatever you want, as long as the function you use in your neurons is defined on this domain.

In your case, you can define your functions on R3 to allow for RGB values to be handled

A trivial example : use (x1, y1, z1),(x2,y2,z2)->(ax1+x2,by1+y2,cz1+z2) as your function to transform two colors into one, a b and c being your learning coefs, which you will determine during the learning phase.

Very detailed information (including the answer to your question) is available on Wikipedia.

Brann
but if one dataset stays in a relation with another dataset they should be provided to different neurons, shouldn't they? or may it be a one vector's input?
agnieszka
yes, it can be a one vector input ; R3 means a 3-members vector (well, trivially speaking)
Brann
well yeah i get that :D i mean if you have 3 colours of a one pixel in 3 subsequent images and you know that differences between these colours influence the result should you have 3 neurons for these 3 colors or one neuron for an input containing these 3 colours? or do i choose?
agnieszka
I guess I would use an array of neurons (1 per pixel), with each neurons getting three RGB vectors (one per same coordinate pixel of each image) as input values.
Brann
thanks that was helpful! the last question - does it mean that i HAVE to have a function that changes my R^n value to a R value for an input neuron?
agnieszka
+2  A: 

When dealing with multi-dimensional data, I believe a two layer neural network is said to give better result.

In your case:

R[0..1] => (N1)----\
                    \
G[0..1] => (N2)-----(N4) => Result[0..1]
                    /
B[0..1] => (N3)----/

As you can see, the N4 neurone can handle 3 entries.

The [0..1] interval is a convention but a good one imo. That way, you can easily code a set of generic neuron classes that can take an arbitrary number of entries (I had template C++ classes with the number of entries as template parameter personally). So you code the logic of your neurons once, then you toy with the structure of the network and/or combinations of functions within your neurons.

Julian Aubourg
but that's not a 3-dimentional data.... it's one value for one neuron
agnieszka
the problem is i have set of pixels of an image, i have some (3?) subsequent images of a one view that give me some (3?) different colours of a one pixel. each colour consists of 3 values. the question is - to be continued
agnieszka
the question is should i desing one input neuron for each r and g and b for every pixel for every image or can i put a colour (r,g,b value) as an input for one neuron, or maybe 3 subsequent colours?
agnieszka
The thing is you have a lot of options here. What is the problem exactly? If it's local to each pixel (ie, the solution only depends on the three consecutive colors of the same pixel) then you only need one neural network into which you'll enter you data (...)
Julian Aubourg
(...) pixel by pixel. Now, how a neural network should be configured? There's no real answer to that. Should you have 3 subnetworks like the one I have into my post than cumulate their result into another neuron? Should you have 9 entry neurons and one cumulator in the end? (...)
Julian Aubourg
no, it's about recognizing a movement so it depends on a change of colours of a one pixel and of it's realtion to his neighbours i guess
agnieszka
(...) or do you only need one neuron that will take the 9 values all at once? (which btw, wouldn't really be a "network" so to speak). It all depends on your problem and there is no all-mighty solution because every problem is different. (...)
Julian Aubourg
i just try to find out if there even is a way to put a vector such as colour as an input value for a ONE input neuron, or do i have to put one value for one neuron because i still don't get it
agnieszka
(...) what you really need is to break you problem into subproblems. It seems to me you have to determine "something" using 3 consecutive colors of the same pixel: this is network Net1. And then, maybe, you need to take into account neighbours (...)
Julian Aubourg
(...) with another network that will take the result of Net1 as its input (Net2).
Julian Aubourg
And again, a neuron can take as many entries as you want it to, like Brann said. It's all a question of what function you have into it. If it can take multiple values as input, then you have a multiple entry neuron.
Julian Aubourg
so if my neuron in the first layer takes a colour, can it produce a colour as an output for a neuron in a second layer?
agnieszka
I woudn't recommand 3 dimensional output for a neuron. I'd rather have you input neurons (Layer1) having a single output that is given to each 3 neurons of Layer2. Then you can use the 3 outputs of Layer2 as your resulting color.
Julian Aubourg
thanks, that helped a lot
agnieszka
+1  A: 

Normally a single neuron takes as its input multiple real numbers and outputs a real number, which typically is calculated as applying the sigmoid function to the sum of the real numbers (scaled, and then plus or minus a constant offset).

If you want to put in, say, two RGB vectors (2 x 3 reals), you need to decide how you want to combine the values. If you add all the elements together and apply the sigmoid function, it is equivalent to getting in six reals "flat". On the other hand, if you process the R elements, then the G elements, and the B elements, all individually (e.g. sum or subtract the pairs), you have in practice three independent neurons.

So in short, no, a single neuron does not take in vector values.

antti.huima
so in a situation you described you have 3 input neurons, each one getting a value that consists of three values, for example three Rs?
agnieszka
Ah, there where actually only two R's in the example above, but yes, one way would be to dedicate one neuron per one element.
antti.huima