I'm trying to train single layer perceptron. I don't understand one thing. How to calculate output for vector input x?
For example let say we have this data to use for training:
L1 = [1.5 2.4; -0.3 3; 2 3; 2 2.5]; L2 = [2.5 1.4; -1.3 2; 3 3.1; 1.2 2.5];
weight init, step:
step = 0.1 w = [1 1];
Then L = [L1; L2]; Then we have this formula to calculate mean sum square sum_all - I mean sigma symbol which means sum all elements.
E = 1/N * sum_all(d(j) - o(j))^2
j - is index of vector inside L matrix.
Then new weight equation:
w(new) = w + step/N * sum_all(d(j) - o(j) * o(j) * (1 - o(j)) * x(j))
Then we have this logical function (pseudo code as it may look clearer):
d(j) = 1 if x(j) belongs to L1 d(j) = 0 if x(j) belongs to L2
And I don't understand how I have to get o(j) or in other words output. I didn't find anywhere where it would say how you get it. It kind of not clear for me.
Should I do something like this?
if w * x(j)' > 0 then o(j) = 1 elseif w * x(j)' <= then o(j) = 0
But then if I run my algorithm, it stops training after one epoch and of course does not train it at all (as actual output won't differ from desired output in a first epoch at all).
If I try something like this:
o(j) = w * x(j)', then numbers go so high that matlab stop recognizing it as number and it goes into infinite loop..
So how I should get actual output x(j) - o(j) using single layer perceptron and backpropagation algorithm?..