# Implementation of Multiclass Perceptron

The following text is from Hal Daumé III's "A Course in Machine Learning" online text book (Page-41).

I implemented the following:

Is the implementation correct?

D = 2;
MaxIter = 100;
w = zeros(1, D);
b = 1;
for i=1:MaxIter
output = zeros(D,1);
for j=1:D

a = activ_func(product(x(j,:), w') + b);

if product(y(j,1), a)>0
output(j)  = a;

delta = y(j) - output(j);

inc = x(j,:) * (coeff  * delta);

w(1, j) = w(1, j) + inc';

b = b + y(j, 1);
end
end
end

w_ret = w;


I have a few confusions.

What does it mean by ya? Is it the multiplication of a scalar value of a and the entire vector y? Or, between a and the j-th element of y (given that the inner for loop uses j as the loop counter)?

Also, what does that Algorithm-6 do? It should be calling Algorithm-5 rather than. Right?

• You have not included information about activ_func, product, coeff and delta (maybe more, I stopped counting). Please include all the necessary information, it's not possible to help without it. – Stewie Griffin Jan 13 '17 at 10:49
• This is not multiclass perceptron. – horcrux Jul 1 '17 at 12:01