cost = -1/m np.sum(np.sum(((Ynp.log(A2)+(1-Y)np.log(1-A2))))) + (lambda_/(2m))(np.sum(np.sum(W1W1))+np.sum(np.sum(W2*W2)))
m is number of examples
Y is actual output
A2 is predicted output
lambda_ is a regularization term to reduce over fitting
W1 and W2 are weights of neural network