I am trying to implement a neural network which have around 2000 inputs.
I have made some tests with the iris data set in order to check it and it seems to work, but when I am running my test it throws wrong results, most of the time, for all the tests, I obtain the same output for every data. I am afraid if it is somehow related to the bias process and the gradient update, maybe you guys can spot the error or give me some advice. Here is part of the code for the backpropagation process.
def backward_propagation(parameters, cache, X, Y):
#weights
W1 = parameters['W1']
W2 = parameters['W2']
#Outputs after activation function
A1 = cache['A1']
A2 = cache['A2']
dZ2= A2 - Y
dW2 = np.dot(dZ2, A1.T)
db2 = np.sum(dZ2, axis=1, keepdims=True)
dZ1 = np.multiply(np.dot(W2.T, dZ2), 1 - np.power(A1, 2))
dW1 = np.dot(dZ1, X.T)
db1 = np.sum(dZ1, axis=1, keepdims=True)
gradient = {"dW1": dW1,
"db1": db1,
"dW2": dW2,
"db2": db2}
return gradient