how to execute the algorithmic operations like summation, cross etc. in matlab?

1 view (last 30 days)
like in the equation
Activation(j) = |Input^Weight(j)| / (bias + |Weight(j)|
R=(<v,x>)/(x)
Y=∑ I x W
actually i am implementing ART1 algorithm on protein sequence, in which for category activation this formula is being used. in this formula i.e activation for category=1 the 'Input' i.e fold1 is of size [104,1] and weight [104,1]'. but the calculation seems to be taking enormous time, when i tried to multiply whereas using 'min' its computationally feasible, but m afraid its not the correct implementation of the formula? plz help..

Accepted Answer

Roger Stafford
Roger Stafford on 15 Feb 2014
The only one that makes sense to me is that it signifies dot (inner, scalar) product. If the 'x' symbol was supposed to represent cross (vector) product, that would require that I and W each possess three elements, as in 3D space, and I doubt if that is what you have in mind. Furthermore, taking the sum of the components of a cross product does not seem a very useful activity. Suffice it to say that matlab has both the 'dot' and 'cross' functions.
However, g.s.p, you should be the one telling us what this notation means to you, rather than our having to guess.
  2 Comments
g.s.p
g.s.p on 16 Feb 2014
actually i am implementing ART1 algorithm on protein sequence, in which for category activation this formula is being used. in this formula i.e activation for category=1 the 'Input' i.e fold1 is of size [104,1] and weight [104,1]'. but the calculation seems to be taking enormous time, when i tried to multiply whereas using 'min' its computationally feasible, but m afraid its not the correct implementation of the formula? plz help..
Roger Stafford
Roger Stafford on 16 Feb 2014
It is pretty clear that the first symbol indicates summation. The uncertainly is with the 'x' symbol which must mean some kind of product. If you could give a reference to your source for this formula, someone might be able to interpret it accurately for you.
You say "the calculation seems to be taking enormous time", which must mean that you have attempted to implement this operation. Was that in matlab? If so, what was your matlab code for it? Assuming that I is a column vector and W a row vector, and assuming the 'x' symbol indicates matrix multiplication, the operation
sum(I*W)
would probably not be a good method to use. I would think that
sum(I)*W
which gives the same result in this case, would be faster. The first method requires 21,528 flops whereas the second requires only 207 flops. However, I have serious doubts that this is what your formula means.

Sign in to comment.

More Answers (1)

Wayne King
Wayne King on 15 Feb 2014
You can use dot() to compute the inner product of two vectors.
norm( ) to compute the norm, since the norm induced by the inner product is the 2-norm, you likely want
norm(x,2)
For example,
x = randn(100,1);
y = randn(100,1);
R = dot(x,y)/norm(x,2);

Community Treasure Hunt

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

Start Hunting!