I am working on a neural net I keep getting a Matrix Dimensions Must Agree Error for the ex_sum accumulator in my for loop. I am not sure why because the matrixes being element wise multiplied are of equal dimensions. Can anyone explain why I might be getting this error??? Thanks in advance. (This is for multi-class classification with element-wise multiplication with a logic vector of size 10X1)
ex_sum = 0;
for i = 1:5000
c = 1:10;
output = c == y(i);
ex_sum = ex_sum + sum(-output .* log(hypothesis(i,:)) - (1-output) .* log(1 - hypothesis(i,:)));
end
J = 1/m * ex_sum;