Why does my cost function return double the expected value?
You are supposed to perform calculations on cost function element wise. Try using

np.multiply


instead of 

np.dot


which is an inner product for Matrices.