I saw this (https://www.youtube.com/watch?v=MPmLWsHzPlU) video where the teacher explain how to build a god network after trying by myself Im stuck with this problem.
He said to add the bias after moltiplication between W * INPUT, but in this first case I have example
Network(4 IN, 16 HIDDEN, 4 OUT), So the Matrix IN would be a 4 row 1 column and the matrix Weight_InHid would be 16, 4 and according to Algebra you can moltiply only if columns of A(IN) = Row of B(Weight_InHd), and It would be fine, then When I add the Bias to Hidden It will become +1 bigger and in the next feedforward I will get the dimension of the 2 Matrices different and I can’t do that!
Anyone can explain where is the trick?
Im pretty tired maybe im doing something super wrong!
Here a piace of code

``````CONSTRUCTOR
Net(int I_node, int H_node, int O_node)
{
input_nodes = I_node;
hidden_nodes = H_node;
output_nodes = O_node;

weights_ih = new Matrix(H_node, I_node);
weights_ho = new Matrix(O_node, H_node);

weights_ih.randomize(); //-1 and 1
weights_ho.randomize();
}
float[] feedforward(float[] input_array)
{
Matrix inputs = new Matrix();
Matrix outputs = new Matrix();
inputs = inputs.singleColumnMatrixFromArray(input_array);

//Generating the HIDDEN OUTPUTS--------------------
//Now multiply the 2 matrices, weight_ih * input
Matrix hidden = new Matrix();
hidden = weights_ih; //Clone weights_ih into hidden as temp matrix

hidden = hidden.multiply(inputs); //Multiply the 2 matrices hidden(weights_ih) * input
hidden = hidden.activate(); //Finally activation sigmoid :D
hidden.output(); //Print matrix
//-------------------------------------------------

//Generating the OUTPUT'S OUTPUT
outputs = weights_ho;
outputs = outputs.multiply(hidden);//HERE I GET the error of compatibility between matrices
outputs.activate();
float[] guess  = outputs.toArray();
//Send it to the caller
return guess;
}
``````

I put a +1 in the constructor when I initialized weights_ih and weights_ho:

``````weights_ih = new Matrix(H_node, I_node+1);
weights_ho = new Matrix(O_node, H_node+1);
``````

and now it is work!
I dont know why but it’s cool now expect for the 1 more output useless Feel free to reply please cause I want to understand better what’s going on before use this algorithm